Package com.microworkflow.process

Source Code of com.microworkflow.process.Fork

/*
*
*  Copyright (c) 2002, 2003 Dragos Manolescu (dam@micro-workflow.com)
*
*  See the LICENSE file for licensing information.
*/
package com.microworkflow.process;

import com.microworkflow.execution.Continuation;
import com.microworkflow.execution.ForkContinuation;

public class Fork extends CompositeActivity {
  protected JoinActivity join=null;
  Activity theJoin = new NullActivity();
 
  public Fork addBranch(Activity branch) {
    components.add(branch);
    return this;
  }

  public Continuation continuationWith(Continuation continuation) {
    ForkContinuation k = continuation.makeForkContinuation(this);
    if (join!=null) {
      join.setNumberOfBranches(components.size());
      theJoin = join;
    }
    k.resetState();
    return k;
  }

  public void setJoin(JoinActivity join) {
    this.join = join;
  }

  public void computeStateFor(Continuation k) {
    Continuation joinContinuation = theJoin.continuationWith(k.getNextContinuation());
    ((ForkContinuation)k).setBranches(getContinuationsForComponentsWith(joinContinuation));
 

}
TOP

Related Classes of com.microworkflow.process.Fork

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.