RECODER 0.92

recoder.java.declaration
Class LocalVariableDeclaration

java.lang.Object
  extended by recoder.java.JavaSourceElement
      extended by recoder.java.JavaProgramElement
          extended by recoder.java.JavaNonTerminalProgramElement
              extended by recoder.java.declaration.JavaDeclaration
                  extended by recoder.java.declaration.VariableDeclaration
                      extended by recoder.java.declaration.LocalVariableDeclaration
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Declaration, LoopInitializer, NonTerminalProgramElement, ProgramElement, TypeReferenceContainer, SourceElement, Statement, ModelElement

public class LocalVariableDeclaration
extends VariableDeclaration
implements LoopInitializer

Local variable declaration.

Author:
AutoDoc
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface recoder.java.ProgramElement
ProgramElement.TreeStructure
 
Nested classes/interfaces inherited from interface recoder.java.SourceElement
SourceElement.Position
 
Field Summary
 
Fields inherited from class recoder.java.JavaSourceElement
factory
 
Fields inherited from interface recoder.java.ProgramElement
STRUCTURAL_EQUALITY, STRUCTURAL_HASH_CODE
 
Constructor Summary
  LocalVariableDeclaration()
          Local variable declaration.
  LocalVariableDeclaration(ASTList<DeclarationSpecifier> mods, TypeReference typeRef, ASTList<VariableSpecification> vars)
          Local variable declaration.
  LocalVariableDeclaration(ASTList<DeclarationSpecifier> mods, TypeReference typeRef, Identifier name, Expression init)
          Local variable declaration.
protected LocalVariableDeclaration(LocalVariableDeclaration proto)
          Local variable declaration.
  LocalVariableDeclaration(TypeReference typeRef, Identifier name)
          Local variable declaration.
 
Method Summary
 void accept(SourceVisitor v)
          Receive a visitor, for instance a pretty printer.
 LocalVariableDeclaration deepClone()
          Deep clone.
 NonTerminalProgramElement getASTParent()
          Get AST parent.
 ProgramElement getChildAt(int index)
          Returns the child at the specified index in this node's "virtual" child array
 int getChildCount()
          Returns the number of children of this node.
 int getChildPositionCode(ProgramElement child)
          Returns the positional code of the given child, or -1 if there is no such child.
 StatementContainer getStatementContainer()
          Get statement container.
 java.util.List<VariableSpecification> getVariables()
          Get variables.
 ASTList<VariableSpecification> getVariableSpecifications()
           
 boolean isPrivate()
          Local variables are never private.
 boolean isProtected()
          Local variables are never protected..
 boolean isPublic()
          Local variables are never "public".
 boolean isStatic()
          Local variables are never static.
 boolean isTransient()
          Local variables are never transient.
 void makeParentRoleValid()
          Make parent role valid.
 boolean replaceChild(ProgramElement p, ProgramElement q)
          Replace a single child in the current node.
 void setStatementContainer(StatementContainer c)
          Set statement container.
 void setVariableSpecifications(ASTList<VariableSpecification> l)
           
 
Methods inherited from class recoder.java.declaration.VariableDeclaration
getFirstElement, getLastElement, getTypeReference, getTypeReferenceAt, getTypeReferenceCount, isFinal, setTypeReference
 
Methods inherited from class recoder.java.declaration.JavaDeclaration
getAnnotations, getDeclarationSpecifiers, getModifiers, getVisibilityModifier, isAbstract, isNative, isStrictFp, isSynchronized, isVolatile, setDeclarationSpecifiers
 
Methods inherited from class recoder.java.JavaNonTerminalProgramElement
getIndexOfChild, getRoleOfChild, makeAllParentRolesValid, validateAll
 
Methods inherited from class recoder.java.JavaProgramElement
getComments, getID, setComments, validate
 
Methods inherited from class recoder.java.JavaSourceElement
getEndPosition, getFactory, getRelativePosition, getStartPosition, setEndPosition, setRelativePosition, setStartPosition, toSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface recoder.java.ProgramElement
getComments, getID, setComments
 
Methods inherited from interface recoder.java.SourceElement
getEndPosition, getFactory, getFirstElement, getLastElement, getRelativePosition, getStartPosition, setEndPosition, setRelativePosition, setStartPosition, toSource
 
Methods inherited from interface recoder.ModelElement
validate
 
Methods inherited from interface recoder.java.NonTerminalProgramElement
getIndexOfChild, getRoleOfChild, makeAllParentRolesValid, validateAll
 

Constructor Detail

LocalVariableDeclaration

public LocalVariableDeclaration()
Local variable declaration.


LocalVariableDeclaration

public LocalVariableDeclaration(TypeReference typeRef,
                                Identifier name)
Local variable declaration.

Parameters:
typeRef - a type reference.
name - an identifier.

