Example #1
0
        public void addLiteral(Literal literal)
        {
            if (isImmutable())
            {
                throw new InvalidOperationException(
                          "Clause is immutable, cannot be updated.");
            }
            int origSize = literals.Count;

            literals.Add(literal);
            if (literals.Count > origSize)
            {
                if (literal.isPositiveLiteral())
                {
                    positiveLiterals.Add(literal);
                }
                else
                {
                    negativeLiterals.Add(literal);
                }
            }
            recalculateIdentity();
        }
Example #2
0
        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().Equals(atom.getArgs()));
        }