getSecond() public method

public getSecond ( ) : Sentence
return Sentence
示例#1
0
 private Sentence transformBiConditionalSentence(BinarySentence bs)
 {
     Sentence first = new BinarySentence("=>", (Sentence)bs.getFirst()
             .accept(this, null), (Sentence)bs.getSecond().accept(this,
             null));
     Sentence second = new BinarySentence("=>", (Sentence)bs.getSecond()
             .accept(this, null), (Sentence)bs.getFirst()
             .accept(this, null));
     return new BinarySentence("AND", first, second);
 }
示例#2
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));
 }
示例#3
0
        public override Object visitBinarySentence(BinarySentence bs, Object args)
        {

            List<Sentence> soFar = (List<Sentence>)args;

            Sentence first = bs.getFirst();
            Sentence second = bs.getSecond();
            processSubTerm(second, processSubTerm(first, soFar));

            return soFar;

        }
示例#4
0
 public Object visitBinarySentence(BinarySentence fs, Object arg)
 {
     if (fs.isAndSentence())
     {
         return true;
     }
     else
     {
         bool first = ((bool)fs.getFirst().accept(this, null));
         bool second = ((bool)fs.getSecond().accept(this, null));
         return (first || second);
     }
 }
示例#5
0
        public override bool Equals(Object o)
        {
            if (this == o)
            {
                return(true);
            }
            if ((o == null) || !(o is BinarySentence))
            {
                return(false);
            }
            BinarySentence bs = (BinarySentence)o;

            return((bs.getOperator().Equals(getOperator())) &&
                   (bs.getFirst().Equals(first)) && (bs.getSecond()
                                                     .Equals(second)));
        }
示例#6
0
 public virtual Object visitBinarySentence(BinarySentence bs, Object arg)
 {
     List<Sentence> s = new List<Sentence>();
     if (arg is List<Symbol>)
     {
         List<Symbol> symbols = ((List<Symbol>)arg);
         foreach (Symbol symbol in symbols)
         {
             s.Add((Sentence)symbol);
         }
     }
     else
     {
         throw new ArgumentException("Could not cast arg to List<Sentence>");
     }
     List<Sentence> termunion = SetOps.union((List<Sentence>)bs.getFirst().accept(this, arg),
             (List<Sentence>)bs.getSecond().accept(this, arg));
     return SetOps.union(s, termunion);
 }
示例#7
0
 public virtual Object visitBinarySentence(BinarySentence fs, Object arg)
 {
     return new BinarySentence(fs.getOperator(), (Sentence)fs.getFirst()
             .accept(this, arg), (Sentence)fs.getSecond().accept(this, arg));
 }
示例#8
0
 private Sentence distributeOrOverAnd(BinarySentence bs)
 {
     BinarySentence andTerm = bs.firstTermIsAndSentence() ? (BinarySentence)bs
             .getFirst()
             : (BinarySentence)bs.getSecond();
     Sentence otherterm = bs.firstTermIsAndSentence() ? bs.getSecond() : bs
             .getFirst();
     // (alpha or (beta and gamma) = ((alpha or beta) and (alpha or gamma))
     Sentence alpha = (Sentence)otherterm.accept(this, null);
     Sentence beta = (Sentence)andTerm.getFirst().accept(this, null);
     Sentence gamma = (Sentence)andTerm.getSecond().accept(this, null);
     Sentence distributed = new BinarySentence("AND", new BinarySentence(
             "OR", alpha, beta), new BinarySentence("OR", alpha, gamma));
     return distributed;
 }
示例#9
0
	public Object visitBinarySentence(BinarySentence bs, Object arg) {
		bool? firstValue = (bool?) bs.getFirst().accept(this, null);
		bool? secondValue = (bool?) bs.getSecond().accept(this, null);
		if (!firstValue.HasValue  || !secondValue.HasValue) {
			// strictly not true for or/and
			// -FIX later
			return null;
		} else {
			String op = bs.getOperator();
			if (op.Equals("AND")) {
                return firstValue.Value && secondValue.Value;
			} else if (op.Equals("OR")) {
                return firstValue.Value || secondValue.Value;
			} else if (op.Equals("=>")) {
                return !(firstValue.Value && !secondValue.Value);
            }
            else if (op.Equals("<=>"))
            {
				return firstValue.Equals(secondValue);
			}
			return null;
		}
	}