<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . Iterator ; import java . util . List ; public class SingleVariableDeclaration extends VariableDeclaration { public static final SimplePropertyDescriptor MODIFIERS_PROPERTY = new SimplePropertyDescriptor ( SingleVariableDeclaration . class , "modifiers" , int . class , MANDATORY ) ; public static final ChildListPropertyDescriptor MODIFIERS2_PROPERTY = new ChildListPropertyDescriptor ( SingleVariableDeclaration . class , "modifiers" , IExtendedModifier . class , CYCLE_RISK ) ; public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor ( SingleVariableDeclaration . class , "name" , SimpleName . class , MANDATORY , NO_CYCLE_RISK ) ; public static final ChildPropertyDescriptor TYPE_PROPERTY = new ChildPropertyDescriptor ( SingleVariableDeclaration . class , "type" , Type . class , MANDATORY , NO_CYCLE_RISK ) ; public static final SimplePropertyDescriptor VARARGS_PROPERTY = new SimplePropertyDescriptor ( SingleVariableDeclaration . class , "varargs" , boolean . class , MANDATORY ) ; public static final SimplePropertyDescriptor EXTRA_DIMENSIONS_PROPERTY = new SimplePropertyDescriptor ( SingleVariableDeclaration . class , "" , int . class , MANDATORY ) ; public static final ChildPropertyDescriptor INITIALIZER_PROPERTY = new ChildPropertyDescriptor ( SingleVariableDeclaration . class , "initializer" , Expression . class , OPTIONAL , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS_2_0 ; private static final List PROPERTY_DESCRIPTORS_3_0 ; static { List propertyList = new ArrayList ( 6 ) ; createPropertyList ( SingleVariableDeclaration . class , propertyList ) ; addProperty ( MODIFIERS_PROPERTY , propertyList ) ; addProperty ( TYPE_PROPERTY , propertyList ) ; addProperty ( NAME_PROPERTY , propertyList ) ; addProperty ( EXTRA_DIMENSIONS_PROPERTY , propertyList ) ; addProperty ( INITIALIZER_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS_2_0 = reapPropertyList ( propertyList ) ; propertyList = new ArrayList ( 7 ) ; createPropertyList ( SingleVariableDeclaration . class , propertyList ) ; addProperty ( MODIFIERS2_PROPERTY , propertyList ) ; addProperty ( TYPE_PROPERTY , propertyList ) ; addProperty ( VARARGS_PROPERTY , propertyList ) ; addProperty ( NAME_PROPERTY , propertyList ) ; addProperty ( EXTRA_DIMENSIONS_PROPERTY , propertyList ) ; addProperty ( INITIALIZER_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 ; } } private ASTNode . NodeList modifiers = null ; private int modifierFlags = Modifier . NONE ; private SimpleName variableName = null ; private Type type = null ; private boolean variableArity = false ; private int extraArrayDimensions = 0 ; private Expression optionalInitializer = null ; SingleVariableDeclaration ( AST ast ) { super ( ast ) ; if ( ast . apiLevel >= AST . JLS3 ) { this . modifiers = new ASTNode . NodeList ( MODIFIERS2_PROPERTY ) ; } } final SimplePropertyDescriptor internalExtraDimensionsProperty ( ) { return EXTRA_DIMENSIONS_PROPERTY ; } final ChildPropertyDescriptor internalInitializerProperty ( ) { return INITIALIZER_PROPERTY ; } final ChildPropertyDescriptor internalNameProperty ( ) { return NAME_PROPERTY ; } 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 { setModifiers ( value ) ; return 0 ; } } if ( property == EXTRA_DIMENSIONS_PROPERTY ) { if ( get ) { return getExtraDimensions ( ) ; } else { setExtraDimensions ( value ) ; return 0 ; } } return super . internalGetSetIntProperty ( property , get , value ) ; } final boolean internalGetSetBooleanProperty ( SimplePropertyDescriptor property , boolean get , boolean value ) { if ( property == VARARGS_PROPERTY ) { if ( get ) { return isVarargs ( ) ; } else { setVarargs ( value ) ; return false ; } } return super . internalGetSetBooleanProperty ( property , get , value ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == NAME_PROPERTY ) { if ( get ) { return getName ( ) ; } else { setName ( ( SimpleName ) child ) ; return null ; } } if ( property == TYPE_PROPERTY ) { if ( get ) { return getType ( ) ; } else { setType ( ( Type ) child ) ; return null ; } } if ( property == INITIALIZER_PROPERTY ) { if ( get ) { return getInitializer ( ) ; } else { setInitializer ( ( Expression ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == MODIFIERS2_PROPERTY ) { return modifiers ( ) ; } return super . internalGetChildListProperty ( property ) ; } final int getNodeType0 ( ) { return SINGLE_VARIABLE_DECLARATION ; } ASTNode clone0 ( AST target ) { SingleVariableDeclaration result = new SingleVariableDeclaration ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; if ( this . ast . apiLevel == AST . JLS2_INTERNAL ) { result . setModifiers ( getModifiers ( ) ) ; } else { result . modifiers ( ) . addAll ( ASTNode . copySubtrees ( target , modifiers ( ) ) ) ; result . setVarargs ( isVarargs ( ) ) ; } result . setType ( ( Type ) getType ( ) . clone ( target ) ) ; result . setExtraDimensions ( getExtraDimensions ( ) ) ; result . setName ( ( SimpleName ) getName ( ) . clone ( target ) ) ; result . setInitializer ( ( Expression ) ASTNode . copySubtree ( target , getInitializer ( ) ) ) ; 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 ) { acceptChildren ( visitor , this . modifiers ) ; } acceptChild ( visitor , getType ( ) ) ; acceptChild ( visitor , getName ( ) ) ; acceptChild ( visitor , getInitializer ( ) ) ; } visitor . endVisit ( this ) ; } public List modifiers ( ) { if ( this . modifiers == null ) { unsupportedIn2 ( ) ; } return this . modifiers ; } public int getModifiers ( ) { if ( this . modifiers == null ) { return this . modifierFlags ; } else { int computedModifierFlags = Modifier . NONE ; for ( Iterator it = modifiers ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Object x = it . next ( ) ; if ( x instanceof Modifier ) { computedModifierFlags |= ( ( Modifier ) x ) . getKeyword ( ) . toFlagValue ( ) ; } } return computedModifierFlags ; } } public void setModifiers ( int modifiers ) { internalSetModifiers ( modifiers ) ; } final void internalSetModifiers ( int pmodifiers ) { supportedOnlyIn2 ( ) ; preValueChange ( MODIFIERS_PROPERTY ) ; this . modifierFlags = pmodifiers ; postValueChange ( MODIFIERS_PROPERTY ) ; } public SimpleName getName ( ) { if ( this . variableName == null ) { synchronized ( this ) { if ( this . variableName == null ) { preLazyInit ( ) ; this . variableName = new SimpleName ( this . ast ) ; postLazyInit ( this . variableName , NAME_PROPERTY ) ; } } } return this . variableName ; } public void setName ( SimpleName variableName ) { if ( variableName == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . variableName ; preReplaceChild ( oldChild , variableName , NAME_PROPERTY ) ; this . variableName = variableName ; postReplaceChild ( oldChild , variableName , NAME_PROPERTY ) ; } public Type getType ( ) { if ( this . type == null ) { synchronized ( this ) { if ( this . type == null ) { preLazyInit ( ) ; this . type = this . ast . newPrimitiveType ( PrimitiveType . INT ) ; postLazyInit ( this . type , TYPE_PROPERTY ) ; } } } return this . type ; } public void setType ( Type type ) { if ( type == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . type ; preReplaceChild ( oldChild , type , TYPE_PROPERTY ) ; this . type = type ; postReplaceChild ( oldChild , type , TYPE_PROPERTY ) ; } public boolean isVarargs ( ) { if ( this . modifiers == null ) { unsupportedIn2 ( ) ; } return this . variableArity ; } public void setVarargs ( boolean variableArity ) { if ( this . modifiers == null ) { unsupportedIn2 ( ) ; } preValueChange ( VARARGS_PROPERTY ) ; this . variableArity = variableArity ; postValueChange ( VARARGS_PROPERTY ) ; } public int getExtraDimensions ( ) { return this . extraArrayDimensions ; } public void setExtraDimensions ( int dimensions ) { if ( dimensions < 0 ) { throw new IllegalArgumentException ( ) ; } preValueChange ( EXTRA_DIMENSIONS_PROPERTY ) ; this . extraArrayDimensions = dimensions ; postValueChange ( EXTRA_DIMENSIONS_PROPERTY ) ; } public Expression getInitializer ( ) { return this . optionalInitializer ; } public void setInitializer ( Expression initializer ) { ASTNode oldChild = this . optionalInitializer ; preReplaceChild ( oldChild , initializer , INITIALIZER_PROPERTY ) ; this . optionalInitializer = initializer ; postReplaceChild ( oldChild , initializer , INITIALIZER_PROPERTY ) ; } int memSize ( ) { return BASE_NODE_SIZE + 7 * 4 ; } int treeSize ( ) { return memSize ( ) + ( this . modifiers == null ? 0 : this . modifiers . listSize ( ) ) + ( this . type == null ? 0 : getType ( ) . treeSize ( ) ) + ( this . variableName == null ? 0 : getName ( ) . treeSize ( ) ) + ( this . optionalInitializer == null ? 0 : getInitializer ( ) . treeSize ( ) ) ; } } </s>