<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class FieldDeclaration extends BodyDeclaration { public static final ChildPropertyDescriptor JAVADOC_PROPERTY = internalJavadocPropertyFactory ( FieldDeclaration . class ) ; public static final SimplePropertyDescriptor MODIFIERS_PROPERTY = internalModifiersPropertyFactory ( FieldDeclaration . class ) ; public static final ChildListPropertyDescriptor MODIFIERS2_PROPERTY = internalModifiers2PropertyFactory ( FieldDeclaration . class ) ; public static final ChildPropertyDescriptor TYPE_PROPERTY = new ChildPropertyDescriptor ( FieldDeclaration . class , "type" , Type . class , MANDATORY , NO_CYCLE_RISK ) ; public static final ChildListPropertyDescriptor FRAGMENTS_PROPERTY = new ChildListPropertyDescriptor ( FieldDeclaration . class , "fragments" , VariableDeclarationFragment . class , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS_2_0 ; private static final List PROPERTY_DESCRIPTORS_3_0 ; static { List properyList = new ArrayList ( 5 ) ; createPropertyList ( FieldDeclaration . class , properyList ) ; addProperty ( JAVADOC_PROPERTY , properyList ) ; addProperty ( MODIFIERS_PROPERTY , properyList ) ; addProperty ( TYPE_PROPERTY , properyList ) ; addProperty ( FRAGMENTS_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS_2_0 = reapPropertyList ( properyList ) ; properyList = new ArrayList ( 5 ) ; createPropertyList ( FieldDeclaration . class , properyList ) ; addProperty ( JAVADOC_PROPERTY , properyList ) ; addProperty ( MODIFIERS2_PROPERTY , properyList ) ; addProperty ( TYPE_PROPERTY , properyList ) ; addProperty ( FRAGMENTS_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS_3_0 = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { if ( apiLevel == AST . JLS2_INTERNAL ) { return PROPERTY_DESCRIPTORS_2_0 ; } else { return PROPERTY_DESCRIPTORS_3_0 ; } } private Type baseType = null ; private ASTNode . NodeList variableDeclarationFragments = new ASTNode . NodeList ( FRAGMENTS_PROPERTY ) ; FieldDeclaration ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final int internalGetSetIntProperty ( SimplePropertyDescriptor property , boolean get , int value ) { if ( property == MODIFIERS_PROPERTY ) { if ( get ) { return getModifiers ( ) ; } else { internalSetModifiers ( value ) ; return 0 ; } } return super . internalGetSetIntProperty ( property , get , value ) ; } 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 == TYPE_PROPERTY ) { if ( get ) { return getType ( ) ; } else { setType ( ( Type ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == MODIFIERS2_PROPERTY ) { return modifiers ( ) ; } if ( property == FRAGMENTS_PROPERTY ) { return fragments ( ) ; } return super . internalGetChildListProperty ( property ) ; } final ChildPropertyDescriptor internalJavadocProperty ( ) { return JAVADOC_PROPERTY ; } final SimplePropertyDescriptor internalModifiersProperty ( ) { return MODIFIERS_PROPERTY ; } final ChildListPropertyDescriptor internalModifiers2Property ( ) { return MODIFIERS2_PROPERTY ; } final int getNodeType0 ( ) { return FIELD_DECLARATION ; } ASTNode clone0 ( AST target ) { FieldDeclaration result = new FieldDeclaration ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setJavadoc ( ( Javadoc ) ASTNode . copySubtree ( target , getJavadoc ( ) ) ) ; if ( this . ast . apiLevel == AST . JLS2_INTERNAL ) { result . internalSetModifiers ( getModifiers ( ) ) ; } if ( this . ast . apiLevel >= AST . JLS3 ) { result . modifiers ( ) . addAll ( ASTNode . copySubtrees ( target , modifiers ( ) ) ) ; } result . setType ( ( Type ) getType ( ) . clone ( target ) ) ; result . fragments ( ) . addAll ( ASTNode . copySubtrees ( target , fragments ( ) ) ) ; 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 ) { acceptChild ( visitor , getJavadoc ( ) ) ; if ( this . ast . apiLevel >= AST . JLS3 ) { acceptChildren ( visitor , this . modifiers ) ; } acceptChild ( visitor , getType ( ) ) ; acceptChildren ( visitor , this . variableDeclarationFragments ) ; } visitor . endVisit ( this ) ; } public Type getType ( ) { if ( this . baseType == null ) { synchronized ( this ) { if ( this . baseType == null ) { preLazyInit ( ) ; this . baseType = this . ast . newPrimitiveType ( PrimitiveType . INT ) ; postLazyInit ( this . baseType , TYPE_PROPERTY ) ; } } } return this . baseType ; } public void setType ( Type type ) { if ( type == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . baseType ; preReplaceChild ( oldChild , type , TYPE_PROPERTY ) ; this . baseType = type ; postReplaceChild ( oldChild , type , TYPE_PROPERTY ) ; } public List fragments ( ) { return this . variableDeclarationFragments ; } int memSize ( ) { return super . memSize ( ) + 2 * 4 ; } int treeSize ( ) { return memSize ( ) + ( this . optionalDocComment == null ? 0 : getJavadoc ( ) . treeSize ( ) ) + ( this . modifiers == null ? 0 : this . modifiers . listSize ( ) ) + ( this . baseType == null ? 0 : getType ( ) . treeSize ( ) ) + this . variableDeclarationFragments . listSize ( ) ; } } </s>