Package org.ggp.base.util.gdl.grammar

Examples of org.ggp.base.util.gdl.grammar.GdlOr


      return GdlPool.getDistinct(term1, term2);
    } else if(literal instanceof GdlNot) {
      GdlLiteral body = ((GdlNot) literal).getBody();
      return GdlPool.getNot(cleanParentheses(body));
    } else if(literal instanceof GdlOr) {
      GdlOr or = (GdlOr) literal;
      List<GdlLiteral> disjuncts = new ArrayList<GdlLiteral>();
      for(int i = 0; i < or.arity(); i++)
        disjuncts.add(cleanParentheses(or.get(i)));
      return GdlPool.getOr(disjuncts);
    }
    throw new RuntimeException("Unexpected literal type in GdlCleaner");
  }
View Full Code Here


        if(gdl instanceof GdlDistinct) {
            return GdlPool.getDistinct((GdlTerm) replaceVariableInternal(((GdlDistinct) gdl).getArg1(), toSubstitute, theReplacement), (GdlTerm) replaceVariableInternal(((GdlDistinct) gdl).getArg2(), toSubstitute, theReplacement));
        } else if(gdl instanceof GdlNot) {
            return GdlPool.getNot((GdlLiteral) replaceVariableInternal(((GdlNot) gdl).getBody(), toSubstitute, theReplacement));
        } else if(gdl instanceof GdlOr) {
            GdlOr or = (GdlOr)gdl;
            List<GdlLiteral> rval = new ArrayList<GdlLiteral>();
            for(int i=0; i<or.arity(); i++)
            {
                rval.add((GdlLiteral) replaceVariableInternal(or.get(i), toSubstitute, theReplacement));
            }
            return GdlPool.getOr(rval);
        } else if(gdl instanceof GdlProposition) {
            return gdl;
        } else if(gdl instanceof GdlRelation) {
View Full Code Here

      return GdlPool.getDistinct(arg1, arg2);
    } else if (gdl instanceof GdlNot) {
      GdlLiteral internal = ((GdlNot) gdl).getBody();
      return GdlPool.getNot(replaceVariables(internal, assignment));
    } else if (gdl instanceof GdlOr) {
      GdlOr or = (GdlOr) gdl;
      List<GdlLiteral> newInternals = new ArrayList<GdlLiteral>(or.arity());
      for (int i = 0; i < or.arity(); i++) {
        newInternals.add(replaceVariables(or.get(i), assignment));
      }
      return GdlPool.getOr(newInternals);
    } else if (gdl instanceof GdlRule) {
      GdlRule rule = (GdlRule) gdl;
      GdlSentence newHead = replaceVariables(rule.getHead(), assignment);
View Full Code Here

        GdlNot not = (GdlNot) qPrime;
        isConstant = askNot(not, goals, context, theta, cache, renamer, askOne, results, alreadyAsking);
      }
      else if (qPrime instanceof GdlOr)
      {
        GdlOr or = (GdlOr) qPrime;
        isConstant = askOr(or, goals, context, theta, cache, renamer, askOne, results, alreadyAsking);
      }
      else
      {
        GdlSentence sentence = (GdlSentence) qPrime;
View Full Code Here

            }
            return rval;
        }
        else if(gdl instanceof GdlOr)
        {
            GdlOr or = (GdlOr)gdl;
            rval = new ArrayList<Gdl>();
            for(int i=0; i<or.arity(); i++)
            {
                rval.add(or.get(i));
            }
            return rval;
        }
        else if(gdl instanceof GdlProposition)
        {
View Full Code Here

      }
    } else if(literal instanceof GdlNot) {
      GdlNot not = (GdlNot) literal;
      return GdlPool.getNot(replaceRelationInLiteral(not.getBody(), trueForm));
    } else if(literal instanceof GdlOr) {
      GdlOr or = (GdlOr) literal;
      List<GdlLiteral> newOrBody = new ArrayList<GdlLiteral>();
      for(int i = 0; i < or.arity(); i++)
        newOrBody.add(replaceRelationInLiteral(or.get(i), trueForm));
      return GdlPool.getOr(newOrBody);
    } else if(literal instanceof GdlDistinct) {
      return literal;
    } else {
      throw new RuntimeException("Unanticipated GDL literal type "+literal.getClass()+" encountered in Relationizer");
View Full Code Here

            GdlLiteral body = (GdlLiteral)getInstantiationAux(not.getBody(), varInstantiation);
            return GdlPool.getNot(body);
        }
        else if(gdl instanceof GdlOr)
        {
            GdlOr or = (GdlOr)gdl;
            List<GdlLiteral> body = new ArrayList<GdlLiteral>();
            for(int i=0; i<or.arity(); i++)
            {
                body.add((GdlLiteral)getInstantiationAux(or.get(i), varInstantiation));
            }
            return GdlPool.getOr(body);
        }
        else if(gdl instanceof GdlProposition)
        {
View Full Code Here

            }
            return rval;
        }
        else if(gdl instanceof GdlOr)
        {
            GdlOr or = (GdlOr)gdl;
            rval = new ArrayList<Gdl>();
            for(int i=0; i<or.arity(); i++)
            {
                rval.add(or.get(i));
            }
            return rval;
        }
        else if(gdl instanceof GdlProposition)
        {
View Full Code Here

TOP

Related Classes of org.ggp.base.util.gdl.grammar.GdlOr

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.