<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; import org . eclipse . jdt . core . compiler . InvalidInputException ; import org . eclipse . jdt . internal . compiler . parser . Scanner ; import org . eclipse . jdt . internal . compiler . parser . TerminalTokens ; public class Javadoc extends Comment { public static final SimplePropertyDescriptor COMMENT_PROPERTY = new SimplePropertyDescriptor ( Javadoc . class , "comment" , String . class , MANDATORY ) ; public static final ChildListPropertyDescriptor TAGS_PROPERTY = new ChildListPropertyDescriptor ( Javadoc . class , "tags" , TagElement . class , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS_2_0 ; private static final List PROPERTY_DESCRIPTORS_3_0 ; static { List properyList = new ArrayList ( 3 ) ; createPropertyList ( Javadoc . class , properyList ) ; addProperty ( COMMENT_PROPERTY , properyList ) ; addProperty ( TAGS_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS_2_0 = reapPropertyList ( properyList ) ; properyList = new ArrayList ( 2 ) ; createPropertyList ( Javadoc . class , properyList ) ; addProperty ( TAGS_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 static final String MINIMAL_DOC_COMMENT = "/** */" ; private String comment = MINIMAL_DOC_COMMENT ; private ASTNode . NodeList tags = new ASTNode . NodeList ( TAGS_PROPERTY ) ; Javadoc ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final Object internalGetSetObjectProperty ( SimplePropertyDescriptor property , boolean get , Object value ) { if ( property == COMMENT_PROPERTY ) { if ( get ) { return getComment ( ) ; } else { setComment ( ( String ) value ) ; return null ; } } return super . internalGetSetObjectProperty ( property , get , value ) ; } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == TAGS_PROPERTY ) { return tags ( ) ; } return super . internalGetChildListProperty ( property ) ; } final int getNodeType0 ( ) { return JAVADOC ; } ASTNode clone0 ( AST target ) { Javadoc result = new Javadoc ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; if ( this . ast . apiLevel == AST . JLS2_INTERNAL ) { result . setComment ( getComment ( ) ) ; } result . tags ( ) . addAll ( ASTNode . copySubtrees ( target , tags ( ) ) ) ; 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 ) { acceptChildren ( visitor , this . tags ) ; } visitor . endVisit ( this ) ; } public String getComment ( ) { supportedOnlyIn2 ( ) ; return this . comment ; } public void setComment ( String docComment ) { supportedOnlyIn2 ( ) ; if ( docComment == null ) { throw new IllegalArgumentException ( ) ; } char [ ] source = docComment . toCharArray ( ) ; Scanner scanner = this . ast . scanner ; scanner . resetTo ( 0 , source . length ) ; scanner . setSource ( source ) ; try { int token ; boolean onlyOneComment = false ; while ( ( token = scanner . getNextToken ( ) ) != TerminalTokens . TokenNameEOF ) { switch ( token ) { case TerminalTokens . TokenNameCOMMENT_JAVADOC : if ( onlyOneComment ) { throw new IllegalArgumentException ( ) ; } onlyOneComment = true ; break ; default : onlyOneComment = false ; } } if ( ! onlyOneComment ) { throw new IllegalArgumentException ( ) ; } } catch ( InvalidInputException e ) { throw new IllegalArgumentException ( ) ; } preValueChange ( COMMENT_PROPERTY ) ; this . comment = docComment ; postValueChange ( COMMENT_PROPERTY ) ; } public List tags ( ) { return this . tags ; } int memSize ( ) { int size = super . memSize ( ) + 2 * 4 ; if ( this . comment != MINIMAL_DOC_COMMENT ) { size += stringSize ( this . comment ) ; } return size ; } int treeSize ( ) { return memSize ( ) + this . tags . listSize ( ) ; } } </s>