Package aima.core.logic.fol.parsing.ast

Examples of aima.core.logic.fol.parsing.ast.ConnectedSentence


    return new NotSentence((Sentence) sentence.getNegated().accept(this,
        arg));
  }

  public Object visitConnectedSentence(ConnectedSentence sentence, Object arg) {
    return new ConnectedSentence(sentence.getConnector(),
        (Sentence) sentence.getFirst().accept(this, arg),
        (Sentence) sentence.getSecond().accept(this, arg));
  }
View Full Code Here


    return new NotSentence((Sentence) sentence.getNegated().accept(this,
        arg));
  }

  public Object visitConnectedSentence(ConnectedSentence sentence, Object arg) {
    return new ConnectedSentence(sentence.getConnector(),
        (Sentence) sentence.getFirst().accept(this, arg),
        (Sentence) sentence.getSecond().accept(this, arg));
  }
View Full Code Here

    Sentence sen = parseSentence();
    while (binaryConnector(lookAhead(1))) {
      String connector = lookAhead(1).getText();
      consume();
      Sentence other = parseSentence();
      sen = new ConnectedSentence(connector, sen, other);
    }
    match(")");
    return sen; /* new ParanthizedSentence */

  }
 
View Full Code Here

    // (alpha V (beta ^ gamma)) equivalent to
    // ((alpha V beta) ^ (alpha V gamma))
    if (Connectors.isOR(sentence.getConnector())
        && ConnectedSentence.class.isInstance(beta)) {
      ConnectedSentence betaAndGamma = (ConnectedSentence) beta;
      if (Connectors.isAND(betaAndGamma.getConnector())) {
        beta = betaAndGamma.getFirst();
        Sentence gamma = betaAndGamma.getSecond();
        return new ConnectedSentence(Connectors.AND,
            (Sentence) (new ConnectedSentence(Connectors.OR, alpha,
                beta)).accept(this, arg),
            (Sentence) (new ConnectedSentence(Connectors.OR, alpha,
                gamma)).accept(this, arg));
      }
    }

    // ((alpha ^ gamma) V beta) equivalent to
    // ((alpha V beta) ^ (gamma V beta))
    if (Connectors.isOR(sentence.getConnector())
        && ConnectedSentence.class.isInstance(alpha)) {
      ConnectedSentence alphaAndGamma = (ConnectedSentence) alpha;
      if (Connectors.isAND(alphaAndGamma.getConnector())) {
        alpha = alphaAndGamma.getFirst();
        Sentence gamma = alphaAndGamma.getSecond();
        return new ConnectedSentence(Connectors.AND,
            (Sentence) (new ConnectedSentence(Connectors.OR, alpha,
                beta)).accept(this, arg),
            (Sentence) (new ConnectedSentence(Connectors.OR, gamma,
                beta)).accept(this, arg));
      }
    }

    return new ConnectedSentence(sentence.getConnector(), alpha, beta);
  }
View Full Code Here

TOP

Related Classes of aima.core.logic.fol.parsing.ast.ConnectedSentence

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.