コード例 #1
0
ファイル: YExternalNetElement.java プロジェクト: adamsmj/yawl
  public Object clone() throws CloneNotSupportedException {
    YExternalNetElement copy = (YExternalNetElement) super.clone();
    copy._net = _net.getCloneContainer();

    /* it may appear more natural to add the cloned
    net element into the cloned net in the net class, but when cloning a task with a remove
    set element that is not yet cloned it tries to recover by cloning those objects backwards
    through the postsets to an already cloned object.   If this backwards traversal sends the
    runtime stack back to the element that started this traversal you end up with an infinite loop.
    */
    copy._net.addNetElement(copy);

    if (_net.getCloneContainer().hashCode() != copy._net.hashCode()) {
      throw new RuntimeException();
    }

    copy._postsetFlows = new HashMap<String, YFlow>();
    copy._presetFlows = new HashMap<String, YFlow>();
    for (YFlow flow : _postsetFlows.values()) {
      String nextElmID = flow.getNextElement().getID();
      YExternalNetElement nextElemClone = copy._net.getNetElement(nextElmID);
      if (nextElemClone == null) {
        nextElemClone = (YExternalNetElement) flow.getNextElement().clone();
      }
      YFlow clonedFlow = new YFlow(copy, nextElemClone);
      clonedFlow.setEvalOrdering(flow.getEvalOrdering());
      clonedFlow.setIsDefaultFlow(flow.isDefaultFlow());
      clonedFlow.setXpathPredicate(flow.getXpathPredicate());
      clonedFlow.setDocumentation(flow.getDocumentation());
      copy.addPostset(clonedFlow);
    }
    return copy;
  }
コード例 #2
0
ファイル: FSTYrule.java プロジェクト: itiu/yawl-editor-zmq
  /**
   * Innermost method for a reduction rule. Implementation of the abstract method from superclass.
   *
   * @net YNet to perform reduction
   * @element an for consideration. returns a reduced YNet or null if a given net cannot be reduced.
   */
  public YNet reduceElement(YNet net, YExternalNetElement nextElement) {
    YNet reducedNet = net;
    if (nextElement instanceof YCondition) {
      YCondition condition = (YCondition) nextElement;
      Set postSet = condition.getPostsetElements();
      Set preSet = condition.getPresetElements();

      // \pre{p} = 1, \post{p} = 1
      if (preSet.size() == 1 && postSet.size() == 1) {
        YTask t = (YTask) preSet.toArray()[0];
        YTask u = (YTask) postSet.toArray()[0];
        Set preSetOfu = u.getPresetElements();
        Set postSetOfu = u.getPostsetElements();
        // t,u and p are not reset
        // u does not have reset arcs

        Set postSetOft = new HashSet(t.getPostsetElements());
        postSetOft.retainAll(postSetOfu);

        if (t.getSplitType() == YTask._AND
            && u.getSplitType() == YTask._AND
            && preSetOfu.size() == 1
            && u.getRemoveSet().isEmpty()
            && t.getCancelledBySet().isEmpty()
            && u.getCancelledBySet().isEmpty()
            && condition.getCancelledBySet().isEmpty()
            && (!checkReset(postSetOfu))
            && postSetOft.isEmpty()) {

          // set postflows from u to t

          Iterator postFlowIter = postSetOfu.iterator();
          while (postFlowIter.hasNext()) {
            YExternalNetElement next = (YExternalNetElement) postFlowIter.next();
            t.addPostset(new YFlow(t, next));
          }

          // remove condition from postset of t
          t.removePostsetFlow(new YFlow(condition, t));

          reducedNet.removeNetElement(condition);
          reducedNet.removeNetElement(u);

          t.addToYawlMappings(condition);
          t.addToYawlMappings(condition.getYawlMappings());
          t.addToYawlMappings(u);
          t.addToYawlMappings(u.getYawlMappings());

          return reducedNet;
        } // if nested
      } // if - size 1
    } // endif - condition

    return null;
  }
コード例 #3
0
ファイル: YExternalNetElement.java プロジェクト: adamsmj/yawl
 public String getProperID() {
   return _net.getSpecification().getURI() + "|" + super.getID();
 }
コード例 #4
0
ファイル: YExternalNetElement.java プロジェクト: adamsmj/yawl
 public void setID(String id) {
   String oldID = getID();
   super.setID(id);
   updateFlowMapsOnIdChange(oldID, id);
   _net.refreshNetElementIdentifier(oldID);
 }
コード例 #5
0
ファイル: YExternalNetElement.java プロジェクト: adamsmj/yawl
 private String preparseDocumentation() {
   if ((_documentation != null) && (_documentation.contains("${/"))) {
     return new YNetElementDocoParser(_net.getInternalDataDocument()).parse(_documentation);
   }
   return _documentation;
 }