Package org.woped.core.model.petrinet

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


                                .getElementContainer()));

                    } else
                        if (currentModel.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE) {

                            OperatorTransitionModel aalstModel = (OperatorTransitionModel) currentModel;
                            Iterator<AbstractPetriNetElementModel> simpleTransIter = aalstModel.getSimpleTransContainer().getRootElements()
                                    .iterator();
                            while (simpleTransIter.hasNext()) {

                                AbstractPetriNetElementModel simpleTransModel = (AbstractPetriNetElementModel) simpleTransIter.next();
                                if (aalstModel.getSimpleTransContainer().getElementById(simpleTransModel.getId())
                                        .getType() == AbstractPetriNetElementModel.TRANS_SIMPLE_TYPE) {
                                    fos.write(getLine4Transition(currentModel.getNameValue(), simpleTransModel,
                                            aalstModel.getSimpleTransContainer()));
                                }

                            }
                        }
            }
View Full Code Here


    while (i.hasNext()) {
      AbstractPetriNetElementModel current = (AbstractPetriNetElementModel) i.next();

      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)
                    {
                      idList.add(((TransitionModel) operatorModel.getSimpleTransContainer().getElementById(simpleTransModel.getId())).getId());
                    }

                }
               
            }
View Full Code Here

      while (i.hasNext()) {
        AbstractPetriNetElementModel current = (AbstractPetriNetElementModel) i.next();

          if (current.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE)
                {
                  OperatorTransitionModel operatorModel = (OperatorTransitionModel) current;
                    Iterator<AbstractPetriNetElementModel> simpleTransIter = operatorModel.getSimpleTransContainer().getElementsByType(AbstractPetriNetElementModel.TRANS_SIMPLE_TYPE).values().iterator();
                  
                    int highlightcounter = 0;
                    while (simpleTransIter.hasNext())
                    {
                        AbstractPetriNetElementModel simpleTransModel = (AbstractPetriNetElementModel) simpleTransIter.next();
                        if (simpleTransModel != null // Sometimes the iterator
                                // returns null...
                                && operatorModel.getSimpleTransContainer().getElementById(simpleTransModel.getId()).getType() == AbstractPetriNetElementModel.TRANS_SIMPLE_TYPE)
                        {
                           if(availableIdsTableModel.getValueAt(row,1).equals("0") && availableIdsTableModel.getValueAt(row,0).equals(simpleTransModel.getId()) && column == 2){
                  simpleTransModel.setHighlighted(false);
                }
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

    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

                    tokenGameStats.numActiveSubprocesses++;  
                }
            }
        } else
            if (transition.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE) {
                OperatorTransitionModel operator = (OperatorTransitionModel) transition;
                if (operator.getOperatorType() == OperatorTransitionModel.AND_JOIN_TYPE
                        || operator.getOperatorType() == OperatorTransitionModel.AND_SPLIT_TYPE
                        || operator.getOperatorType() == OperatorTransitionModel.AND_SPLITJOIN_TYPE) {
                    if (transition.isActivated()) {
                        // This will add the AND-X-Transition to the OccurenceList
                        RemoteControl.addFollowingItem(transition);
                        tokenGameStats.numActiveTransitions++;                                                       
                    }

                } else
                    if ((operator.getOperatorType() == OperatorTransitionModel.XOR_SPLIT_TYPE)
                            || (operator.getOperatorType() == OperatorTransitionModel.ANDJOIN_XORSPLIT_TYPE)) {
                        if (transition.isActivated()) {
                            String XorName, ID;
                            Iterator<String> outArcs = outgoingArcs.keySet().iterator();
                            TransitionModel virtualTransition; // needed to build virtual Transitions.
                            AbstractPetriNetElementModel helpPlace;

                            /*
                             * In this while-loop, Virtual Transitions will be build which represent the Arcs in the OccurenceList. If a virtual Transition is
                             * chosen by the user, it will be identified by its ID as Arc and the depending Arc will be taken instead to be occured
                             */
                            while (outArcs.hasNext()) {
                                ID = outArcs.next(); // get the Arc's ID
                                // Use a new CreationMap with the arcs id to create the virtual transition
                                CreationMap map = CreationMap.createMap();
                                map.setId(ID);
                                virtualTransition = new TransitionModel(map);
                                helpPlace = getPetriNet().getElementContainer().getElementById(
                                        getPetriNet().getElementContainer().getArcById(ID).getTargetId());
                                XorName = transition.getNameValue() + " -> (" + helpPlace.getNameValue() + ")";
                                virtualTransition.setNameValue(XorName);
                                RemoteControl.addFollowingItem(virtualTransition);
                                tokenGameStats.numActiveTransitions++;                                                               
                                virtualTransition = null;
                                XorName = "";
                            }

                            setOutgoingArcsActive(transition.getId(), true);
                        }
                    } else
                        if ((operator.getOperatorType() == OperatorTransitionModel.XOR_JOIN_TYPE)
                                || (operator.getOperatorType() == OperatorTransitionModel.XORJOIN_ANDSPLIT_TYPE)) {
                            if (transition.getNumIncomingActivePlaces() > 0) {
                                String XorName, ID;
                                Iterator<String> inArcs = incomingArcs.keySet().iterator();
                                TransitionModel virtualTransition; // needed to build virtual Transitions.
                                AbstractPetriNetElementModel helpPlace;
                                // ArcModel activeArc;

                                /*
                                 * In this while-loop, Virtual Transitions will be build which represent the Arcs in the OccurenceList. If a virtual Transition
                                 * is chosen by the user, it will be identified by its ID as Arc and the depending Arc will be taken instead to be occured
                                 */
                                setIncomingArcsActive(transition.getId(), true);
                                while (inArcs.hasNext()) {
                                    ID = inArcs.next(); // Get Arcs ID
                                    // List all activated Arcs in the occur List
                                    if (getPetriNet().getElementContainer().getArcById(ID).isActivated()) {
                                        // Use a new CreationMap with the arcs id to create the virtual transition
                                        CreationMap map = CreationMap.createMap();
                                        map.setId(ID);
                                        virtualTransition = new TransitionModel(map);
                                        helpPlace = getPetriNet().getElementContainer().getElementById(
                                                getPetriNet().getElementContainer().getArcById(ID).getSourceId());
                                        XorName = "(" + helpPlace.getNameValue() + ")-> " + transition.getNameValue();
                                        virtualTransition.setNameValue(XorName);
                                        RemoteControl.addFollowingItem(virtualTransition);
                                        tokenGameStats.numActiveTransitions++;                                                                       
                                        virtualTransition = null;
                                        XorName = "";
                                    }
                                }
                            }
                        } else
                            if (operator.getOperatorType() == OperatorTransitionModel.XOR_SPLITJOIN_TYPE) {
                                // This is the XOR split-join combination type.
                                // Check whether the center place already contains (a) token(s)
                                if ((operator.getCenterPlace() != null)
                                        && (operator.getCenterPlace().getVirtualTokenCount() > 0)) {

                                    String XorName, ID;
                                    Iterator<String> outArcs = outgoingArcs.keySet().iterator();
                                    TransitionModel virtualTransition; // needed to build virtual Transitions.
                                    AbstractPetriNetElementModel helpPlace;
View Full Code Here

                }
                actionPerformed = true;

            } else
                if (transition.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE) {
                    OperatorTransitionModel operator = (OperatorTransitionModel) transition;
                    if (operator.getOperatorType() == OperatorTransitionModel.AND_JOIN_TYPE
                            || operator.getOperatorType() == OperatorTransitionModel.AND_SPLIT_TYPE
                            || operator.getOperatorType() == OperatorTransitionModel.AND_SPLITJOIN_TYPE) {
                        // LoggerManager.debug(Constants.EDITOR_LOGGER, "TokenGame:
                        // FIRE AND-Transition:
                        // "+transition.getId());
                        receiveTokens(getPetriNet().getElementContainer().getOutgoingArcs(transition.getId()));
                        sendTokens(getPetriNet().getElementContainer().getIncomingArcs(transition.getId()));
                        actionPerformed = true;

                    } else
                        if ((operator.getOperatorType() == OperatorTransitionModel.XOR_SPLIT_TYPE)
                                || (operator.getOperatorType() == OperatorTransitionModel.ANDJOIN_XORSPLIT_TYPE)) {
                            // Do nothing: Only controlled by Arc Clicking
                        } else
                            if ((operator.getOperatorType() == OperatorTransitionModel.XOR_JOIN_TYPE)
                                    || (operator.getOperatorType() == OperatorTransitionModel.XORJOIN_ANDSPLIT_TYPE)) {
                                // Do nothing: Only controlled by Arc Clicking
                            } else
                                if (operator.getOperatorType() == OperatorTransitionModel.XOR_SPLITJOIN_TYPE) {
                                    // Do nothing: Only controlled by Arc Clicking as the user
                                    // has to select the
                                    // token source
                                }
                }
View Full Code Here

            AbstractPetriNetElementModel source = (AbstractPetriNetElementModel) getPetriNet().getElementContainer().getElementById(
                    arc.getSourceId());
            AbstractPetriNetElementModel target = (AbstractPetriNetElementModel) getPetriNet().getElementContainer().getElementById(
                    arc.getTargetId());

            OperatorTransitionModel tempOperator;

            // As a reminder, an arc is generally going from a place to a
            // transition or from a
            // transition to a place.
            // When pointing to a transition it is referencing a potential
            // provider of a token.
            // When pointing to a place that place is potential receiver for a
            // token.
            // First, we check if the origin of our clicked arc is a transition
            // (Note that we check for the operator type only as ordinary
            // transitions are not triggered
            // by clicking the arrow but by clicking the transition itself which
            // is handled in transitionClicked())
            if (source.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE) {
                tempOperator = (OperatorTransitionModel) source;
                if (tempOperator.isActivated()) {
                    if (tempOperator.getOperatorType() == OperatorTransitionModel.XOR_SPLIT_TYPE
                            || tempOperator.getOperatorType() == OperatorTransitionModel.XOR_SPLITJOIN_TYPE
                            || tempOperator.getOperatorType() == OperatorTransitionModel.ANDJOIN_XORSPLIT_TYPE) {
                        receiveTokens(arc);
                        if (tempOperator.getOperatorType() != OperatorTransitionModel.XOR_SPLITJOIN_TYPE) {
                            sendTokens(getPetriNet().getElementContainer().getIncomingArcs(tempOperator.getId()));
                        } else {
                            // Special code for splitjoin. We have to take the
                            // token from the center place
                            if (tempOperator.getCenterPlace() != null) {
                                // FIXME: Once implemented, this place will also
                                // have to remove weighted tokens
                                tempOperator.getCenterPlace().sendToken();
                            }
                        }
                    }
                }
            } else
                if (target.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE) {
                    tempOperator = (OperatorTransitionModel) target;
                    if (tempOperator.getOperatorType() == OperatorTransitionModel.XOR_JOIN_TYPE
                            || tempOperator.getOperatorType() == OperatorTransitionModel.XORJOIN_ANDSPLIT_TYPE
                            || tempOperator.getOperatorType() == OperatorTransitionModel.XOR_SPLITJOIN_TYPE) {
                        sendTokens(arc);
                        if (tempOperator.getOperatorType() != OperatorTransitionModel.XOR_SPLITJOIN_TYPE) {
                            receiveTokens(getPetriNet().getElementContainer().getOutgoingArcs(tempOperator.getId()));
                        } else {
                            // Special code for splitjoin. We have to send the token
                            // to the center place
                            if (tempOperator.getCenterPlace() != null) {
                                // FIXME: Once implemented, this place will also have to
                                // receive weighted tokens
                                tempOperator.getCenterPlace().receiveToken();
                            }
                        }
                    }
                }
            // Update net status
View Full Code Here

          while (i.hasNext()) {
            AbstractPetriNetElementModel cur = (AbstractPetriNetElementModel) i
                .next();

            if (cur.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE) {
              OperatorTransitionModel operatorModel = (OperatorTransitionModel) cur;
              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) {
View Full Code Here

        {
            AbstractPetriNetElementModel source = (AbstractPetriNetElementModel) getPetriNet().getElementContainer().getElementById(
                    arc.getSourceId());
            AbstractPetriNetElementModel target = (AbstractPetriNetElementModel) getPetriNet().getElementContainer().getElementById(
                    arc.getTargetId());
            OperatorTransitionModel tempOperator;
            if (target.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE) {
                tempOperator = (OperatorTransitionModel) target;
                receiveBackwardTokens(arc);
                if (tempOperator.getOperatorType() != OperatorTransitionModel.XOR_SPLITJOIN_TYPE) {
                    sendBackwardTokens(getPetriNet().getElementContainer().getOutgoingArcs(tempOperator.getId()));
                    actionPerformed = true;
                } else {
                    // Special code for splitjoin. We have to take the
                    // token from the center place
                    if (tempOperator.getCenterPlace() != null) {
                        tempOperator.getCenterPlace().sendToken();
                        actionPerformed = true;
                    }
                }
            }
            if (source.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE) {
                tempOperator = (OperatorTransitionModel) source;
                sendBackwardTokens(arc);
                if (tempOperator.getOperatorType() != OperatorTransitionModel.XOR_SPLITJOIN_TYPE) {
                    receiveBackwardTokens(getPetriNet().getElementContainer().getIncomingArcs(tempOperator.getId()));
                    actionPerformed = true;
                } else {
                    // Special code for splitjoin. We have to send the token
                    // to the center place
                    if (tempOperator.getCenterPlace() != null) {
                        tempOperator.getCenterPlace().receiveToken();
                    }
                    actionPerformed = 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.