//Christian Tirella //Brian Sweeney //CSU670 Project //This class of literal should be used in the F field of the formula object //More specifically it will be used to populate the clauses of the F field public class FLiteral extends ALiteral { int value; //should be 1, 0, or -1 //indicates the current value of this literal as per the current assignmnet M //1 = true //0 = false //-1 = unknown public FLiteral (int name, boolean negated) { this.name = name; this.negated = negated; this.value = -1; } //change from FLiteral to MLiteral public MLiteral toMLiteral(){ MLiteral m = new MLiteral(this.name, this.negated); return m; } //return current value public int getValue() { return this.value; } //update the value based on some decision public void updateValue(int val) { if (this.negated == false) { this.value = val; } //1 = true //0 = false if (this.negated == true) { if (val == 1) { this.value = 0; } if (val == 0) { this.value = 1; } } } //set value back to -1 (unset) in the event of a restart or whatever public void resetValue () { this.value = -1; } //does this literal's value match the truth table value? public boolean matchRT(Integer rTValue) { if (value == -1) { return true; } if (value == rTValue) { return true; } else return false; } //tostring public String toString(){ if (negated) {return "!"+name;} else {return ""+name;} } }