Examples of Proposition


Examples of org.ggp.base.util.propnet.architecture.components.Proposition

  public void removeComponent(Component c) {


    //Go through all the collections it could appear in
    if(c instanceof Proposition) {
      Proposition p = (Proposition) c;
      GdlSentence name = p.getName();
      if(basePropositions.containsKey(name)) {
        basePropositions.remove(name);
      } else if(inputPropositions.containsKey(name)) {
        inputPropositions.remove(name);
        //The map goes both ways...
        Proposition partner = legalInputMap.get(p);
        if(partner != null) {
          legalInputMap.remove(partner);
          legalInputMap.remove(p);
        }
      } else if(name == GdlPool.getProposition(GdlPool.getConstant("INIT"))) {
        throw new RuntimeException("The INIT component cannot be removed. Consider leaving it and ignoring it.");
      } else if(name == GdlPool.getProposition(GdlPool.getConstant("terminal"))) {
        throw new RuntimeException("The terminal component cannot be removed.");
      } else {
        for(Set<Proposition> propositions : legalPropositions.values()) {
          if(propositions.contains(p)) {
            propositions.remove(p);
            Proposition partner = legalInputMap.get(p);
            if(partner != null) {
              legalInputMap.remove(partner);
              legalInputMap.remove(p);
            }
          }
View Full Code Here

Examples of org.ggp.base.util.propnet.architecture.components.Proposition

  {
    if ( literal instanceof GdlDistinct )
    {
      GdlDistinct distinct = (GdlDistinct) literal;

      Proposition proposition = new Proposition(GdlPool.getProposition(GdlPool.getConstant("anon")));
      Constant constant = new Constant(!distinct.getArg1().equals(distinct.getArg2()));

      link(constant, proposition);

      components.add(proposition);
      components.add(constant);

      return proposition;
    }
    else if ( literal instanceof GdlNot )
    {
      GdlNot not = (GdlNot) literal;

      Proposition input = convertConjunct(not.getBody());
      Not no = new Not();
      Proposition output = new Proposition(GdlPool.getProposition(GdlPool.getConstant("anon")));

      link(input, no);
      link(no, output);

      components.add(input);
      components.add(no);
      components.add(output);

      return output;
    }
    else
    {
      GdlSentence sentence = (GdlSentence) literal;

      Proposition proposition = getProposition(sentence);
      components.add(proposition);

      return proposition;
    }
  }
View Full Code Here

Examples of org.ggp.base.util.propnet.architecture.components.Proposition

   */
  private Proposition convertHead(GdlSentence sentence)
  {
    if ( sentence.getName().getValue().equals("next") )
    {
      Proposition head = getProposition(GdlPool.getRelation(GdlPool.getConstant("true"),
                                                            sentence.getBody()));
      Transition transition = new Transition();
      Proposition preTransition = new Proposition(GdlPool.getProposition(GdlPool.getConstant("anon")));

      link(preTransition, transition);
      link(transition, head);

      components.add(head);
      components.add(transition);
      components.add(preTransition);

      return preTransition;
    }
    else
    {
      Proposition proposition = getProposition(sentence);
      components.add(proposition);

      return proposition;
    }
  }
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.