Package alice.tuprolog

Examples of alice.tuprolog.SolveInfo


  protected void assertTerm(jp.ac.kobe_u.cs.prolog.lang.StructureTerm term) {
    if (logger.isDebugEnabled()) {
      logger.debug("+" + term);
    }
    try {
      SolveInfo info = executeGoal(new PRED_assert_1(term, null) + ".");
      if (!info.isSuccess()) {
        throw new IllegalStateException("Failed to assert " + term);
      }
    } catch (MalformedGoalException e) {
      throw new IllegalStateException(e);
    }
View Full Code Here


    long startTime = 0;
    boolean traceEnabled = logger.isTraceEnabled();
    if (traceEnabled) {
      startTime = System.nanoTime();
    }
    SolveInfo result = engine.solve(goal);
    if (traceEnabled) {
      logger.trace("Executing " + goal + " took "
          + (System.nanoTime() - startTime) / 1000000.0 + " ms");

    }
View Full Code Here

  protected void retractTerm(jp.ac.kobe_u.cs.prolog.lang.StructureTerm term) {
    if (logger.isDebugEnabled()) {
      logger.debug("-" + term);
    }
    try {
      SolveInfo info = executeGoal(new PRED_retract_1(term, null) + ".");
      if (!info.isSuccess()) {
        throw new IllegalStateException("Failed to assert " + term);
      }
    } catch (MalformedGoalException e) {
      throw new IllegalStateException(e);
    }
View Full Code Here

    String goal = pedicate.toString();
    goal = goal.replace(p.toString(), "P") + ".";
    if (logger.isDebugEnabled()) {
      logger.debug(goal);
    }
    SolveInfo info;
    try {
      info = executeGoal(goal);
    } catch (MalformedGoalException e) {
      throw new IllegalStateException(e);
    }
    if (!info.isSuccess()) {
      throw new IllegalStateException("Failed to call " + goal);
    }
    Term binding;
    try {
      binding = info.getTerm("P");
    } catch (NoSolutionException e) {
      throw new IllegalStateException("Failed to call " + goal, e);
    } catch (UnknownVarException e) {
      throw new IllegalStateException("Failed to call " + goal, e);
    }
View Full Code Here

TOP

Related Classes of alice.tuprolog.SolveInfo

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.