org.norecess.citkit.tir.expressions
Class IntegerETIR

java.lang.Object
  extended by org.norecess.citkit.tir.expressions.IntegerETIR
All Implemented Interfaces:
DatumTIR, IIntegerETIR, ExpressionTIR, HobbesTIR

public class IntegerETIR
extends java.lang.Object
implements IIntegerETIR

The TIR for a literal integer expression.

Author:
Jeremy D. Frens

Constructor Summary
IntegerETIR(int value)
          Basic constructor.
IntegerETIR(IPosition position, int value)
          Constructs a literal integer expression.
IntegerETIR(Position position, java.lang.String value)
          Parses the string as an integer.
IntegerETIR(java.lang.String value)
          Parses the string as an integer.
 
Method Summary
<T> T
accept(ExpressionTIRVisitor<T> visitor)
          Implements the visitor pattern with ExpressionTIRVisitor.
 boolean equals(java.lang.Object o)
           
 IPosition getPosition()
          Retrieves the position of the code that generated the TIR.
 IntegerType getType()
          Retrieves the type of the expression.
 int getValue()
          Returns the literal value of the integer expression.
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntegerETIR

public IntegerETIR(IPosition position,
                   int value)
Constructs a literal integer expression.

Parameters:
position - the position of the integer expression in the source code.
value - the literal value of the integer.

IntegerETIR

public IntegerETIR(int value)
Basic constructor.

Parameters:
value - the value of the integer.

IntegerETIR

public IntegerETIR(java.lang.String value)
Parses the string as an integer. The value can be in octal or hexadecimal format.

Parameters:
value - the value to be parsed as an integer.

IntegerETIR

public IntegerETIR(Position position,
                   java.lang.String value)
Parses the string as an integer. The value can be in octal or hexadecimal format.

Parameters:
position - the location of this TIR in the source file.
value - the value to be parsed as an integer.
Method Detail

getValue

public int getValue()
Returns the literal value of the integer expression.

Specified by:
getValue in interface IIntegerETIR
Returns:
the literal value of the integer expression.

getType

public IntegerType getType()
Description copied from interface: ExpressionTIR
Retrieves the type of the expression.

Specified by:
getType in interface DatumTIR
Specified by:
getType in interface ExpressionTIR
Returns:
the type of the code.

accept

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

Specified by:
accept in interface ExpressionTIR
Parameters:
visitor - the visitor object.
Returns:
the result of visiting the AST 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

getPosition

public IPosition getPosition()
Retrieves the position of the code that generated the TIR.

Specified by:
getPosition in interface HobbesTIR
Returns:
the position of the code in the source code.