public void addLiteral(Literal literal) { if (isImmutable()) { throw new IllegalStateException("Clause is immutable, cannot be updated."); } int origSize = literals.Size(); literals.Add(literal); if (literals.Size() > origSize) { if (literal.isPositiveLiteral()) { positiveLiterals.Add(literal); } else { negativeLiterals.Add(literal); } } recalculateIdentity(); }
public override bool Equals(object o) { if (this == o) { return(true); } if (o.GetType() != GetType()) { // This prevents ReducedLiterals // being treated as equivalent to // normal Literals. return(false); } if (!(o is Literal)) { return(false); } Literal l = (Literal)o; return(l.isPositiveLiteral() == isPositiveLiteral() && l.getAtomicSentence().getSymbolicName() .Equals(atom.getSymbolicName()) && l.getAtomicSentence().getArgs().SequenceEqual(atom.getArgs())); }