satisfiabilityApplet.cnfParser
Class Disjunction

java.lang.Object
  extended bysatisfiabilityApplet.cnfParser.Disjunction
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable

public class Disjunction
extends java.lang.Object
implements java.lang.Cloneable, java.lang.Comparable

by Catherine Block id# 6319 Date: Sep 6, 2004 Time: 11:02:35 AM CS 180H satisfiabilityApplet.cnfParser.Disjunction represents the 'or' of two literals. The destructor method must be used to properly destroy this object.


Constructor Summary
Disjunction(java.util.List tokens)
          Constructor creates a new satisfiabilityApplet.cnfParser.Disjunction.
 
Method Summary
 java.lang.Object clone()
           
 int compareTo(java.lang.Object obj)
          Compares based on number of distinct variables (size of clause) Note: this class has a natural ordering that is inconsistent with equals
 void convert()
          Mutator method that will effectively convert a DNF entry into its negated CNF form by switching the "not" status of all the variables
 void destructor()
          Destructor method must be called to properly destroy all the contents of this object
 boolean isAlwaysTrue()
           
static boolean isNext(java.util.List tokens)
          Determines if a satisfiabilityApplet.cnfParser.Disjunction is next in a clauseList of tokens
 boolean isTrue()
          Checks this disjunction to see if any of the literals has a set value of true.
 int numberOfVariables()
          Returns the number of distinct variables in this disjunction
 void setLiteralsToTrue()
          Sets the value of all unset literals to true
 java.lang.String toPolynomial()
          A polynomial representation of this satisfiabilityApplet.cnfParser.ConjunctionOfDisjunctions
 java.lang.String toString()
           
 java.util.List value()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Disjunction

public Disjunction(java.util.List tokens)
            throws ParseError
Constructor creates a new satisfiabilityApplet.cnfParser.Disjunction.

Parameters:
tokens - - A clauseList of tokens with the front representing a satisfiabilityApplet.cnfParser.Disjunction
Throws:
ParseError - - The tokens did not parse into a satisfiabilityApplet.cnfParser.Disjunction
Method Detail

isNext

public static boolean isNext(java.util.List tokens)
Determines if a satisfiabilityApplet.cnfParser.Disjunction is next in a clauseList of tokens

Parameters:
tokens -
Returns:
if a satisfiabilityApplet.cnfParser.Disjunction is next

numberOfVariables

public int numberOfVariables()
Returns the number of distinct variables in this disjunction

Returns:
number of distinct variables in this disjunction

setLiteralsToTrue

public void setLiteralsToTrue()
Sets the value of all unset literals to true


value

public java.util.List value()
Returns:
- A reference to the literals contained in this disjunction

isTrue

public boolean isTrue()
Checks this disjunction to see if any of the literals has a set value of true. It it does, the disjunction is true.

Returns:
True if any of the literals is set to true, false otherwise

isAlwaysTrue

public boolean isAlwaysTrue()

convert

public void convert()
Mutator method that will effectively convert a DNF entry into its negated CNF form by switching the "not" status of all the variables


clone

public java.lang.Object clone()

toPolynomial

public java.lang.String toPolynomial()
A polynomial representation of this satisfiabilityApplet.cnfParser.ConjunctionOfDisjunctions

Returns:
- A polynomial representation of this satisfiabilityApplet.cnfParser.ConjunctionOfDisjunctions

compareTo

public int compareTo(java.lang.Object obj)
              throws java.lang.ClassCastException
Compares based on number of distinct variables (size of clause) Note: this class has a natural ordering that is inconsistent with equals

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
obj - The clause to compare
Returns:
Throws:
java.lang.ClassCastException

destructor

public void destructor()
Destructor method must be called to properly destroy all the contents of this object


toString

public java.lang.String toString()
Returns:
A string representation of this object