com.go.tea.parsetree
Class Variable

java.lang.Object
  |
  +--com.go.tea.parsetree.Node
        |
        +--com.go.tea.parsetree.Variable
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class Variable
extends Node

A Variable represents a variable declaration. A VariableRef is used to reference Variables.

Version:
35 , 01/05/07
Author:
Brian S O'Neill
See Also:
VariableRef, Serialized Form

Constructor Summary
Variable(SourceInfo info, java.lang.String name, Type type)
          Used when creating variables whose type has already been checked.
Variable(SourceInfo info, java.lang.String name, TypeName typeName)
          Used for variable declarations.
 
Method Summary
 java.lang.Object accept(NodeVisitor visitor)
          Every subclass of Node must override this method with the following: return visitor.visit(this).
 boolean equals(java.lang.Object other)
          Variables are tested for equality only by their name and type.
 java.lang.String getName()
           
 Type getType()
          Returns null if type is unknown.
 TypeName getTypeName()
           
 int hashCode()
           
 boolean isField()
           
 boolean isStatic()
           
 boolean isTransient()
           
 void setField(boolean b)
           
 void setName(java.lang.String name)
           
 void setStatic(boolean b)
           
 void setTransient(boolean b)
           
 void setType(Type type)
           
 
Methods inherited from class com.go.tea.parsetree.Node
clone, getSourceInfo, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Variable

public Variable(SourceInfo info,
                java.lang.String name,
                TypeName typeName)
Used for variable declarations.

Variable

public Variable(SourceInfo info,
                java.lang.String name,
                Type type)
Used when creating variables whose type has already been checked.
Method Detail

accept

public java.lang.Object accept(NodeVisitor visitor)
Description copied from class: Node
Every subclass of Node must override this method with the following: return visitor.visit(this).
Overrides:
accept in class Node
Following copied from class: com.go.tea.parsetree.Node
Parameters:
visitor - A visitor of this Node
Returns:
Node The Node returned by the visitor
See Also:
NodeVisitor

getTypeName

public TypeName getTypeName()

getName

public java.lang.String getName()

setName

public void setName(java.lang.String name)

getType

public Type getType()
Returns null if type is unknown.

setType

public void setType(Type type)

isField

public boolean isField()
Returns:
true if this variable is a field instead of a local variable.

isStatic

public boolean isStatic()
Returns:
true if this variable is a field and is static.

isTransient

public boolean isTransient()
Returns:
true if this variable is transient.

setField

public void setField(boolean b)

setStatic

public void setStatic(boolean b)

setTransient

public void setTransient(boolean b)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object other)
Variables are tested for equality only by their name and type. Field status is ignored.
Overrides:
equals in class java.lang.Object