Examples of ArcModel


Examples of org.woped.core.model.ArcModel

    }
 
   
  private ArcType initArc(ArcType iArc, ArcModel outerArc, ArcModel innerArc)
    {
        ArcModel useArc = innerArc == null ? outerArc : innerArc;
        // inscription
        initNodeName(iArc.addNewInscription(), useArc);
       
        this.arcCounter++;
       
        // attr. id
//        iArc.setId(outerArc.getId());
        // For the webservice the arc id is not important. To avoid errors because of two same arc numbers, a simple arc counter
        // variable is used.
        iArc.setId("a" + this.arcCounter);
        // attr. source
        iArc.setSource(useArc.getSourceId());
       
        // attr. target
        iArc.setTarget(useArc.getTargetId());
      
        return iArc;
    }
View Full Code Here

Examples of org.woped.core.model.ArcModel

    //! inner transition container and would be overwritten which results in a broken net
    protected String getNextFreeArcID(PetriNetModelProcessor processor)
    {
    // Connect the new source object to our IN transition
      String nextArcId = null;
    ArcModel exists = null;
    do
    {   
      nextArcId = processor.getNexArcId();
      exists = getSimpleTransContainer().getArcById(nextArcId);
    } while (exists!=null);
View Full Code Here

Examples of org.woped.core.model.ArcModel

        // To sort out duplicates, we create a set
        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());
            // Remember either source or target if it is a transition
            // Please note that one special condition of petri nets is that
            // a transition is never directly connected to another transition
            // so either source or target may be a transition, never both
            if (currentTargetModel.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE)
              connectedTransitions.add(currentTargetModel);
            else if (currentSourceModel.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE)
              connectedTransitions.add(currentSourceModel);
            else
            {
              // The current arc is not connected to any transition
              // We do not need to take care of any inner arcs
              // and instead store the currentArc itself
                initArc(iNet.addNewArc(), currentArc, null);
            }
            for (int i = 0; i < statusBars.length; i++)
                statusBars[i].nextStep();
        }
      // A transition can be a very complex construct consisting
      // of a lot more than just one primitive petri-net transition (e.g.
      // XOR Split, XOR Join, ...
      // When dumping the PNML structure we must create primitive petri-net
      // objects for applications that cannot read our tool specific
      // complex transitions
      // This is why all transitions store a map of primitive transitions
      // with (ID, Object-Reference) entries.
        // For all transitions connected to at least one arc we will
        // dump the internal arcs now instead of the (previously ignored) visible arcs
        Iterator<AbstractPetriNetElementModel> currentTransition = connectedTransitions.iterator();
        while (currentTransition.hasNext())
        {
          OperatorTransitionModel currentConnectedModel = (OperatorTransitionModel)currentTransition.next();
          Iterator<String> innerArcIter = currentConnectedModel.getSimpleTransContainer().getArcMap().keySet().iterator();
          while (innerArcIter.hasNext())
          {
               // Dump all inner arcs of connected transitions
            ArcModel currentInnerArc = (ArcModel) currentConnectedModel.getSimpleTransContainer().getArcMap().get(innerArcIter.next());
            // Find outer arc corresponding to inner arc
            // (carries graphics information)
            ArcModel currentOuterArc = null;
            if (elementContainer.getElementById(currentInnerArc.getSourceId())!=null)
            {
              currentOuterArc = elementContainer.findArc(currentInnerArc.getSourceId(),
                  currentConnectedModel.getId());
            }
View Full Code Here

Examples of org.woped.core.model.ArcModel

    //! @param innerArc specifies the (optional) inner arc to be dumped
    //!        If !=null, this arc will be dumped to PNML, together with the graphics
    //!        information of the specified outerArc
    private ArcType initArc(ArcType iArc, ArcModel outerArc, ArcModel innerArc)
    {
        ArcModel useArc = innerArc == null ? outerArc : innerArc;
        // inscription
        initNodeName(iArc.addNewInscription(), useArc);
        // graphics
        initArcGraphics(iArc.addNewGraphics(), outerArc);
        // attr. id
        iArc.setId(outerArc.getId());
        // attr. source
        iArc.setSource(useArc.getSourceId());
        if (ConfigurationManager.getConfiguration().isExportToolspecific())
        {
            ArcToolspecificType iArcTool = iArc.addNewToolspecific();
            iArcTool.setTool("WoPeD");
            iArcTool.setVersion("1.0");
            if (outerArc.isRoute())
                iArcTool.setRoute(true);
            iArcTool.setProbability(outerArc.getProbability());
            iArcTool.setDisplayProbabilityOn(outerArc.isDisplayOn());
            PositionType probPos = iArcTool.addNewDisplayProbabilityPosition();
            Point2D probPosPoint = outerArc.getLabelPosition();
            probPos.setX(BigDecimal.valueOf(probPosPoint.getX()));
            probPos.setY(BigDecimal.valueOf(probPosPoint.getY()));

            iArcTool.setDisplayProbabilityPosition(probPos);
            // toolspecific
            for (short i = 0; i < outerArc.getUnknownToolSpecs().size(); i++)
            {
                iArc.addNewToolspecific();
                if (outerArc.getUnknownToolSpecs().get(i) instanceof ToolspecificType)
                {
                    iArc.setToolspecificArray(iArc.getToolspecificArray().length - 1, (ArcToolspecificType) outerArc.getUnknownToolSpecs().get(i));
                }
            }
        }
        // attr. target
        iArc.setTarget(useArc.getTargetId());
        LoggerManager.debug(Constants.FILE_LOGGER, "   ... Arc (ID:" + useArc.getId() + "( " + useArc.getSourceId() + " -> " + useArc.getTargetId() + ") set");

        return iArc;
    }
View Full Code Here

Examples of org.woped.core.model.ArcModel

    processor.setElementContainer(currentContainer);

    for (int i = 0; i < arcs.length; i++) {
      AbstractPetriNetElementModel currentSourceModel = null;
      AbstractPetriNetElementModel currentTargetModel = null;
      ArcModel arc = null;

      try {
        currentSourceModel = (AbstractPetriNetElementModel) currentContainer
            .getElementById(arcs[i].getSource());
        currentTargetModel = (AbstractPetriNetElementModel) currentContainer
            .getElementById(arcs[i].getTarget());
        String tempID;

        if (ConfigurationManager.getConfiguration()
            .isImportToolspecific()) {
          try {
            if (currentTargetModel == null
                && currentSourceModel != null) {
              // if the current arcs target is an operator this
              // block is executed
              if (arcs[i].getTarget().indexOf(
                  OperatorTransitionModel.INNERID_SEPERATOR) != 0) {
                tempID = arcs[i]
                    .getTarget()
                    .substring(
                        0,
                        arcs[i]
                            .getTarget()
                            .indexOf(
                                OperatorTransitionModel.OPERATOR_SEPERATOR_TRANSITION));
              } else {
                tempID = arcs[i]
                    .getTarget()
                    .substring(
                        0,
                        arcs[i]
                            .getTarget()
                            .indexOf(
                                OperatorTransitionModel.INNERID_SEPERATOR_OLD));
              }
              if (isOperator(currentContainer, tempID)) {
                String sourceId = arcs[i].getSource();
                String targetId = tempID;
                arc = processor.createArc(arcs[i].getId(),
                    sourceId, targetId, new Point2D[0],
                    true);
              }
            }
            if (currentSourceModel == null
                && currentTargetModel != null) {
              // if the current arcs source is an operator this
              // block is executed
              if (arcs[i].getSource().indexOf(
                  OperatorTransitionModel.INNERID_SEPERATOR) != 0) {
                tempID = arcs[i]
                    .getSource()
                    .substring(
                        0,
                        arcs[i]
                            .getSource()
                            .indexOf(
                                OperatorTransitionModel.OPERATOR_SEPERATOR_TRANSITION));
              } else {
                tempID = arcs[i]
                    .getSource()
                    .substring(
                        0,
                        arcs[i]
                            .getSource()
                            .indexOf(
                                OperatorTransitionModel.INNERID_SEPERATOR_OLD));
              }

              if (isOperator(currentContainer, tempID)) {
                String sourceId = tempID;
                String targetId = arcs[i].getTarget();
                arc = processor.createArc(arcs[i].getId(),
                    sourceId, targetId, new Point2D[0],
                    true);
              }
            }
            if (currentTargetModel != null
                && currentSourceModel != null) {
              // in the easiest case if the imported arc isn't
              // connected to an operator this block is executed
              String sourceId = arcs[i].getSource();
              String targetId = arcs[i].getTarget();
              arc = processor.createArc(arcs[i].getId(),
                  sourceId, targetId, new Point2D[0], true);
            }
            if (arc != null) {
              // Check whether we actually have an arc. If not, it
              // does not make sense
              // to import any tool-specific information.
              // Note that internal arcs with no connection to any
              // outer nodes
              // will not be imported, they will be implicitly
              // re-generated,
              // e.g. XOR Split-Join
              // Import toolspecific information for the arc
              for (int j = 0; j < arcs[i].getToolspecificArray().length; j++) {
                if ((arcs[i].getToolspecificArray(j).getTool() != null)
                    && (arcs[i].getToolspecificArray(j)
                        .getTool().equals("WoPeD"))) {
                  if (arcs[i].getToolspecificArray(j)
                      .isSetRoute()
                      && arcs[i].getToolspecificArray(j)
                          .getRoute())
                    arc.setRoute(true);
                  if (arcs[i].getToolspecificArray(j)
                      .isSetProbability())
                    arc.setProbability(arcs[i]
                        .getToolspecificArray(j)
                        .getProbability());
                  if (arcs[i].getToolspecificArray(j)
                      .isSetDisplayProbabilityOn())
                    arc.setDisplayOn(arcs[i]
                        .getToolspecificArray(j)
                        .getDisplayProbabilityOn());
                  if (arcs[i].getToolspecificArray(j)
                      .isSetDisplayProbabilityPosition()) {
                    Point location = new Point(
                        arcs[i]
                            .getToolspecificArray(j)
                            .getDisplayProbabilityPosition()
                            .getX().intValue(),
                        arcs[i]
                            .getToolspecificArray(j)
                            .getDisplayProbabilityPosition()
                            .getY().intValue());
                    arc.setLabelPosition(location);
                  }
                } else {
                  arc.addUnknownToolSpecs(arcs[i]
                      .getToolspecificArray(j));
                }
              }
            }
          } catch (Exception e) {
            warnings
                .add("- ARC LOST INFORMATION ("
                    + arcs[i].getId()
                    + "): Exception while importing lesser important information.");
          }
        } else {
          // if toolspecific import is disabled then import the arc
          // "as is" (and don't replace transitions with toolspecific
          // operators)
          String sourceId = arcs[i].getSource();
          String targetId = arcs[i].getTarget();
          arc = processor.createArc(arcs[i].getId(), sourceId,
              targetId, new Point2D[0], true);
        }
        if (arcs[i].isSetGraphics() && arc != null) {
          // Create two standard points that need to be always present
          // When created using the editor, those points are added
          // automatically
          // by the view
          // but if we want to restore arc points from the PNML file
          // we have to
          // add those points manually
          arc.addPoint(arc.getAttributes().createPoint(10, 10));
          arc.addPoint(arc.getAttributes().createPoint(20, 20));

          for (int j = 0; j < arcs[i].getGraphics()
              .getPositionArray().length; j++) {
            arc.addPoint(new Point2D.Double(arcs[i].getGraphics()
                .getPositionArray(j).getX().doubleValue(),
                arcs[i].getGraphics().getPositionArray(j)
                    .getY().doubleValue()), j + 1);
          }
        }
View Full Code Here

Examples of org.woped.core.model.ArcModel

          if (modelToArrange.dummyTarget.hierarchy
              - modelToArrange.dummySource.hierarchy > 2) {
            xPosition = (int) (xOffset + modelToArrange.hierarchy
                * ixIntervall);
            yPosition = (int) (modelToArrange.yCoordinate * iyIntervall);
            ArcModel arc = this.getArc(modelToArrange.dummySource,
                modelToArrange.dummyTarget);
            Point addArcPoint = new Point(xPosition + 20,
                yPosition + 20);
            arc.addPoint(addArcPoint, arc.getPoints().length - 1);
          }
        }
      }
    }
    this.turnCycleArcs();// back to cycles
View Full Code Here

Examples of org.woped.core.model.ArcModel

   *
   */
   private void gettingElements(HashMap<String, SGYElement> vertices) {
    HashMap<String, SGYElement> potentialSources;
    AbstractPetriNetElementModel ele;
    ArcModel arc;
    String sSource, sTarget;
    ModelElementContainer mec = editor.getModelProcessor()
        .getElementContainer();

    // getting Elements and Arcs
    for (String elementId : mec.getIdMap().keySet()) {
      ele = mec.getElementById(elementId);
      selectElements.add(ele.getParent());
      if (lineType != 2) {
        if (ele instanceof TransitionModel) {
          TransitionModel transitionModel = (TransitionModel) ele;
          if (transitionModel.hasTrigger()) {
            lineType = 1;
          }
          if (transitionModel.hasResource()) {
            lineType = 2;
          }
        }
      }
      vertices.put(ele.getId(), new SGYElement(ele));
    }

    // building relationships, defines the source
    potentialSources = (HashMap<String, SGYElement>) vertices.clone();
    for (String arcId : mec.getArcMap().keySet()) {
      arc = mec.getArcById(arcId);
      selectElements.add(arc);
      sSource = null;
      sTarget = null;
      if (arc != null) {
        sSource = arc.getSourceId();
        sTarget = arc.getTargetId();
      }
      if (vertices.containsKey(sSource) && vertices.containsKey(sTarget)) {
        vertices.get(sSource).children.add(vertices.get(sTarget));
        vertices.get(sTarget).parents.add(vertices.get(sSource));
        vertices.get(sSource).arcsOut.add(arc);
View Full Code Here

Examples of org.woped.core.model.ArcModel

 
  /**
   * Removes all inner Arcpoints
   */
  private void removeArcPoints() {
    ArcModel arc;
    for (String arcId : this.editor.getModelProcessor()
        .getElementContainer().getArcMap().keySet()) {
      arc = this.editor.getModelProcessor().getElementContainer()
          .getArcById(arcId);
      if (arc != null) {
        Point2D[] arrayArcPoints = arc.getPoints();
        if (arrayArcPoints.length > 2) {
          for (int i = 1; i < arrayArcPoints.length - 1; i++) {
            Point2D singleArcPoint = arrayArcPoints[i];
            arc.removePoint(singleArcPoint);
          }
        }
      }
    }
  }
View Full Code Here

Examples of org.woped.core.model.ArcModel

   *            sourceID of the arc
   * @param targetID
   *            targetID of the arc
   */
  private ArcModel getArc(SGYElement source, SGYElement target) {
    ArcModel arc = null;
    for (String arcId : this.editor.getModelProcessor()
        .getElementContainer().getArcMap().keySet()) {
      arc = this.editor.getModelProcessor().getElementContainer()
          .getArcById(arcId);
      if (arc != null) {
        if (arc.getSourceId().equals(source.editorElement.getId())
            && arc.getTargetId().equals(
                target.editorElement.getId()))
          break;
      }
    }
    return arc;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.