SFE.Compiler
Class Consts

java.lang.Object
  extended by SFE.Compiler.Consts

public class Consts
extends java.lang.Object

The Consts class stores the constants defeined in the program.


Constructor Summary
Consts()
           
 
Method Summary
static void defineName(java.lang.String newConstName, boolean constant)
          Associates the specified new boolean constant name with the specified boolean constant.
static void defineName(java.lang.String newConstName, int constant)
          Associates the specified new constant name with the specified integer constant.
static ConstExpression fromName(java.lang.String name)
          Returns a ConstExpression representing the const of the specified type name, or null if there was no such type defined for this type name.
static int size(java.lang.String name)
          Returns the size of the specified constant in bits.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Consts

public Consts()
Method Detail

fromName

public static ConstExpression fromName(java.lang.String name)
Returns a ConstExpression representing the const of the specified type name, or null if there was no such type defined for this type name.

Parameters:
name - the name of the constant whose associated ConstExpression is to be returned.
Returns:
ConstExpression representing the const, or null if there was no such constant defined.

defineName

public static void defineName(java.lang.String newConstName,
                              int constant)
                       throws java.lang.IllegalArgumentException
Associates the specified new constant name with the specified integer constant.

Parameters:
newConstName - the new constant name with which the specified constant is to be associated.
constant - the constant to be associated with the specified newConstName.
Throws:
java.lang.IllegalArgumentException - if the newConstName is already defined.

defineName

public static void defineName(java.lang.String newConstName,
                              boolean constant)
                       throws java.lang.IllegalArgumentException
Associates the specified new boolean constant name with the specified boolean constant.

Parameters:
newConstName - the new boolean constant name with which the specified constant is to be associated.
constant - the boolean constant to be associated with the specified newConstName.
Throws:
java.lang.IllegalArgumentException - if the newConstName is already defined.

size

public static int size(java.lang.String name)
Returns the size of the specified constant in bits.

Parameters:
name - the constant name.
Returns:
an integer representing size of the const, represented by the given name, in bits or -1 if name is not a defined constant.