scale.clef
Class LiteralMap

java.lang.Object
  extended by scale.clef.LiteralMap

public final class LiteralMap
extends java.lang.Object

This class maps from a value to a Clef Literal.

$Id: LiteralMap.java,v 1.24 2007-10-04 19:58:03 burrill Exp $

Copyright 2007 by the Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.

This class allows us to have only one instance of a (type, value) tuple.


Constructor Summary
LiteralMap()
           
 
Method Summary
static void clear()
          Clear out all literals and start over.
static BooleanLiteral put(boolean value, Type type)
          Place an entry in the map unless it is already there.
static CharLiteral put(char value, Type type)
          Place an entry in the map unless it is already there.
static FloatLiteral put(double value, Type type)
          Place an entry in the map unless it is already there.
static IntLiteral put(long value, Type type)
          Place an entry in the map unless it is already there.
static StringLiteral put(java.lang.String value, Type type)
          Place an entry in the map unless it is already there.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LiteralMap

public LiteralMap()
Method Detail

clear

public static void clear()
Clear out all literals and start over.


put

public static IntLiteral put(long value,
                             Type type)
Place an entry in the map unless it is already there. There can be only one tuple with this value and type.

Parameters:
value - map from this value to the literal
type - must match for the entry to be there
Returns:
the Literal

put

public static CharLiteral put(char value,
                              Type type)
Place an entry in the map unless it is already there. There can be only one tuple with this value and type.

Parameters:
value - map from this value to the literal
type - must match for the entry to be there
Returns:
the Literal

put

public static FloatLiteral put(double value,
                               Type type)
Place an entry in the map unless it is already there. There can be only one tuple with this value and type.

Parameters:
value - map from this value to the literal
type - must match for the entry to be there
Returns:
the Literal

put

public static BooleanLiteral put(boolean value,
                                 Type type)
Place an entry in the map unless it is already there. There can be only one tuple with this value and type.

Parameters:
value - map from this value to the literal
type - must match for the entry to be there
Returns:
the Literal

put

public static StringLiteral put(java.lang.String value,
                                Type type)
Place an entry in the map unless it is already there. There can be only one tuple with this value and type.

Parameters:
value - map from this value to the literal
type - must match for the entry to be there
Returns:
the Literal