tuffy.ground
Class KBMC.AtomCutSet

java.lang.Object
  extended by tuffy.ground.KBMC.AtomCutSet
Enclosing class:
KBMC

private static class KBMC.AtomCutSet
extends java.lang.Object

AtomCutSet is set of atoms with the same predicate. These atoms are organized in strata, with each stratum responds to a different degree-of-freedom. Atoms in a AtomCutSet satisfy that $\forall$ atom $a$ in this set, there does not exist atom $b$ in this set that $a$ subsumes $b$. For the definition of ``subsume'', see Tuple.subsumes(Tuple).


Nested Class Summary
(package private)  class KBMC.AtomCutSet.Stratum
          A stratum is a set of tuples with the same degree-of-freedom.
 
Field Summary
(package private)  int arity
          Arity of pred.
(package private)  boolean complete
          Whether this AtomCutSet is complete.
(package private)  java.util.HashSet<Tuple> heap
          Set of all tuples in each stratum.
(package private)  Predicate pred
          Predicate of this AtomCutSet.
(package private)  java.util.ArrayList<KBMC.AtomCutSet.Stratum> strata
          List of stratum in this AtomCutSet.
 
Constructor Summary
KBMC.AtomCutSet(Predicate p)
          Constructor of AtomCutSet.
 
Method Summary
 void addTuple(Tuple t)
          Add a tuple to corresponding stratum.
 boolean collectAll()
          Copy all tuples in each stratum to heap.
 boolean contains(Tuple t)
          Return true if the input tuple is in the corresponding stratum.
 void removeTuple(Tuple t)
          Remove the input tuple from corresponding stratum.
 boolean subsumes(Tuple t)
          Returns true if there exists a tuple in this AtomCutSet that subsumes the input tuple.
 Tuple top()
          Returns the first tuple in the first stratum.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pred

Predicate pred
Predicate of this AtomCutSet.


arity

int arity
Arity of pred.


complete

boolean complete
Whether this AtomCutSet is complete. Here by ``complete'' it means arbitrary tuple is subsumed by some tuples in this AtomCutSet. For the definition of ``subsume'', see Tuple.subsumes(Tuple).


strata

java.util.ArrayList<KBMC.AtomCutSet.Stratum> strata
List of stratum in this AtomCutSet.


heap

java.util.HashSet<Tuple> heap
Set of all tuples in each stratum.

Constructor Detail

KBMC.AtomCutSet

public KBMC.AtomCutSet(Predicate p)
Constructor of AtomCutSet. Given a predicate, initialize a stratum for each number between 0 and this predicate's arity. Each stratum for number $n$ means tuples in this stratum have degree-of-freedom $n$.

Parameters:
p -
Method Detail

collectAll

public boolean collectAll()
Copy all tuples in each stratum to heap.

Returns:
true if some of this stratum is not empty.

top

public Tuple top()
Returns the first tuple in the first stratum.


removeTuple

public void removeTuple(Tuple t)
Remove the input tuple from corresponding stratum. Here the corresponding stratum is found by the degree-of-freedom of the input tuple.

Parameters:
t - input tuple.

contains

public boolean contains(Tuple t)
Return true if the input tuple is in the corresponding stratum. Here the corresponding stratum is found by the degree-of-freedom of input tuple.

Parameters:
t - input tuple.

subsumes

public boolean subsumes(Tuple t)
Returns true if there exists a tuple in this AtomCutSet that subsumes the input tuple. For the definition of ``subsume'', see Tuple.subsumes(Tuple).

Parameters:
t - input tuple.

addTuple

public void addTuple(Tuple t)
Add a tuple to corresponding stratum. Remove all the existing tuples that can be subsumed by the new input tuple. The goal is $\forall$ tuples $a$ and $b$ in a certain stratum, $a$ does not subsume $b$. This function pluses a condition in KBMC.run() ensure this.

Parameters:
t - input tuple