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

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


      }
    }

    for ( Proposition fixItem : fixList )
    {
      Or or = new Or();
      int i = 0;
      for ( Component input : fixItem.getInputs() )
      {
          i++;
View Full Code Here


          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
        or.removeInput(falseComponent);
        falseComponent.removeOutput(or);
        //If or has only one input, remove it
        if(or.getInputs().size() == 1) {
          Component in = or.getSingleInput();
          or.removeInput(in);
          in.removeOutput(or);
          for(Component out : or.getOutputs()) {
            //Disconnect from and
            out.removeInput(or);
            //or.removeOutput(out); //do at end
            //Connect directly to the new input
            out.addInput(in);
            in.addOutput(out);
          }
          or.removeAllOutputs();
          if (pn != null) {
              pn.removeComponent(or);
          }
        } else if (or.getInputs().size() == 0) {
          if (pn != null) {
            pn.removeComponent(or);
          }
        }
      } else if(output instanceof Not) {
View Full Code Here

          } else {
              pn.removeComponent(output);
          }
        }
      } else if(output instanceof Or) {
        Or or = (Or) output;
        //Attach children of or to trueComponent
        for(Component child : or.getOutputs()) {
          child.addInput(trueComponent);
          trueComponent.addOutput(child);
          child.removeInput(or);
        }
        //Disconnect or completely
        or.removeAllOutputs();
        for(Component parent : or.getInputs())
          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
View Full Code Here

    //Special case: An input is "or"
    //I'm honestly not sure how to handle special cases here...
    //What if that "or" gate has multiple outputs? Could that happen?

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

TOP

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

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.