getSecond() public method

public getSecond ( ) : Sentence
return Sentence
Exemplo n.º 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);
 }
Exemplo n.º 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));
 }
Exemplo n.º 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;

        }
Exemplo n.º 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);
     }
 }
Exemplo n.º 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)));
        }
Exemplo n.º 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);
 }
Exemplo n.º 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));
 }
Exemplo n.º 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;
 }
Exemplo n.º 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;
		}
	}