<s> package org . eclipse . jdt . internal . core . jdom ; 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 DOMPackage extends DOMNode implements IDOMPackage { DOMPackage ( ) { setMask ( MASK_DETAILED_SOURCE_INDEXES , true ) ; } DOMPackage ( char [ ] document , int [ ] sourceRange , String name ) { super ( document , sourceRange , name , new int [ ] { - 1 , - 1 } ) ; setMask ( MASK_DETAILED_SOURCE_INDEXES , false ) ; } DOMPackage ( char [ ] document , int [ ] sourceRange , String name , int [ ] nameRange ) { super ( document , sourceRange , name , nameRange ) ; setMask ( MASK_DETAILED_SOURCE_INDEXES , true ) ; } protected void appendFragmentedContents ( CharArrayBuffer buffer ) { if ( this . fNameRange [ 0 ] < 0 ) { String lineSeparator = Util . getLineSeparator ( buffer . toString ( ) , null ) ; buffer . append ( "package " ) . append ( this . fName ) . append ( ';' ) . append ( lineSeparator ) . append ( lineSeparator ) ; } else { buffer . append ( this . fDocument , this . fSourceRange [ 0 ] , this . fNameRange [ 0 ] - this . fSourceRange [ 0 ] ) . append ( this . fName ) . 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 ( ) . createPackage ( getContents ( ) ) ; } public IJavaElement getJavaElement ( IJavaElement parent ) throws IllegalArgumentException { if ( parent . getElementType ( ) == IJavaElement . COMPILATION_UNIT ) { return ( ( ICompilationUnit ) parent ) . getPackageDeclaration ( getName ( ) ) ; } else { throw new IllegalArgumentException ( Messages . element_illegalParent ) ; } } public int getNodeType ( ) { return IDOMNode . PACKAGE ; } protected DOMNode newDOMNode ( ) { return new DOMPackage ( ) ; } public void setName ( String name ) { becomeDetailed ( ) ; super . setName ( name ) ; } public String toString ( ) { return "PACKAGE: " + getName ( ) ; } } </s>