tip.cfg
Class Cubic<Token,Variable>

java.lang.Object
  extended by tip.cfg.Cubic<Token,Variable>
Type Parameters:
Token - the type of the tokens
Variable - the type of the variables

public class Cubic<Token,Variable>
extends Object

Cubic is an implementation of the cubic algorithm. The algorithm is performed as constraints are added.

Author:
Johnni Winther, jw@brics.dk

Constructor Summary
Cubic(Set<Token> tokens, Set<Variable> variables)
          Creates the Cubic object holding information for the algorithm.
 
Method Summary
 void addConstraint1(Token t, Variable x)
          Add a constraint of type {t} ⊆ x
 void addConstraint2(Variable x, Variable y)
          Add a constraint of type xy
 void addConstraint3(Token t, Variable x, Variable y, Variable z)
          Add a conditional constraint of type txyz
 Collection<Token> getTokens()
          Returns the collection of tokens used in the algorithm.
 Set<Token> getTokenSet(Variable v)
          Returns the set of tokens in the variable v as computed by the algorithm from the added constraints
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cubic

public Cubic(Set<Token> tokens,
             Set<Variable> variables)
Creates the Cubic object holding information for the algorithm.

Parameters:
tokens - the set of tokens for the algorithm
variables - the set of variables for the algorithm
Method Detail

getTokens

public Collection<Token> getTokens()
Returns the collection of tokens used in the algorithm.

Returns:
the collection of tokens used in the algorithm

addConstraint1

public void addConstraint1(Token t,
                           Variable x)
Add a constraint of type {t} ⊆ x

Parameters:
t - the token t representing the singleton set {i}.
x - the variable x which must contain the token t

addConstraint2

public void addConstraint2(Variable x,
                           Variable y)
Add a constraint of type xy

Parameters:
x - the variable x in question
y - the variable y which must contain x

addConstraint3

public void addConstraint3(Token t,
                           Variable x,
                           Variable y,
                           Variable z)
Add a conditional constraint of type txyz

Parameters:
t - the variable t in question
x - the variable x which may contain t
y - the variable y in question
z - the variable z which must contain y if x contains t

getTokenSet

public Set<Token> getTokenSet(Variable v)
Returns the set of tokens in the variable v as computed by the algorithm from the added constraints

Parameters:
v - the variable in question
Returns:
the set of tokens in the variable v