Package org.ggp.base.util.propnet.architecture.components

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


          } else {
              pn.removeComponent(output);
          }
        }
      } else if(output instanceof And) {
        And and = (And) output;
        //Attach children of and to falseComponent
        for(Component child : and.getOutputs()) {
          child.addInput(falseComponent);
          falseComponent.addOutput(child);
          child.removeInput(and);
        }
        //Disconnect and completely
        and.removeAllOutputs();
        for(Component parent : and.getInputs())
          parent.removeOutput(and);
        and.removeAllInputs();
        if(pn != null)
            pn.removeComponent(and);
      } else if(output instanceof Or) {
        Or or = (Or) output;
        //Remove as input from or
View Full Code Here


          parent.removeOutput(or);
        or.removeAllInputs();
        if(pn != null)
            pn.removeComponent(or);
      } else if(output instanceof And) {
        And and = (And) output;
        //Remove as input from and
        and.removeInput(trueComponent);
        trueComponent.removeOutput(and);
        //If and has only one input, remove it
        if(and.getInputs().size() == 1) {
          Component in = and.getSingleInput();
          and.removeInput(in);
          in.removeOutput(and);
          for(Component out : and.getOutputs()) {
            //Disconnect from and
            out.removeInput(and);
            //and.removeOutput(out); //do at end
            //Connect directly to the new input
            out.addInput(in);
            in.addOutput(out);
          }
          and.removeAllOutputs();
          if (pn != null) {
              pn.removeComponent(and);
          }
        } else if (and.getInputs().size() == 0) {
          if (pn != null) {
            pn.removeComponent(and);
          }
        }
      } else if(output instanceof Not) {
View Full Code Here

   *            The rule to convert.
   */
  private void convertRule(GdlRule rule)
  {
    Proposition head = convertHead(rule.getHead());
    And and = new And();

    link(and, head);

    components.add(head);
    components.add(and);
View Full Code Here

        return;
      }
    }

    //For reals... just skip over any true constants
    And and = new And();
    for(Component in : inputs) {
      if(!(in instanceof Constant)) {
        in.addOutput(and);
        and.addInput(in);
      }
    }
    //What if they're all true? (Or inputs is empty?) Then no inputs at this point...
    if(and.getInputs().isEmpty()) {
      //Hook up to "true"
      trueProp.addOutput(output);
      output.addInput(trueProp);
      return;
    }
    //If there's just one, on the other hand, don't use the and gate
    if(and.getInputs().size() == 1) {
      Component in = and.getSingleInput();
      in.removeOutput(and);
      and.removeInput(in);
      in.addOutput(output);
      output.addInput(in);
      return;
    }
    and.addOutput(output);
    output.addInput(and);
  }
View Full Code Here

TOP

Related Classes of org.ggp.base.util.propnet.architecture.components.And

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.