<s> package org . eclipse . jdt . internal . core . jdom ; import org . eclipse . jdt . core . Flags ; import org . eclipse . jdt . core . ICompilationUnit ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . jdom . * ; import org . eclipse . jdt . internal . core . util . Messages ; import org . eclipse . jdt . internal . core . util . CharArrayBuffer ; import org . eclipse . jdt . internal . core . util . Util ; class DOMImport extends DOMNode implements IDOMImport { protected boolean fOnDemand ; protected int fFlags = Flags . AccDefault ; DOMImport ( ) { this . fName = "java.lang.*" ; setMask ( MASK_DETAILED_SOURCE_INDEXES , true ) ; } DOMImport ( char [ ] document , int [ ] sourceRange , String name , int [ ] nameRange , boolean onDemand , int modifiers ) { super ( document , sourceRange , name , nameRange ) ; this . fOnDemand = onDemand ; this . fFlags = modifiers ; setMask ( MASK_DETAILED_SOURCE_INDEXES , true ) ; } DOMImport ( char [ ] document , int [ ] sourceRange , String name , boolean onDemand , int modifiers ) { this ( document , sourceRange , name , new int [ ] { - 1 , - 1 } , onDemand , modifiers ) ; this . fOnDemand = onDemand ; setMask ( MASK_DETAILED_SOURCE_INDEXES , false ) ; } protected void appendFragmentedContents ( CharArrayBuffer buffer ) { if ( this . fNameRange [ 0 ] < 0 ) { buffer . append ( "import " ) . append ( this . fName ) . append ( ';' ) . append ( Util . getLineSeparator ( buffer . toString ( ) , null ) ) ; } else { buffer . append ( this . fDocument , this . fSourceRange [ 0 ] , this . fNameRange [ 0 ] - this . fSourceRange [ 0 ] ) ; buffer . append ( this . fName ) ; buffer . append ( this . fDocument , this . fNameRange [ 1 ] + 1 , this . fSourceRange [ 1 ] - this . fNameRange [ 1 ] ) ; } } public String getContents ( ) { if ( this . fName == null ) { return null ; } else { return super . getContents ( ) ; } } protected DOMNode getDetailedNode ( ) { return ( DOMNode ) getFactory ( ) . createImport ( getContents ( ) ) ; } public IJavaElement getJavaElement ( IJavaElement parent ) throws IllegalArgumentException { if ( parent . getElementType ( ) == IJavaElement . COMPILATION_UNIT ) { return ( ( ICompilationUnit ) parent ) . getImport ( getName ( ) ) ; } else { throw new IllegalArgumentException ( Messages . element_illegalParent ) ; } } public int getNodeType ( ) { return IDOMNode . IMPORT ; } public boolean isOnDemand ( ) { return this . fOnDemand ; } protected DOMNode newDOMNode ( ) { return new DOMImport ( ) ; } public void setName ( String name ) { if ( name == null ) { throw new IllegalArgumentException ( Messages . element_nullName ) ; } becomeDetailed ( ) ; super . setName ( name ) ; this . fOnDemand = name . endsWith ( ".*" ) ; } public String toString ( ) { return "IMPORT: " + getName ( ) ; } public int getFlags ( ) { return this . fFlags ; } public void setFlags ( int flags ) { this . fFlags = flags ; } } </s>