Package org.woped.core.model.petrinet

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


                    .getNameValue(), makeOriginId(pm.getId())));
        }

        // loops over all transitions and set predecessors and successors
        while (iterTransition.hasNext()) {
          AbstractPetriNetElementModel trans = iterTransition.next();
          AbstractPetriNetElementModel opTrans = null;
          tm = (TransitionModel) trans;
            successors = NetAlgorithms.getDirectlyConnectedNodes(tm, NetAlgorithms.connectionTypeOUTBOUND);
            predecessors = NetAlgorithms.getDirectlyConnectedNodes(tm, NetAlgorithms.connectionTypeINBOUND);
            ModelElementContainer mec;
            AbstractPetriNetElementModel elem = null;
            Iterator<ModelElementContainer> ownerIterator = trans.getOwningContainersIterator();
            while (ownerIterator.hasNext()) {
              mec = ownerIterator.next();
              elem = mec.getOwningElement();
              if (elem != null && elem.getType() == TransitionModel.TRANS_OPERATOR_TYPE) {
                opTrans = (TransitionModel)elem;
                break;
              }
            }
        
View Full Code Here


        try {
            LoggerManager.debug(TPN_Logger, "********** START TPN EXPORT **********");

            FileWriter fos = new FileWriter(new File(fileName));
            Iterator<AbstractPetriNetElementModel> rootIter = net2save.getElementContainer().getRootElements().iterator();
            AbstractPetriNetElementModel currentModel;

            while (rootIter.hasNext()) {

                currentModel = (AbstractPetriNetElementModel) rootIter.next();

                if (currentModel.getType() == AbstractPetriNetElementModel.PLACE_TYPE) {
                    fos.write("place #");
                    if (ConfigurationManager.getConfiguration().isTpnSaveElementAsName()) {
                        String nameValue = currentModel.getNameValue();
                        if (nameValue != null) {
                            fos.write(nameValue.replaceAll("[[\\W]&&[\\S|\\s]]", "") + "_");
                        }
                    }
                    fos.write(currentModel.getId());

                    int numtoken = ((PlaceModel) currentModel).getTokenCount();
                    if (numtoken > 0) {
                        fos.write(" init " + numtoken);
                    }

                    fos.write(";\n");

                } else
                    if ((currentModel.getType() == AbstractPetriNetElementModel.TRANS_SIMPLE_TYPE)
                            || (currentModel.getType() == AbstractPetriNetElementModel.SUBP_TYPE)) {
                        fos.write(getLine4Transition(currentModel.getNameValue(), currentModel, net2save
                                .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

            line += name.replaceAll("[[\\W]&&[\\S|\\s]]", "") + "_";
        }
        line += currentModel.getId();

        // Input
        AbstractPetriNetElementModel tempPlace;
        line += " in";
        tempIter = container.getSourceElements(currentModel.getId()).keySet().iterator();
        while (tempIter.hasNext()) {
            tempPlace = (AbstractPetriNetElementModel) container.getElementById(tempIter.next());
            line += " #";
            // Should given name be appended to the transition ID ?
            // If so, check whether such a name exists and add
            String nameValue = tempPlace.getNameValue();
            if ((ConfigurationManager.getConfiguration().isTpnSaveElementAsName()) && (nameValue != null)) {
                line += nameValue.replaceAll("[[\\W]&&[\\S|\\s]]", "") + "_";
            }

            line += tempPlace.getId();
        }
        // Output

        line += " out";
        tempIter = container.getTargetElements(currentModel.getId()).keySet().iterator();
        while (tempIter.hasNext()) {
            tempPlace = (AbstractPetriNetElementModel) container.getElementById(tempIter.next());
            line += " #";
            // Should given name be appended to the transition ID ?
            // If so, check whether such a name exists and add
            String nameValue = tempPlace.getNameValue();
            if ((ConfigurationManager.getConfiguration().isTpnSaveElementAsName()) && (nameValue != null)) {
                line += nameValue.replaceAll("[[\\W]&&[\\S|\\s]]", "") + "_";
            }

            line += tempPlace.getId();
        }
        line += ";\n";

        return line;
    }
View Full Code Here

   *
   * @return Object
   */
  public String getSourceId() {
    DefaultPort port = ((DefaultPort) getSource());
    AbstractPetriNetElementModel pnme = ((AbstractPetriNetElementModel) port.getParent());
    return pnme.getId();
  }
View Full Code Here

     *
     * @param editor source object.
     */
    public LowLevelPetriNetWithTStarBuilder(IEditor editor) {
        super(editor);
        AbstractPetriNetElementModel tStar;
        tStar = sa.addTStar();
        createLowLevelPetriNet();
        sa.removeTStar(tStar);

    }
View Full Code Here

     * @return
     */
    public static AbstractPetriNetElementModel createModelElement(CreationMap map)
    {

        AbstractPetriNetElementModel modElement = null;
        if (map.getId() != null)
        {
            try
            {
                // Check basetype of Element
                if (map.getType() == AbstractPetriNetElementModel.PLACE_TYPE)
                {
                    // Creating a new ModelElement with
                    modElement = new PlaceModel(map);
                   
                    // Tokens
                    if (map.getTokens() > 0)
                      ((PlaceModel) modElement).setTokens(map.getTokens());
                   
                } else if (map.getType() == AbstractPetriNetElementModel.SUBP_TYPE)
                {
                    /* CREATING A SUBPROCESS */
                    modElement = new SubProcessModel(map);
                } else if (map.getType() == AbstractPetriNetElementModel.TRANS_SIMPLE_TYPE && map.getOperatorType() == -1)
                {
                    /* CREATING A SIMPLE TRANSITION */
                    modElement = new TransitionModel(map);
                } else if (map.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE)
                {
                    /* CREATING A AALST TRANSITION */
                  switch (map.getOperatorType())
                  {
                  case OperatorTransitionModel.XOR_SPLIT_TYPE:
                    modElement = new XORSplitOperatorTransitionModel(map);
                    break;
                  case OperatorTransitionModel.XOR_JOIN_TYPE:
                    modElement = new XORJoinOperatorTransitionModel(map);
                    break;
                  case OperatorTransitionModel.XOR_SPLITJOIN_TYPE:
                    modElement = new XORSplitJoinOperatorTransitionModel(map);
                    break;
                  case OperatorTransitionModel.AND_SPLIT_TYPE:
                    modElement = new ANDSplitOperatorTransitionModel(map);
                    break;
                  case OperatorTransitionModel.AND_JOIN_TYPE:
                    modElement = new ANDJoinOperatorTransitionModel(map);
                    break;
                  case OperatorTransitionModel.AND_SPLITJOIN_TYPE:
                    modElement = new ANDSplitJoinOperatorTransitionModel(map);
                    break;
                  case OperatorTransitionModel.ANDJOIN_XORSPLIT_TYPE:
                    modElement = new ANDJoinXORSplitOperatorTransitionModel(map);
                    break;
                  case OperatorTransitionModel.XORJOIN_ANDSPLIT_TYPE:
                    modElement = new XORJoinANDSplitOperatorTransitionModel(map);
                    break;
                  default:
                        LoggerManager.error(Constants.CORE_LOGGER, "Unknown Operator Type (" + map.getOperatorType() + ")");
                  }
                    // modElement.setId(id);
                    // create inital simple trans
                   ((OperatorTransitionModel) modElement).addNewSimpleTrans();
                    // ((OperatorTransitionModel)
                    // modElement).setInitalSimpleTrans(simpleTrans);
                }
                if (modElement != null)
                {
                    // add the DefaultPort as child to the DefaultGraphCell
                    PortCell port = new PortCell();
                    modElement.add(port);
                }
                return modElement;

            } catch (Exception ee)
            {
View Full Code Here

        ArrayList<List<AbstractPetriNetElementModel>> result = new ArrayList<List<AbstractPetriNetElementModel>>();
        while (handles.hasNext()) {
            List<AbstractPetriNetElementModel> current = handles.next();
            int listLength = current.size();
            if (listLength >= 2) {
                AbstractPetriNetElementModel first = current.get(0);
                AbstractPetriNetElementModel last = current.get(listLength - 1);
                current.clear();
                current.add(first);
                current.add(last);
                result.add(current);
            }
View Full Code Here

        ArrayList<List<AbstractPetriNetElementModel>> result = new ArrayList<List<AbstractPetriNetElementModel>>();
        while (handles.hasNext()) {
            List<AbstractPetriNetElementModel> current = handles.next();
            int listLength = current.size();
            if (listLength >= 2) {
                AbstractPetriNetElementModel first = current.get(0);
                AbstractPetriNetElementModel last = current.get(listLength - 1);
                current.clear();
                current.add(first);
                current.add(last);
                result.add(current);
            }
View Full Code Here

    }

    public Iterator<AbstractPetriNetElementModel> getListIterator(int nNumElements, int nElementNameCommand) {
        ArrayList<AbstractPetriNetElementModel> result = new ArrayList<AbstractPetriNetElementModel>();
        for (int i = 0; i < nNumElements; ++i) {
            AbstractPetriNetElementModel current = getElementInfo(nElementNameCommand, i, 0);
            if (current != null) {
                result.add(current);
            }
        }
        return result.iterator();
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

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.