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

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


        List<GdlTerm> tuple = GdlUtils.getTupleFromSentence(sentence);
        for (int i = 0; i < tuple.size(); i++) {
          GdlTerm term = tuple.get(i);
          if (term instanceof GdlVariable) {
            GdlVariable var = (GdlVariable) term;
            Set<GdlConstant> domain = formWithDomain.getDomainForSlot(i);
            varDomainsByVar.put(var, domain);
          }
        }
      }
View Full Code Here


            private int count = 1;
            private final Set<GdlVariable> originalVarsFromRule =
                    ImmutableSet.copyOf(GdlUtils.getVariables(rule));
            @Override
            public GdlVariable getUnusedVariable() {
                GdlVariable curVar = GdlPool.getVariable("?a" + count);
                count++;
                while (originalVarsFromRule.contains(curVar)) {
                    curVar = GdlPool.getVariable("?a" + count);
                    count++;
                }
View Full Code Here

      Map<GdlVariable, Set<GdlConstant>> varDomains = getVarDomains(rule, curDomains, model);

      for (int i = 0; i < headTuple.size(); i++) {
        ConcurrencyUtils.checkForInterruption();
        if (headTuple.get(i) instanceof GdlVariable) {
          GdlVariable curVar = (GdlVariable) headTuple.get(i);
          Set<GdlConstant> neededConstants = neededConstantsByForm.get(headForm).get(i);

          //Whittle these down based on what's possible throughout the rule
          Set<GdlConstant> neededAndPossibleConstants = Sets.newHashSet(neededConstants);
          neededAndPossibleConstants.retainAll(varDomains.get(curVar));
View Full Code Here

    for(int i = 0; i < tuple.size(); i++) {
      GdlTerm term = tuple.get(i);
      if(term instanceof GdlVariable
          && !multipleVars.contains(term)) {
        GdlVariable var = (GdlVariable) term;
        if(candidateVars.contains(var)
            || nonCandidateVars.contains(var)) {
          multipleVars.add(var);
          candidateVars.remove(var);
        } else if(dependentSlots.get(i)) {
View Full Code Here

    for(int i = 0; i < tuple.size(); i++) {
      GdlTerm term = tuple.get(i);
      if(term instanceof GdlVariable
          && !multipleVars.contains(term)) {
        GdlVariable var = (GdlVariable) term;
        if(candidateVars.contains(var)
            || nonCandidateVars.contains(var)) {
          multipleVars.add(var);
          candidateVars.remove(var);
        } else if(dependentSlots.get(i)) {
View Full Code Here

                i++;
            }
        }
        else if(term instanceof GdlVariable)
        {
            GdlVariable var = (GdlVariable)term;
            Set<Domain> occuranceList = findAllInstancesOf(var, RHS);
            dom.functionRefs.add(occuranceList);
        }
    }
View Full Code Here

                rval.addAll(findAllInstancesOf(var, func.get(i), parent));
            }
        }
        else if(gdl instanceof GdlVariable)
        {   //This is the interesting one
            GdlVariable variable = (GdlVariable)gdl;
            if(variable == var)
            {   //Found what we're looking for (base case of recursion)
                if(loc==null)
                    throw new RuntimeException("Parent missing for a variable.");
                rval.add(domains.get(loc));
View Full Code Here

          //need to change one of these
          varsToChange.add(plan.getVarsToChangePerDistinct().get(d));
        }
      }
      if(!varsToChange.isEmpty()) {
        GdlVariable varToChange = getLeftmostVar(varsToChange);
        //We want just the one, as it is a full restriction on its
        //own behalf
        changeOneInNext(Collections.singleton(varToChange));
      }
View Full Code Here

        }
      }
      if(plan.getVarsToAssign() == null)
        System.out.println("headOnly: " + headOnly);

      GdlVariable rightmostVar = getRightmostVar(vars);
      incrementIndex(plan.getVarsToAssign().indexOf(rightmostVar));
      makeNextAssignmentValid();

    }
View Full Code Here

        assignmentMap.put(plan.getVarsToAssign().get(i), nextAssignment.get(i));
      }
    }

    private GdlVariable getRightmostVar(Collection<GdlVariable> vars) {
      GdlVariable rightmostVar = null;
      for (GdlVariable var : plan.getVarsToAssign()) {
        if(vars.contains(var)) {
          rightmostVar = var;
        }
      }
View Full Code Here

TOP

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

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.