public void addChild(NodeCollection childCollection,CommonNodeMaintainer nodeMaintainer){
  if (children.isEmpty()) {
    children.add(childCollection);
    haltStepNode.setToNode(childCollection.getInitStepNode());
  }
 else {
    children.add(childCollection);
    if (forkNode == null) {
      forkNode=ForkNode.getForkNode(id,children,nodeMaintainer);
      for (      NodeCollection child : children) {
        forkNode.addToNode(child.getInitStepNode());
      }
    }
 else {
      forkNode.addToNode(childCollection.getInitStepNode());
    }
    haltStepNode.setToNode(forkNode);
  }
}

public void addChild ( NodeCollection childCollection , CommonNodeMaintainer nodeMaintainer ) { if ( children . isEmpty ( ) ) { children . add ( childCollection ) ; haltStepNode . setToNode ( childCollection . getInitStepNode ( ) ) ; } else { children . add ( childCollection ) ; if ( forkNode == null ) { forkNode = ForkNode . getForkNode ( id , children , nodeMaintainer ) ; for ( NodeCollection child : children ) { forkNode . addToNode ( child . getInitStepNode ( ) ) ; } } else { forkNode . addToNode ( childCollection . getInitStepNode ( ) ) ; } haltStepNode . setToNode ( forkNode ) ; } }
populating childcollection when a process has only one child process , the child is added to childcollection and haltstepnode of the current process is directed to beginnode of the childnode . in case of multiple children , all the child processes are traversed one by one and are added to childcollection . multiple child processes are handled using something called the fork control node .
