tuffy.mln
Class Literal.VarClique

java.lang.Object
  extended by tuffy.mln.Literal.VarClique
Enclosing class:
Literal

private class Literal.VarClique
extends java.lang.Object

Clique of variables. Here by clique, it means a set of variables, plus a constant.

See Also:
Literal.mostGeneralUnification(Tuple)

Field Summary
(package private)  java.lang.Integer constant
          The constant of this clique.
(package private)  java.util.HashSet<java.lang.String> vars
          The set of variable names in this clique.
 
Constructor Summary
private Literal.VarClique()
           
 
Method Summary
 void addVar(java.lang.String v)
          Add variable to this clique.
 boolean setConstant(int con)
          Set the constant of this clique.
 boolean swallow(Literal.VarClique c)
          Merge a new clique with the current one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

vars

java.util.HashSet<java.lang.String> vars
The set of variable names in this clique.


constant

java.lang.Integer constant
The constant of this clique.

Constructor Detail

Literal.VarClique

private Literal.VarClique()
Method Detail

addVar

public void addVar(java.lang.String v)
Add variable to this clique.

Parameters:
v - the name of added variable.

setConstant

public boolean setConstant(int con)
Set the constant of this clique. This is allowed when 1) current constant is null; 2) current constant is equals to the changed constant.

Parameters:
con - the added constant.
Returns:
whether the intending setting is allowed and succeeded.

swallow

public boolean swallow(Literal.VarClique c)
Merge a new clique with the current one. Here by merge, it requires the constant of these two cliques should be either null or the same. This process involves 1) merging the variable set and 2) check the consistency of constant.

Parameters:
c - the new clique
Returns:
whether the intending swallow is allowed and succeeded.