コード例 #1
0
ファイル: Clause.cs プロジェクト: bclgenki/tvn-cosine
        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();
        }
コード例 #2
0
ファイル: Literal.cs プロジェクト: bclgenki/tvn-cosine
        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()));
        }