public Configuration next(String transition){
  if (transition.equals("SH")) {
    stack.push(queue.remove());
  }
 else   if (transition.equals("RE")) {
    stack.pop();
  }
 else   if (transition.startsWith("LA")) {
    Integer u=stack.pop();
    Integer v=queue.peek();
    String label=transition.substring(3);
    addDependency(new Dependency(v,u,label));
  }
 else   if (transition.startsWith("RA")) {
    Integer u=stack.peek();
    Integer v=queue.remove();
    stack.push(v);
    String label=transition.substring(3);
    addDependency(new Dependency(u,v,label));
  }
  return new Configuration(sentence,stack,queue,arcs);
}

public Configuration next ( String transition ) { if ( transition . equals ( "SH" ) ) { stack . push ( queue . remove ( ) ) ; } else if ( transition . equals ( "RE" ) ) { stack . pop ( ) ; } else if ( transition . startsWith ( "LA" ) ) { Integer u = stack . pop ( ) ; Integer v = queue . peek ( ) ; String label = transition . substring ( 3 ) ; addDependency ( new Dependency ( v , u , label ) ) ; } else if ( transition . startsWith ( "RA" ) ) { Integer u = stack . peek ( ) ; Integer v = queue . remove ( ) ; stack . push ( v ) ; String label = transition . substring ( 3 ) ; addDependency ( new Dependency ( u , v , label ) ) ; } return new Configuration ( sentence , stack , queue , arcs ) ; }
computes the next configuration given a transition .
