Examples of GdlConstant


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

    varsToKeep.retainAll(varsToKeep2);

    //Now we're ready to split it apart
    //Let's make the new rule
    List<GdlTerm> orderedVars = new ArrayList<GdlTerm>(varsToKeep);
    GdlConstant condenserName = sentenceNameSource.getNameWithPrefix(rule.getHead().getName());
    //Make the rule head
    GdlSentence condenserHead;
    if(orderedVars.isEmpty()) {
      condenserHead = GdlPool.getProposition(condenserName);
    } else {
View Full Code Here

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

   * @return the integer value of the goal proposition
   */
    private int getGoalValue(Proposition goalProposition)
  {
    GdlRelation relation = (GdlRelation) goalProposition.getName();
    GdlConstant constant = (GdlConstant) relation.get(1);
    return Integer.parseInt(constant.toString());
  }
View Full Code Here

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

     */
    private void expandTrue(GdlSentence base, int index, LinkedList<GdlTerm> workingSet, List<GdlRule> results)
    {
        if ( base.arity() == index )
        {
            GdlConstant name = (GdlConstant) base.get(0);
            List<GdlTerm> body = new ArrayList<GdlTerm>(workingSet);

            GdlFunction function = GdlPool.getFunction(name, body);
            results.add(GdlPool.getRule(GdlPool.getRelation(GdlPool.getConstant("true"), new GdlTerm[] { function })));
        }
View Full Code Here

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

                GdlSentence sentence = (GdlSentence) gdl;
                if ( sentence.getName().getValue().equals("base") )
                {
                    if ( sentence.arity() == 1 )
                    {
                        GdlConstant constant = (GdlConstant) sentence.get(0);
                        trues.add(GdlPool.getRule(GdlPool.getRelation(GdlPool.getConstant("true"), new GdlTerm[] { constant })));
                    }
                    else
                    {
                        List<GdlRule> results = new ArrayList<GdlRule>();
View Full Code Here

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

    {
        Map<GdlConstant, List<GdlRule>> templates = new HashMap<GdlConstant, List<GdlRule>>();
        for ( Gdl gdl : description )
        {
            GdlRule rule = (gdl instanceof GdlRule) ? (GdlRule) gdl : GdlPool.getRule((GdlSentence) gdl);
            GdlConstant name = rule.getHead().getName();

            if ( !name.getValue().equals("base") )
            {
                if ( !templates.containsKey(name) )
                {
                    templates.put(name, new ArrayList<GdlRule>());
                }
View Full Code Here

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

        GdlFunction func = (GdlFunction)term;
        List<GdlTerm> newBody = new ArrayList<GdlTerm>();
        for(GdlTerm t : func.getBody())
            newBody.add(findGenericForm(t));
        GdlConstant name = func.getName();
        if(name==legalConst)
            name=doesConst;
        else if(name==nextConst)
            name=trueConst;
        else if(name==initConst)
View Full Code Here

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

        Domain dom = cond.dom;
        Assignments assignments = null;
        for(int i=0; i<cond.template.size(); i++)
        {
            GdlTerm t = cond.template.get(i);
            GdlConstant c = null;
            if(t instanceof GdlVariable)
            {
                GdlVariable v = (GdlVariable)t;
                if(instantiation.containsKey(v))
                    c = instantiation.get(v);
View Full Code Here

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

  public List<Role> toRoles(List<GdlSentence> results)
  {
    List<Role> roles = new ArrayList<Role>();
    for (GdlSentence result : results)
    {
      GdlConstant name = (GdlConstant) result.get(0);
      roles.add(new Role(name));
    }

    return roles;
  }
View Full Code Here

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

    {
      return function;
    }
    else
    {
      GdlConstant name = renameConstant(function.getName(), renamings);

      List<GdlTerm> body = new ArrayList<GdlTerm>();
      for (int i = 0; i < function.arity(); i++)
      {
        body.add(renameTerm(function.get(i), renamings));
View Full Code Here

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

    {
      return relation;
    }
    else
    {
      GdlConstant name = renameConstant(relation.getName(), renamings);

      List<GdlTerm> body = new ArrayList<GdlTerm>();
      for (int i = 0; i < relation.arity(); i++)
      {
        body.add(renameTerm(relation.get(i), renamings));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.