<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class PackageDeclaration extends ASTNode { public static final ChildPropertyDescriptor JAVADOC_PROPERTY = new ChildPropertyDescriptor ( PackageDeclaration . class , "javadoc" , Javadoc . class , OPTIONAL , NO_CYCLE_RISK ) ; public static final ChildListPropertyDescriptor ANNOTATIONS_PROPERTY = new ChildListPropertyDescriptor ( PackageDeclaration . class , "annotations" , Annotation . class , CYCLE_RISK ) ; public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor ( PackageDeclaration . class , "name" , Name . class , MANDATORY , NO_CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS_2_0 ; private static final List PROPERTY_DESCRIPTORS_3_0 ; static { List propertyList = new ArrayList ( 2 ) ; createPropertyList ( PackageDeclaration . class , propertyList ) ; addProperty ( NAME_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS_2_0 = reapPropertyList ( propertyList ) ; propertyList = new ArrayList ( 4 ) ; createPropertyList ( PackageDeclaration . class , propertyList ) ; addProperty ( JAVADOC_PROPERTY , propertyList ) ; addProperty ( ANNOTATIONS_PROPERTY , propertyList ) ; addProperty ( NAME_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS_3_0 = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { if ( apiLevel == AST . JLS2_INTERNAL ) { return PROPERTY_DESCRIPTORS_2_0 ; } else { return PROPERTY_DESCRIPTORS_3_0 ; } } Javadoc optionalDocComment = null ; private ASTNode . NodeList annotations = null ; private Name packageName = null ; PackageDeclaration ( AST ast ) { super ( ast ) ; if ( ast . apiLevel >= AST . JLS3 ) { this . annotations = new ASTNode . NodeList ( ANNOTATIONS_PROPERTY ) ; } } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == JAVADOC_PROPERTY ) { if ( get ) { return getJavadoc ( ) ; } else { setJavadoc ( ( Javadoc ) child ) ; return null ; } } if ( property == NAME_PROPERTY ) { if ( get ) { return getName ( ) ; } else { setName ( ( Name ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == ANNOTATIONS_PROPERTY ) { return annotations ( ) ; } return super . internalGetChildListProperty ( property ) ; } final int getNodeType0 ( ) { return PACKAGE_DECLARATION ; } ASTNode clone0 ( AST target ) { PackageDeclaration result = new PackageDeclaration ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; if ( this . ast . apiLevel >= AST . JLS3 ) { result . setJavadoc ( ( Javadoc ) ASTNode . copySubtree ( target , getJavadoc ( ) ) ) ; result . annotations ( ) . addAll ( ASTNode . copySubtrees ( target , annotations ( ) ) ) ; } result . setName ( ( Name ) getName ( ) . clone ( target ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { if ( this . ast . apiLevel >= AST . JLS3 ) { acceptChild ( visitor , getJavadoc ( ) ) ; acceptChildren ( visitor , this . annotations ) ; } acceptChild ( visitor , getName ( ) ) ; } visitor . endVisit ( this ) ; } public List annotations ( ) { if ( this . annotations == null ) { unsupportedIn2 ( ) ; } return this . annotations ; } public Javadoc getJavadoc ( ) { if ( this . annotations == null ) { unsupportedIn2 ( ) ; } return this . optionalDocComment ; } public void setJavadoc ( Javadoc docComment ) { if ( this . annotations == null ) { unsupportedIn2 ( ) ; } ASTNode oldChild = this . optionalDocComment ; preReplaceChild ( oldChild , docComment , JAVADOC_PROPERTY ) ; this . optionalDocComment = docComment ; postReplaceChild ( oldChild , docComment , JAVADOC_PROPERTY ) ; } public Name getName ( ) { if ( this . packageName == null ) { synchronized ( this ) { if ( this . packageName == null ) { preLazyInit ( ) ; this . packageName = new SimpleName ( this . ast ) ; postLazyInit ( this . packageName , NAME_PROPERTY ) ; } } } return this . packageName ; } public void setName ( Name name ) { if ( name == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . packageName ; preReplaceChild ( oldChild , name , NAME_PROPERTY ) ; this . packageName = name ; postReplaceChild ( oldChild , name , NAME_PROPERTY ) ; } public IPackageBinding resolveBinding ( ) { return this . ast . getBindingResolver ( ) . resolvePackage ( this ) ; } int memSize ( ) { return BASE_NODE_SIZE + 3 * 4 ; } int treeSize ( ) { return memSize ( ) + ( this . optionalDocComment == null ? 0 : getJavadoc ( ) . treeSize ( ) ) + ( this . annotations == null ? 0 : this . annotations . listSize ( ) ) + ( this . packageName == null ? 0 : getName ( ) . treeSize ( ) ) ; } } </s>