LBJ2.infer
Class PropositionalConstant

java.lang.Object
  extended by LBJ2.infer.Constraint
      extended by LBJ2.infer.PropositionalConstraint
          extended by LBJ2.infer.PropositionalConstant
All Implemented Interfaces:
java.lang.Cloneable

public class PropositionalConstant
extends PropositionalConstraint

A propositional constant is either true or false.


Field Summary
protected  boolean constant
          The constant value.
static PropositionalConstant False
          false
static PropositionalConstant True
          true
 
Constructor Summary
PropositionalConstant(boolean v)
          Initializing constructor.
 
Method Summary
 PropositionalConstraint CNF()
          Produces a new, logically simplified version of this constraint in conjunctive normal form (CNF).
 void consolidateVariables(java.util.AbstractMap m)
          Replaces all unquantified variables with the unique copy stored as a value of the given map; also instantiates all quantified variables and stores them in the given map.
 PropositionalConstraint DNF()
          Produces a new, logically simplified version of this constraint in disjunctive normal form (DNF).
 boolean equals(java.lang.Object o)
          Two PropositionalConstants are equivalent when their constants are equal.
 boolean evaluate()
          Determines whether the constraint is satisfied.
 Constraint[] getChildren()
          Returns the children of this constraint in an array.
 int hashCode()
          The hash code of a PropositionalConstant is the hash code of the Boolean object formed from the constant.
 boolean moreGeneralThan(PropositionalConstraint c)
          Compares topology to determine if this constraint is more general than the given constraint; note: this method is not required to be correct when it answers false.
 boolean moreSpecificThan(PropositionalAtLeast c)
          Compares topology to determine if this constraint is more specific than the given at-least; note: this method is not required to be correct when it answers false.
 boolean moreSpecificThan(PropositionalConjunction c)
          Compares topology to determine if this constraint is more specific than the given conjunction; note: this method is not required to be correct when it answers false.
 boolean moreSpecificThan(PropositionalConstant c)
          Compares topology to determine if this constraint is more specific than the given constant; note: this method is not required to be correct when it answers false.
 boolean moreSpecificThan(PropositionalDisjunction c)
          Compares topology to determine if this constraint is more specific than the given disjunction; note: this method is not required to be correct when it answers false.
 boolean moreSpecificThan(PropositionalDoubleImplication c)
          Compares topology to determine if this constraint is more specific than the given double implication; note: this method is not required to be correct when it answers false.
 boolean moreSpecificThan(PropositionalImplication c)
          Compares topology to determine if this constraint is more specific than the given implication; note: this method is not required to be correct when it answers false.
 boolean moreSpecificThan(PropositionalNegation c)
          Compares topology to determine if this constraint is more specific than the given negation; note: this method is not required to be correct when it answers false.
 boolean moreSpecificThan(PropositionalVariable c)
          Compares topology to determine if this constraint is more specific than the given variable; note: this method is not required to be correct when it answers false.
 PropositionalConstraint negate()
          Produces a new propositional constraint equivalent to this constraint and that contains no negated constraints other than variables.
 void runVisit(Inference infer)
          Calls the appropriate visit(·) method of the given Inference for this Constraint, as per the visitor pattern.
 PropositionalConstraint simplify()
          Produces a new, logically simplified version of this constraint, preserving variable consolidation.
 void write(java.lang.StringBuffer buffer)
          Creates a string respresentation of this constraint using the string representations of the objects involved.
 
Methods inherited from class LBJ2.infer.PropositionalConstraint
clone, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

True

public static final PropositionalConstant True
true


False

public static final PropositionalConstant False
false


constant

protected boolean constant
The constant value.

Constructor Detail

PropositionalConstant

public PropositionalConstant(boolean v)
Initializing constructor.

Parameters:
v - The value of this constant.
Method Detail

consolidateVariables

public void consolidateVariables(java.util.AbstractMap m)
Replaces all unquantified variables with the unique copy stored as a value of the given map; also instantiates all quantified variables and stores them in the given map.

Specified by:
consolidateVariables in class Constraint
Parameters:
m - The map in which to find unique copies of the variables.

evaluate

public boolean evaluate()
Determines whether the constraint is satisfied.

Specified by:
evaluate in class Constraint

simplify

public PropositionalConstraint simplify()
Produces a new, logically simplified version of this constraint, preserving variable consolidation.

Specified by:
simplify in class PropositionalConstraint
Returns:
A logically simplified version of this constraint.
See Also:
Constraint.consolidateVariables(java.util.AbstractMap)

negate

public PropositionalConstraint negate()
Produces a new propositional constraint equivalent to this constraint and that contains no negated constraints other than variables.

Specified by:
negate in class PropositionalConstraint
Returns:
A constraint representing the negation of this constraint.

CNF

public PropositionalConstraint CNF()
Produces a new, logically simplified version of this constraint in conjunctive normal form (CNF).