LocalVariableDeclaration

public LocalVariableDeclaration(ASTList<DeclarationSpecifier> mods,
                                TypeReference typeRef,
                                ASTList<VariableSpecification> vars)
Local variable declaration.

Parameters:
mods - a modifier mutable list.
typeRef - a type reference.
vars - a variable specification mutable list.

LocalVariableDeclaration

public LocalVariableDeclaration(ASTList<DeclarationSpecifier> mods,
                                TypeReference typeRef,
                                Identifier name,
                                Expression init)
Local variable declaration.

Parameters:
mods - a modifier mutable list.
typeRef - a type reference.
name - an identifier.
init - an expression.

LocalVariableDeclaration

protected LocalVariableDeclaration(LocalVariableDeclaration proto)
Local variable declaration.

Parameters:
proto - a local variable declaration.
Method Detail

deepClone

public LocalVariableDeclaration deepClone()
Deep clone.

Specified by:
deepClone in interface SourceElement
Specified by:
deepClone in interface Statement
Returns:
the object.

makeParentRoleValid

public void makeParentRoleValid()
Make parent role valid.

Specified by:
makeParentRoleValid in interface NonTerminalProgramElement
Overrides:
makeParentRoleValid in class VariableDeclaration

getVariableSpecifications

public ASTList<VariableSpecification> getVariableSpecifications()

setVariableSpecifications

public void setVariableSpecifications(ASTList<VariableSpecification> l)

getVariables

public java.util.List<VariableSpecification> getVariables()
Description copied from class: VariableDeclaration
Get variables. WARNING: as of 0.80 final, this is not a mutable list any more due to implementation of ParameterDeclaration - changes on this list don't have effects there!!

Specified by:
getVariables in class VariableDeclaration
Returns:
the variable specification mutable list.

getChildCount

public int getChildCount()
Returns the number of children of this node.

Specified by:
getChildCount in interface NonTerminalProgramElement
Returns:
an int giving the number of children of this node

getChildAt

public ProgramElement getChildAt(int index)
Returns the child at the specified index in this node's "virtual" child array

Specified by:
getChildAt in interface NonTerminalProgramElement
Parameters:
index - an index into this node's "virtual" child array
Returns:
the program element at the given position
Throws:
java.lang.ArrayIndexOutOfBoundsException - if index is out of bounds

getChildPositionCode

public int getChildPositionCode(ProgramElement child)
Description copied from interface: NonTerminalProgramElement
Returns the positional code of the given child, or -1 if there is no such child. The result contains an encoding of the relative position of the child as well as the role it has been playing in this parent element. This information is required internally for proper undo of transformations and is to be delivered to the detached method of the ChangeHistory.

Specified by:
getChildPositionCode in interface NonTerminalProgramElement
Parameters:
child - the exact child to look for.
Returns:
the positional code of the given child, or -1.
See Also:
ChangeHistory.detached(recoder.java.ProgramElement, recoder.java.NonTerminalProgramElement, int)

replaceChild

public boolean replaceChild(ProgramElement p,
                            ProgramElement q)
Replace a single child in the current node. The child to replace is matched by identity and hence must be known exactly. The replacement element can be null - in that case, the child is effectively removed. The parent role of the new child is validated, while the parent link of the replaced child is left untouched.

Specified by:
replaceChild in interface NonTerminalProgramElement
Parameters:
p - the old child.
p - the new child.
Returns:
true if a replacement has occured, false otherwise.
Throws:
java.lang.ClassCastException - if the new child cannot take over the role of the old one.

getASTParent

public NonTerminalProgramElement getASTParent()
Get AST parent.

Specified by:
getASTParent in interface ProgramElement
Returns:
the non terminal program element.

getStatementContainer

public StatementContainer getStatementContainer()
Get statement container.

Specified by:
getStatementContainer in interface Statement
Returns:
the statement container.

setStatementContainer

public void setStatementContainer(StatementContainer c)
Set statement container.

Specified by:
setStatementContainer in interface Statement
Parameters:
c - a statement container.

isPrivate

public boolean isPrivate()
Local variables are never private.

Overrides:
isPrivate in class JavaDeclaration

isProtected

public boolean isProtected()
Local variables are never protected..

Overrides:
isProtected in class JavaDeclaration

isPublic

public boolean isPublic()
Local variables are never "public".

Overrides:
isPublic in class JavaDeclaration

isStatic

public boolean isStatic()
Local variables are never static.

Overrides:
isStatic in class JavaDeclaration

isTransient

public boolean isTransient()
Local variables are never transient.

Overrides:
isTransient in class JavaDeclaration

accept

public void accept(SourceVisitor v)
Description copied from interface: SourceElement
Receive a visitor, for instance a pretty printer.

Specified by:
accept in interface SourceElement
Parameters:
v - a source visitor.

RECODER 0.92