Package org.woped.core.model.petrinet

Examples of org.woped.core.model.petrinet.OperatorTransitionModel


            transition = (TransitionModel) allTransitions.get(eleIter.next());
            if (transition.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE) {
                // When starting a new token game we have to reset all center
                // places that
                // may contain tokens
                OperatorTransitionModel tempOperator = (OperatorTransitionModel) transition;
                if (tempOperator.getCenterPlace() != null) {
                    tempOperator.getCenterPlace().resetVirtualTokens();
                }
            }
        }
    }
View Full Code Here


                    if (arcConfig.m_numOutgoing == 0) {
                        m_sinkPlaces.add(currentNode);
                    }
                    break;
                case AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE: {
                    OperatorTransitionModel operator = (OperatorTransitionModel) currentNode;
                    // Remember the operator
                    // A list of operators is provided for
                    // statistical reasons
                    m_operators.add(operator);
                    int operatorType = operator.getOperatorType();
                    if ((operatorType == OperatorTransitionModel.AND_SPLIT_TYPE)
                            || (operatorType == OperatorTransitionModel.AND_SPLITJOIN_TYPE)
                            || (operatorType == OperatorTransitionModel.XORJOIN_ANDSPLIT_TYPE)) {
                        m_andsplits.add(operator);
                    }
                    if ((operatorType == OperatorTransitionModel.AND_JOIN_TYPE)
                            || (operatorType == OperatorTransitionModel.AND_SPLITJOIN_TYPE)
                            || (operatorType == OperatorTransitionModel.ANDJOIN_XORSPLIT_TYPE)) {
                        m_andjoins.add(operator);

                    }
                    if ((operatorType == OperatorTransitionModel.XOR_SPLIT_TYPE)
                            || (operatorType == OperatorTransitionModel.XOR_SPLITJOIN_TYPE)
                            || (operatorType == OperatorTransitionModel.ANDJOIN_XORSPLIT_TYPE)) {
                        m_xorsplits.add(operator);
                    }
                    if ((operatorType == OperatorTransitionModel.XOR_JOIN_TYPE)
                            || (operatorType == OperatorTransitionModel.XOR_SPLITJOIN_TYPE)
                            || (operatorType == OperatorTransitionModel.XORJOIN_ANDSPLIT_TYPE)) {
                        m_xorjoins.add(operator);
                    }

                    // Verify that the operator has the correct arc
                    // configuration
                    // If this is not the case it will be added to the
                    // misused operators list
                    verifyOperatorArcConfiguration(operator, arcConfig);
                    ModelElementContainer simpleTransContainer = operator.getSimpleTransContainer();
                    // Recursively call ourselves to add inner nodes
                    Iterator<AbstractPetriNetElementModel> innerIterator = simpleTransContainer.getRootElements().iterator();
                    updateStatistics(innerIterator);
                    // To have the total number of arcs we must subtract
                    // the number of incoming and outgoing arcs from the
View Full Code Here

    // set the type of the element
    typeId = node.getType();

    // if the element is a transition-operator
    if (node instanceof OperatorTransitionModel) {
      OperatorTransitionModel otm = (OperatorTransitionModel) node;
      typeId = otm.getOperatorType();
    }

    // Generic approach to detect whether this element has any children:
    // Elements with children implement InnerElementContainer
    if (addChildren && (node instanceof InnerElementContainer) &&
View Full Code Here

                        .getChildAt(0));
                arc.setPoints(pointArray);
                GraphConstants.setSelectable(arc.getAttributes(), false);
                GraphConstants.setLineColor(arc.getAttributes(), T_STAR_COLOR);

                OperatorTransitionModel operatorModel;
                if (source.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE) {
                    operatorModel = (OperatorTransitionModel) source;
                    operatorModel.addElement(target);
                    operatorModel.registerOutgoingConnection((PetriNetModelProcessor) editor.getModelProcessor(),
                            target);
                } else
                    if (target.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE) {
                        operatorModel = (OperatorTransitionModel) target;
                        operatorModel.addElement(source);
                        operatorModel.registerIncomingConnection((PetriNetModelProcessor) editor.getModelProcessor(),
                                source);

                    }
                editor.getModelProcessor().getElementContainer().addReference(arc);
View Full Code Here

      // Get postset of the place
      Set<AbstractPetriNetElementModel> postset = NetAlgorithms.getDirectlyConnectedNodes(highlightElement, NetAlgorithms.connectionTypeOUTBOUND);
      // Get preset of the place
      Set<AbstractPetriNetElementModel> preset = NetAlgorithms.getDirectlyConnectedNodes(highlightElement, NetAlgorithms.connectionTypeINBOUND);
     
      OperatorTransitionModel tempOpTransModel;
     
      // The correction is only done if 2 elements are in the postset and the preset,
      // respectively. This corresponds to exact 1 Xor-Split operator in the postset
      // or 1 Xor-Join operator in the preset.
      if (postset.size() == 2) {
                   
          Iterator<AbstractPetriNetElementModel> postsetIter = postset.iterator();
       
        AbstractPetriNetElementModel postsetCheck1, postsetCheck2;
         
        postsetCheck1 = postsetIter.next();
        postsetCheck2 = postsetIter.next();
       
        // If both elements in the postset are of the type PetriNetModelElement.TRANS_OPERATOR_TYPE
        // get the van der Aalst operator from the owning container and set it as highlightElement.
        postsetCheck1 =  (postsetCheck1.getRootOwningContainer().getOwningElement() != null)
        ? postsetCheck1.getRootOwningContainer().getOwningElement()
        : postsetCheck1;
         
        postsetCheck2 =  (postsetCheck2.getRootOwningContainer().getOwningElement() != null)
        ? postsetCheck2.getRootOwningContainer().getOwningElement()
        : postsetCheck2;
         
        if (postsetCheck1.equals(postsetCheck2) && postsetCheck1.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE) {
           
          tempOpTransModel = (OperatorTransitionModel) postsetCheck1;
           
          if (tempOpTransModel.getOperatorType() == OperatorTransitionModel.XOR_SPLIT_TYPE) {           
            // activate coloring of this element
            highlightElement = tempOpTransModel;
          }
        }
      }
     
      // The correction is only done if 2 elements are in the postset and the preset,
      // respectively. This corresponds to exact 1 Xor-Split operator in the postset
      // or 1 Xor-Join operator in the preset.
      else{
        if (preset.size() == 2) {
                     
            Iterator<AbstractPetriNetElementModel> presetIter = preset.iterator();
         
            AbstractPetriNetElementModel presetCheck1, presetCheck2;
           
            presetCheck1 = presetIter.next();
            presetCheck2 = presetIter.next();
                     
            // If both elements in the preset are of the type PetriNetModelElement.TRANS_OPERATOR_TYPE
            // get the van der Aalst operator from the owning container and set it as highlightElement.
            presetCheck1 =  (presetCheck1.getRootOwningContainer().getOwningElement() != null)
            ? presetCheck1.getRootOwningContainer().getOwningElement()
            : presetCheck1;
           
            presetCheck2 =  (presetCheck2.getRootOwningContainer().getOwningElement() != null)
            ? presetCheck2.getRootOwningContainer().getOwningElement()
            : presetCheck2;
         
            if (presetCheck1.equals(presetCheck2) && presetCheck1.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE) {
             
              tempOpTransModel = (OperatorTransitionModel) presetCheck1;
             
              if (tempOpTransModel.getOperatorType() == OperatorTransitionModel.XOR_JOIN_TYPE) {
                // activate coloring of this element
                highlightElement = tempOpTransModel;
              }
            } 
          }
View Full Code Here

    while (i.hasNext()) {
      AbstractPetriNetElementModel current = (AbstractPetriNetElementModel) i.next();
      current.setHighlighted(false);
      if (current.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE)
            {
              OperatorTransitionModel operatorModel = (OperatorTransitionModel) current;
                Iterator<AbstractPetriNetElementModel> simpleTransIter = operatorModel.getSimpleTransContainer().getElementsByType(AbstractPetriNetElementModel.TRANS_SIMPLE_TYPE).values().iterator();
                while (simpleTransIter.hasNext())
                {
                    AbstractPetriNetElementModel simpleTransModel = (AbstractPetriNetElementModel) simpleTransIter.next();
                    if (simpleTransModel != null
                            && operatorModel.getSimpleTransContainer().getElementById(simpleTransModel.getId()).getType() == AbstractPetriNetElementModel.TRANS_SIMPLE_TYPE)
                    {
                      simpleTransModel.setHighlighted(false);
                    }
                }
            }
View Full Code Here

                initTransition(iNet.addNewTransition(), (TransitionModel) currentModel, null);
            }
              /* ##### OPERATOR TRANSITION ##### */
            else if (currentModel.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE)
            {
              OperatorTransitionModel operatorModel = (OperatorTransitionModel) currentModel;
                Iterator<AbstractPetriNetElementModel> simpleTransIter = operatorModel.getSimpleTransContainer().getElementsByType(AbstractPetriNetElementModel.TRANS_SIMPLE_TYPE).values().iterator();
                while (simpleTransIter.hasNext())
                {
                    AbstractPetriNetElementModel simpleTransModel = (AbstractPetriNetElementModel) simpleTransIter.next();
                    if (simpleTransModel != null
                            && operatorModel.getSimpleTransContainer().getElementById(simpleTransModel.getId()).getType() == AbstractPetriNetElementModel.TRANS_SIMPLE_TYPE)
                    {
                        initTransition(iNet.addNewTransition(), (TransitionModel) operatorModel.getSimpleTransContainer().getElementById(simpleTransModel.getId()), operatorModel);
                    }

                }
                if (operatorModel.getCenterPlace() != null)
                {
                    initPlace(iNet.addNewPlace(), operatorModel.getCenterPlace());
                }
            }
        }

          /* ##### ARCS ##### */
        this.arcCounter = 0;
        Set<AbstractPetriNetElementModel> connectedTransitions = new HashSet<AbstractPetriNetElementModel>()
        Iterator<String> arcIter = elementContainer.getArcMap().keySet().iterator();
        while (arcIter.hasNext())
        {
            ArcModel currentArc = elementContainer.getArcById(arcIter.next());
            AbstractPetriNetElementModel currentTargetModel = (AbstractPetriNetElementModel) elementContainer.getElementById(currentArc.getTargetId());
            AbstractPetriNetElementModel currentSourceModel = (AbstractPetriNetElementModel) elementContainer.getElementById(currentArc.getSourceId());

            if (currentTargetModel.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE)
              connectedTransitions.add(currentTargetModel);
            else if (currentSourceModel.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE)
              connectedTransitions.add(currentSourceModel);
            else
            {
                initArc(iNet.addNewArc(), currentArc, null);
            }
        }
     
        Iterator<AbstractPetriNetElementModel> currentTransition = connectedTransitions.iterator();
        while (currentTransition.hasNext())
        {
          OperatorTransitionModel currentConnectedModel = (OperatorTransitionModel)currentTransition.next();
          Iterator<String> innerArcIter = currentConnectedModel.getSimpleTransContainer().getArcMap().keySet().iterator();
          while (innerArcIter.hasNext())
          {
            ArcModel currentInnerArc = (ArcModel) currentConnectedModel.getSimpleTransContainer().getArcMap().get(innerArcIter.next());

            ArcModel currentOuterArc = null;
            if (elementContainer.getElementById(currentInnerArc.getSourceId())!=null)
            {
              currentOuterArc = elementContainer.findArc(currentInnerArc.getSourceId(),
                  currentConnectedModel.getId());
            }
            if (elementContainer.getElementById(currentInnerArc.getTargetId())!=null)
            {
              currentOuterArc = elementContainer.findArc(currentConnectedModel.getId(),
                  currentInnerArc.getTargetId());
            }
           
           
                initArc(iNet.addNewArc(), (currentOuterArc!=null)?currentOuterArc:currentInnerArc,
View Full Code Here

      AbstractPetriNetElementModel current = (AbstractPetriNetElementModel) i.next();
      current.setHighlighted(false);
     
      if (current.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE)
            {
              OperatorTransitionModel operatorModel = (OperatorTransitionModel) current;
                Iterator<AbstractPetriNetElementModel> simpleTransIter = operatorModel.getSimpleTransContainer().getElementsByType(AbstractPetriNetElementModel.TRANS_SIMPLE_TYPE).values().iterator();
                while (simpleTransIter.hasNext())
                {
                    AbstractPetriNetElementModel simpleTransModel = (AbstractPetriNetElementModel) simpleTransIter.next();
                    if (simpleTransModel != null
                            && operatorModel.getSimpleTransContainer().getElementById(simpleTransModel.getId()).getType() == AbstractPetriNetElementModel.TRANS_SIMPLE_TYPE)
                    {
                      simpleTransModel.setHighlighted(false);
                    }
                }   
            }
View Full Code Here

        this.table.clearSelection();

        if (model.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE)
              {
                OperatorTransitionModel operatorModel = (OperatorTransitionModel) model;
                  Iterator<AbstractPetriNetElementModel> simpleTransIter = operatorModel.getSimpleTransContainer().getElementsByType(AbstractPetriNetElementModel.TRANS_SIMPLE_TYPE).values().iterator();
                  while (simpleTransIter.hasNext())
                  {
                      AbstractPetriNetElementModel simpleTransModel = (AbstractPetriNetElementModel) simpleTransIter.next();
                      if (simpleTransModel != null
                              && operatorModel.getSimpleTransContainer().getElementById(simpleTransModel.getId()).getType() == AbstractPetriNetElementModel.TRANS_SIMPLE_TYPE)
                      {
                          if(highlightElementInTable(simpleTransModel.getId()) == true){
                            model.setHighlighted(true);
                          }
                      }
View Full Code Here

    while (i.hasNext()) {
      AbstractPetriNetElementModel current = (AbstractPetriNetElementModel) i.next();
      current.setHighlighted(false);
      if (current.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE)
            {
              OperatorTransitionModel operatorModel = (OperatorTransitionModel) current;
                Iterator<AbstractPetriNetElementModel> simpleTransIter = operatorModel.getSimpleTransContainer().getElementsByType(AbstractPetriNetElementModel.TRANS_SIMPLE_TYPE).values().iterator();
                while (simpleTransIter.hasNext())
                {
                    AbstractPetriNetElementModel simpleTransModel = (AbstractPetriNetElementModel) simpleTransIter.next();
                    if (simpleTransModel != null
                            && operatorModel.getSimpleTransContainer().getElementById(simpleTransModel.getId()).getType() == AbstractPetriNetElementModel.TRANS_SIMPLE_TYPE)
                    {
                      simpleTransModel.setHighlighted(false);
                      for(String id : selection){
                    if (simpleTransModel.getId().equals(id)){
                      current.setHighlighted(true);
View Full Code Here

TOP

Related Classes of org.woped.core.model.petrinet.OperatorTransitionModel

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.