Package org.woped.core.model.petrinet

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


      case AbstractViewEvent.GROUP:
        editor.getGraph().groupSelection();
        break;
      case AbstractViewEvent.OPEN_PROPERTIES:
        cell = editor.getGraph().getSelectionCell();
        AbstractPetriNetElementModel element = null;

        if (cell instanceof ArcModel && ((ArcModel) cell).isXORsplit(editor.getModelProcessor()))
        {
          new ArcPropertyEditor((JFrame) getMediator().getUi(), (Point)editor.getLastMousePosition(), (ArcModel) cell, editor);
        }
View Full Code Here


    public void drawNet(PetriNetModelProcessor processor)
    {
      for (Iterator<AbstractPetriNetElementModel> iter = processor.getElementContainer().getRootElements().iterator(); iter.hasNext();)
      {
        AbstractPetriNetElementModel element = (AbstractPetriNetElementModel) iter.next();
        GroupModel group = groupName(element, (element.getNameModel()));
        // The combination of element and element name plus all additional
        // cells (resources) is in general not ungroupable
        group.setUngroupable(false);
        if (element.getType() == AbstractPetriNetElementModel.TRANS_SIMPLE_TYPE ||
            element.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE ||
            element.getType() == AbstractPetriNetElementModel.SUBP_TYPE)
        {
          // Restore display of trigger element if present
          if (((TransitionModel) element).hasTrigger())
          {
            ParentMap pm = new ParentMap();
View Full Code Here

   * @param mec the ModelElementContainer to rotate all elements of
   */
  public void rotateView(ModelElementContainer mec) {
    Map<String, AbstractPetriNetElementModel> elements = new HashMap<String, AbstractPetriNetElementModel>();
    Iterator<String> elementsIter = mec.getIdMap().keySet().iterator();
    AbstractPetriNetElementModel element;
    int newX = 0, newY = 0, negX = 0, negY = 0;
   
    elements.putAll(mec.getElementsByType(AbstractPetriNetElementModel.PLACE_TYPE));
    elements.putAll(mec.getElementsByType(AbstractPetriNetElementModel.TRANS_SIMPLE_TYPE));
    elements.putAll(mec.getElementsByType(AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE));
    elements.putAll(mec.getElementsByType(AbstractPetriNetElementModel.SUBP_TYPE));
    elements.putAll(mec.getElementsByType(AbstractPetriNetElementModel.TRIGGER_TYPE));
    elements.putAll(mec.getElementsByType(AbstractPetriNetElementModel.GROUP_TYPE));
    elements.putAll(mec.getElementsByType(AbstractPetriNetElementModel.RESOURCE_TYPE));

    while (elementsIter.hasNext()) {
      element = elements.get(elementsIter.next());
      if (element != null) {
        // rotate elements
        element.setPosition(element.getY(), element.getX());

        // rotate names
        element.getNameModel().setPosition(element.getNameModel().getY(), element.getNameModel().getX());

        // rotate triggers and resources
        if (element instanceof TransitionModel) {
          TransitionModel tm = (TransitionModel) element;

View Full Code Here

   * @param moveX the value to move all elements right or left
   * @param moveY the value to move all elements up or down
   * @param mec the ModelElementContainer with all elements which have to been moved
   */
  private void moveAllElements(int moveX, int moveY, ModelElementContainer mec) {
    AbstractPetriNetElementModel element;
    ArcModel arc;
    for (String elementId : mec.getIdMap().keySet()) {
      element = mec.getElementById(elementId);
      if (element != null) {
        // move element
        element.setPosition(element.getX() + moveX, element.getY() + moveY);

        // move element�s name
        element.getNameModel().setPosition(element.getNameModel().getX() + moveX,
            element.getNameModel().getY() + moveY);

        // move triggers and resources (if existing)
        if (element instanceof TransitionModel) {
          TransitionModel tm = (TransitionModel) element;

View Full Code Here

   */
  public boolean createModel(ModelElementContainer container)
  {
    if (container.getRootElements().isEmpty())
      return false;
    AbstractPetriNetElementModel e = (AbstractPetriNetElementModel) container
        .getRootElements().get(0);
    return this.createModel(e, container);
  }
View Full Code Here

        .getSourceElements(e.getId());
    Collection<AbstractPetriNetElementModel> list = map.values();
    Iterator<AbstractPetriNetElementModel> iter = list.iterator();
    while (iter.hasNext())
    {
      AbstractPetriNetElementModel tmp = iter.next();
      if (AbstractPetriNetElementModel.class.isInstance(tmp))
      {
        if (!this.createModel((AbstractPetriNetElementModel) tmp, con))
          return false;
        AbstractElement<?> abs = this
            .get_registrated_element((AbstractPetriNetElementModel) tmp);

        if (abs == null)
          return false;
        if (!abs.add_post_object(element))
          return false;
        if (!element.add_pre_object(abs))
          return false;
      }
    }

    list = con.getTargetElements(e.getId()).values();
    iter = list.iterator();
    while (iter.hasNext())
    {
      AbstractPetriNetElementModel tmp = iter.next();
      if (AbstractPetriNetElementModel.class.isInstance(tmp))
      {
        if (!this.createModel((AbstractPetriNetElementModel) tmp, con))
          return false;
        AbstractElement<?> abs = this
View Full Code Here

        String[] param = { "", "", "" };
        Iterator<AbstractPetriNetElementModel> transes = (mec.getElementsByType(AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE)).values()
                .iterator();
        IQualanalysisService qualanService = QualAnalysisServiceFactory.createNewQualAnalysisService(editor);
        Iterator<AbstractPetriNetElementModel> places = qualanService.getPlaces().iterator();
        AbstractPetriNetElementModel end = (AbstractPetriNetElementModel) qualanService.getSinkPlaces().iterator().next();

        while (transes.hasNext()) {
            AbstractPetriNetElementModel trans = (AbstractPetriNetElementModel) transes.next();
            Map<String, Object> outArcs = mec.getOutgoingArcs(trans.getId());
            int sum = 0;
            for (Object v : outArcs.values()) {
                double p = ((ArcModel) v).getProbability();
                sum += (Double.valueOf(p * 100)).intValue();
            }

            int type = ((OperatorTransitionModel) trans).getOperatorType();
            if ((type == OperatorTransitionModel.XOR_SPLIT_TYPE || type == OperatorTransitionModel.XOR_SPLITJOIN_TYPE || type == OperatorTransitionModel.ANDJOIN_XORSPLIT_TYPE)
                    & sum != 100) {
                branchingOk = false;
                param[0] = Messages.getString("QuantAna.Transition");
                param[1] = trans.getNameValue();
                param[2] = sum + "";
            }
        }

        while (places.hasNext()) {
            AbstractPetriNetElementModel place = (AbstractPetriNetElementModel) places.next();
            if (!place.equals(end)) {
                Map<String, Object> outArcs = mec.getOutgoingArcs(place.getId());
                int sum = 0;
                for (Object v : outArcs.values()) {
                    double p = ((ArcModel) v).getProbability();
                    sum += (Double.valueOf(p * 100)).intValue();
                }

                if (outArcs.size() > 1 && sum != 100) {
                    branchingOk = false;
                    param[0] = Messages.getString("QuantAna.Place");
                    param[1] = place.getNameValue();
                    param[2] = sum + "";
                }
            }
        }
        if (branchingOk) {
View Full Code Here

  private void clearAllHighlighting(){

    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

    removeOnlyElement(id);

  }

  public void removeOnlyElement(Object id) {
    AbstractPetriNetElementModel element = getElementById(id);
    // The element is no longer owned by anybody
    if (element!=null) element.removeOwningContainer(this);
    getIdMap().remove(id);
    LoggerManager.debug(Constants.CORE_LOGGER, "Element (ID:" + id
        + ") deleted.");
  }
View Full Code Here

      Iterator<String> refIter = ((Map<String, Object>) getIdMap().get(id)).keySet().iterator();
      Map<String, AbstractPetriNetElementModel> targetMap = new HashMap<String, AbstractPetriNetElementModel>();
      while (refIter.hasNext()) {
        Object arc = ((Map<String, Object>) getIdMap().get(id)).get(refIter.next());
        if (arc instanceof ArcModel) {
          AbstractPetriNetElementModel aCell = (AbstractPetriNetElementModel) ((DefaultPort) ((ArcModel) arc)
              .getTarget()).getParent();
          targetMap.put(aCell.getId(), aCell);
        }
      }
      return targetMap;
    } else {
      return 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.