Inheritance: ComplexSentence
Example #1
0
 private Sentence transformImpliedSentence(BinarySentence bs)
 {
     Sentence first = new UnarySentence((Sentence)bs.getFirst().accept(
             this, null));
     return new BinarySentence("OR", first, (Sentence)bs.getSecond()
             .accept(this, null));
 }
 public override Object visitNotSentence(UnarySentence ns, Object arg)
 {
     List<Symbol> s = (List<Symbol>)arg;
     if (ns.getNegated() is Symbol)
     {
         s.Add((Symbol)ns.getNegated());
     }
     else
     {
         s = SetOps
                 .union(s, (List<Symbol>)ns.getNegated().accept(this, arg));
     }
     return s;
 }
 public override Object visitNotSentence(UnarySentence ns, Object arg)
 {
     List<Symbol> s = (List<Symbol>)arg;
     if (ns.getNegated() is Symbol)
     {
         // do nothing .do NOT add a negated Symbol
     }
     else
     {
         s = SetOps
                 .union(s, (List<Symbol>)ns.getNegated().accept(this, arg));
     }
     return s;
 }
Example #4
0
        public override bool Equals(Object o)
        {
            if (this == o)
            {
                return(true);
            }
            if ((o == null) || !(o is UnarySentence))
            {
                return(false);
            }
            UnarySentence ns = (UnarySentence)o;

            return(ns.negated.Equals(negated));
        }
Example #5
0
 private Sentence transformNotSentence(UnarySentence us)
 {
     if (us.getNegated() is UnarySentence)
     {
         return (Sentence)((UnarySentence)us.getNegated()).getNegated()
                 .accept(this, null);
     }
     else if (us.getNegated() is BinarySentence)
     {
         BinarySentence bs = (BinarySentence)us.getNegated();
         if (bs.isAndSentence())
         {
             Sentence first = new UnarySentence((Sentence)bs.getFirst()
                     .accept(this, null));
             Sentence second = new UnarySentence((Sentence)bs.getSecond()
                     .accept(this, null));
             return new BinarySentence("OR", first, second);
         }
         else if (bs.isOrSentence())
         {
             Sentence first = new UnarySentence((Sentence)bs.getFirst()
                     .accept(this, null));
             Sentence second = new UnarySentence((Sentence)bs.getSecond()
                     .accept(this, null));
             return new BinarySentence("AND", first, second);
         }
         else
         {
             return (Sentence)base.visitNotSentence(us, null);
         }
     }
     else
     {
         return (Sentence)base.visitNotSentence(us, null);
     }
 }
Example #6
0
 public virtual Object visitNotSentence(UnarySentence ns, Object arg)
 {
     List<Sentence> s = (List<Sentence>)arg;
     return SetOps.union(s, (List<Sentence>)ns.getNegated().accept(this, arg));
 }
Example #7
0
 public Object visitNotSentence(UnarySentence fs, Object arg)
 {
     return fs.getNegated().accept(this, null);
 }
Example #8
0
 public virtual Object visitNotSentence(UnarySentence fs, Object arg)
 {
     return new UnarySentence((Sentence)fs.getNegated().accept(this, arg));
 }
Example #9
0
 public override Object visitNotSentence(UnarySentence us, Object arg)
 {
     return transformNotSentence(us);
 }
Example #10
0
	public Object visitNotSentence(UnarySentence fs, Object arg) {
		Object negatedValue = fs.getNegated().accept(this, null);
		if (negatedValue != null) {
			return !((bool) negatedValue);
		} else {
			return null;
		}
	}