org.norecess.citkit.tir.lvalues
Class SimpleLValueTIR

java.lang.Object
  extended by org.norecess.citkit.tir.lvalues.SimpleLValueTIR
All Implemented Interfaces:
HobbesTIR, ISimpleLValueTIR, LValueTIR

public class SimpleLValueTIR
extends java.lang.Object
implements ISimpleLValueTIR

The TIR for a simple variable reference.

Author:
Jeremy D. Frens

Constructor Summary
SimpleLValueTIR(IPosition position, ISymbol name)
          Constructs a simple variable reference.
SimpleLValueTIR(IPosition position, ISymbol name, HobbesType type)
          Constructs a simple variable reference.
SimpleLValueTIR(ISymbol name)
          Basic constructor.
SimpleLValueTIR(ISymbol name, HobbesType type)
          Basic constructor.
 
Method Summary
<T> T
accept(LValueTIRVisitor<T> visitor)
          Implements the visitor pattern with LValueTIRVisitor.
 boolean equals(java.lang.Object o)
           
 ISymbol getName()
          Returns the name of the variable.
 IPosition getPosition()
          Returns the location of the l-value in the code.
 HobbesType getType()
          Returns the type of the l-value.
 int hashCode()
           
 void setType(HobbesType type)
          Sets the type of the l-value.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleLValueTIR

public SimpleLValueTIR(IPosition position,
                       ISymbol name)
Constructs a simple variable reference.

Parameters:
position - the position of the variable reference in the source code.
name - the name of the variable.

SimpleLValueTIR

public SimpleLValueTIR(IPosition position,
                       ISymbol name,
                       HobbesType type)
Constructs a simple variable reference.

Parameters:
position - the position of the variable reference in the source code.
name - the name of the variable.
type - the type of the variable.

SimpleLValueTIR

public SimpleLValueTIR(ISymbol name)
Basic constructor.

Parameters:
name - the name of the variable.

SimpleLValueTIR

public SimpleLValueTIR(ISymbol name,
                       HobbesType type)
Basic constructor.

Parameters:
name - the name of the variable.
type - the type of the variable.
Method Detail

getName

public ISymbol getName()
Returns the name of the variable.

Specified by:
getName in interface ISimpleLValueTIR
Returns:
the name of the variable.

accept

public <T> T accept(LValueTIRVisitor<T> visitor)
Description copied from interface: LValueTIR
Implements the visitor pattern with LValueTIRVisitor.

Specified by:
accept in interface LValueTIR
Type Parameters:
T - the return type from the visit with the visitor.
Parameters:
visitor - the visitor itself.
Returns:
the result of visiting with the visitor.

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

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

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getType

public HobbesType getType()
Description copied from interface: LValueTIR
Returns the type of the l-value. Useful only in type-checked languages.

Specified by:
getType in interface LValueTIR
Returns:
the type of the l-value.

setType

public void setType(HobbesType type)
Description copied from interface: LValueTIR
Sets the type of the l-value. Needed only in type-checked languages.

Specified by:
setType in interface LValueTIR
Parameters:
type - the type of the l-value.

getPosition

public IPosition getPosition()
Description copied from interface: LValueTIR
Returns the location of the l-value in the code.

Specified by:
getPosition in interface HobbesTIR
Specified by:
getPosition in interface LValueTIR