Specified by:
CNF in class PropositionalConstraint
Returns:
The conjunctive normal form of this constraint.

DNF

public PropositionalConstraint DNF()
Produces a new, logically simplified version of this constraint in disjunctive normal form (DNF).

Specified by:
DNF in class PropositionalConstraint
Returns:
The disjunctive normal form of this constraint.

getChildren

public Constraint[] getChildren()
Returns the children of this constraint in an array.

Specified by:
getChildren in class Constraint
Returns:
The children of this constraint in an array.

moreGeneralThan

public boolean moreGeneralThan(PropositionalConstraint c)
Compares topology to determine if this constraint is more general than the given constraint; note: this method is not required to be correct when it answers false.

Specified by:
moreGeneralThan in class PropositionalConstraint
Parameters:
c - The given constraint.
Returns:
true if a topological analysis determined that this constraint is more general than the given constraint.

moreSpecificThan

public boolean moreSpecificThan(PropositionalImplication c)
Compares topology to determine if this constraint is more specific than the given implication; note: this method is not required to be correct when it answers false.

Specified by:
moreSpecificThan in class PropositionalConstraint
Parameters:
c - The given implication.
Returns:
true if a topological analysis determined that this constraint is more specific than the given implication.

moreSpecificThan

public boolean moreSpecificThan(PropositionalDoubleImplication c)
Compares topology to determine if this constraint is more specific than the given double implication; note: this method is not required to be correct when it answers false.

Specified by:
moreSpecificThan in class PropositionalConstraint
Parameters:
c - The given double implication.
Returns:
true if a topological analysis determined that this constraint is more specific than the given double implication.

moreSpecificThan

public boolean moreSpecificThan(PropositionalConjunction c)
Compares topology to determine if this constraint is more specific than the given conjunction; note: this method is not required to be correct when it answers false.

Specified by:
moreSpecificThan in class PropositionalConstraint
Parameters:
c - The given conjunction.
Returns:
true if a topological analysis determined that this constraint is more specific than the given conjunction.

moreSpecificThan

public boolean moreSpecificThan(PropositionalDisjunction c)
Compares topology to determine if this constraint is more specific than the given disjunction; note: this method is not required to be correct when it answers false.

Specified by:
moreSpecificThan in class PropositionalConstraint
Parameters:
c - The given disjunction.
Returns:
true if a topological analysis determined that this constraint is more specific than the given disjunction.

moreSpecificThan

public boolean moreSpecificThan(PropositionalAtLeast c)
Compares topology to determine if this constraint is more specific than the given at-least; note: this method is not required to be correct when it answers false.

Specified by:
moreSpecificThan in class PropositionalConstraint
Parameters:
c - The given at-least.
Returns:
true if a topological analysis determined that this constraint is more specific than the given disjunction.

moreSpecificThan

public boolean moreSpecificThan(PropositionalNegation c)
Compares topology to determine if this constraint is more specific than the given negation; note: this method is not required to be correct when it answers false.

Specified by:
moreSpecificThan in class PropositionalConstraint
Parameters:
c - The given negation.
Returns:
true if a topological analysis determined that this constraint is more specific than the given negation.

moreSpecificThan

public boolean moreSpecificThan(PropositionalVariable c)
Compares topology to determine if this constraint is more specific than the given variable; note: this method is not required to be correct when it answers false.

Specified by:
moreSpecificThan in class PropositionalConstraint
Parameters:
c - The given variable.
Returns:
true if a topological analysis determined that this constraint is more specific than the given variable.

moreSpecificThan

public boolean moreSpecificThan(PropositionalConstant c)
Compares topology to determine if this constraint is more specific than the given constant; note: this method is not required to be correct when it answers false.

Specified by:
moreSpecificThan in class PropositionalConstraint
Parameters:
c - The given constant.
Returns:
true if a topological analysis determined that this constraint is more specific than the given constant.

hashCode

public int hashCode()
The hash code of a PropositionalConstant is the hash code of the Boolean object formed from the constant.

Overrides:
hashCode in class java.lang.Object
Returns:
The hash code for this PropositionalConstant.

equals

public boolean equals(java.lang.Object o)
Two PropositionalConstants are equivalent when their constants are equal.

Overrides:
equals in class java.lang.Object
Returns:
true iff the argument is a PropositionalConstant set to the same value as this constant.

runVisit

public void runVisit(Inference infer)
Calls the appropriate visit(·) method of the given Inference for this Constraint, as per the visitor pattern.

Specified by:
runVisit in class Constraint
Parameters:
infer - The inference visiting this constraint.

write

public void write(java.lang.StringBuffer buffer)
Creates a string respresentation of this constraint using the string representations of the objects involved.

Specified by:
write in class PropositionalConstraint
Parameters:
buffer - The output of this method will be appended to this buffer.