LBJ2.infer
Class InferenceManager

java.lang.Object
  extended by LBJ2.infer.InferenceManager

public class InferenceManager
extends java.lang.Object

The inference manager is a cache of Inference objects accessed via their names and head objects. However, only one Inference object is stored per Inference class. For example, if the LBJ source file contains the following two inferences:

inference Foo head MyClass { ... }
inference Bar head MyClass { ... }
then this InferenceManager will store a maximum of one Foo object and one Bar object.


Field Summary
private static java.util.LinkedHashMap cache
          The cache of Inference objects, indexed by Keys.
 
Constructor Summary
InferenceManager()
           
 
Method Summary
static Inference get(java.lang.String n, java.lang.Object h)
          Retrieves the Inference object whose fully qualified name and head object are specified.
static void put(Inference i)
          Adds the given Inference object to the cache, indexed its fully qualified name.
static void remove(java.lang.String n)
          Removes the inference object with the given name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cache

private static final java.util.LinkedHashMap cache
The cache of Inference objects, indexed by Keys.

Constructor Detail

InferenceManager

public InferenceManager()
Method Detail

put

public static void put(Inference i)
Adds the given Inference object to the cache, indexed its fully qualified name.

Parameters:
i - The inference object.

get

public static Inference get(java.lang.String n,
                            java.lang.Object h)
Retrieves the Inference object whose fully qualified name and head object are specified.

Parameters:
n - The fully qualified name of the inference.
h - The head object of the inference.
Returns:
The Inference object corresponding to the given parameters, or null if no Inference is associated with them.

remove

public static void remove(java.lang.String n)
Removes the inference object with the given name.

Parameters:
n - The name of the unwanted inference.