Package org.woped.core.model.petrinet

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


    }

    public Set<AbstractPetriNetElementModel> getSet(int nNumElements, int nElementNameCommand) {
        Set<AbstractPetriNetElementModel> result = new HashSet<AbstractPetriNetElementModel>();
        for (int i = 0; i < nNumElements; ++i) {
            AbstractPetriNetElementModel current = getElementInfo(nElementNameCommand, i, 0);
            if (current != null) {
                result.add(current);
            }
        }
        return result;
View Full Code Here


   
    Iterator<AbstractPetriNetElementModel> i = this.editor.getModelProcessor().getElementContainer().getRootElements().iterator();
    ArrayList<String> idList = new ArrayList<String>();
   
    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

        for (int i = 0; i < nNumLists; ++i) {
            ArrayList<AbstractPetriNetElementModel> currentSequence = new ArrayList<AbstractPetriNetElementModel>();

            int nNumElementsInSequence = getIntInfo(nNumElementsCommand, i, 0);
            for (int j = 0; j < nNumElementsInSequence; ++j) {
                AbstractPetriNetElementModel element = getElementInfo(nElementNameCommand, i, j);
                if (element != null) {
                    currentSequence.add(element);
                }
            }
            sequences.add(currentSequence);
View Full Code Here

        return result;
    }

    private AbstractPetriNetElementModel getElementInfo(int nInfo, int nIndex, int nSubIndex) {
        String current = m_myWofLan.Info(m_netHandle, nInfo, nIndex, nSubIndex);
        AbstractPetriNetElementModel element = translateToNetObject(current);
        return element;
    }
View Full Code Here

        // Retrieve Woflan results immediately and store after some post-processing
        uncoveredPlaces.clear();
        Iterator<AbstractPetriNetElementModel> i = getListIterator(getIntInfo(m_myWofLan.InfoNofNotSCom, 0, 0),
                m_myWofLan.InfoNotSComNName);
        while (i.hasNext()) {
            AbstractPetriNetElementModel current = i.next();
            // Add only places to the uncovered list
            if (current.getType() == AbstractPetriNetElementModel.PLACE_TYPE) {
                uncoveredPlaces.add(current);
            }
        }

        m_sComponentsCalculated = true;
View Full Code Here

     
      Iterator<AbstractPetriNetElementModel> i = this.editor.getModelProcessor().getElementContainer().getRootElements().iterator();
     
     
      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);
                }

                else if(availableIdsTableModel.getValueAt(row,1).equals("1") && availableIdsTableModel.getValueAt(row,0).equals(simpleTransModel.getId())){
                  simpleTransModel.setHighlighted(true);
                }
                         
                          if(simpleTransModel.isHighlighted() == true){
                            highlightcounter++;
                          }
                       
                        }
View Full Code Here

        // Cut any hash sign that might exist
        if ((objectID != null) && (objectID.charAt(0) == '#')) {
            objectID = objectID.substring(1);
        }

        AbstractPetriNetElementModel current = ((objectID != null) ? elements.getElementById(objectID) : null);
        return current;
    }
View Full Code Here

    String[] selection = ((String)table.getValueAt(row,0)).split(",");

    Iterator<AbstractPetriNetElementModel> i = this.editor.getModelProcessor().getElementContainer().getRootElements().iterator();

    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

  private void clearHighlighting(IEditor editor, JTable table){

    Iterator<AbstractPetriNetElementModel> i = editor.getModelProcessor().getElementContainer().getRootElements().iterator();
   
    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);
                    }
                }
            }
    }
    table.clearSelection();
View Full Code Here

                            || (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;

                                    /*
                                     * 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);

                                        virtualTransition.setId(ID); // set HelpTransition's ID to Arc's ID
                                        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);
                                }
                                // There must at least be one token at the input side for
                                // the transition to be
                                // activated
                                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;
View Full Code Here

TOP

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

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.