Program: 42233
Project: 42233
Buggy source:
/** 
 * Computes the union of <code>sst1</code> and <code>sst2</code> as a new SST
 */
@SuppressWarnings("String_Node_Str") public static <P1,F1,S1>SST<P1,F1,S1> union(SST<P1,F1,S1> sst1,SST<P1,F1,S1> sst2,BooleanAlgebraSubst<P1,F1,S1> ba){
  if (sst1.isEmpty && sst2.isEmpty)   return getEmptySST(ba);
  if (sst1.isEmpty)   return (SST<P1,F1,S1>)sst2.clone();
  if (sst2.isEmpty)   return (SST<P1,F1,S1>)sst1.clone();
  Collection<SSTMove<P1,F1,S1>> transitions=new ArrayList<SSTMove<P1,F1,S1>>();
  Map<Integer,OutputUpdate<P1,F1,S1>> outputFunction=new HashMap<Integer,OutputUpdate<P1,F1,S1>>();
  Integer initialState;
  Integer numberOfVariables;
  int offSet=sst1.maxStateId + 2;
  initialState=sst1.maxStateId + offSet;
  Integer varRenameSst1=0;
  Integer varRenameSst2=0;
  numberOfVariables=Math.max(sst1.variableCount,sst2.variableCount);
  for (  SSTInputMove<P1,F1,S1> t : sst1.getInputMovesFrom(sst1.states)) {
    FunctionalVariableUpdate<P1,F1,S1> variableUpdate=t.variableUpdate.renameVars(varRenameSst1).liftToNVars(numberOfVariables);
    SSTInputMove<P1,F1,S1> newMove=new SSTInputMove<P1,F1,S1>(t.from,t.to,t.guard,variableUpdate);
    transitions.add(newMove);
  }
  for (  SSTEpsilon<P1,F1,S1> t : sst1.getEpsilonMovesFrom(sst1.states)) {
    SimpleVariableUpdate<P1,F1,S1> variableUpdate=t.variableUpdate.renameVars(varRenameSst1).liftToNVars(numberOfVariables);
    SSTEpsilon<P1,F1,S1> newMove=new SSTEpsilon<P1,F1,S1>(t.from,t.to,variableUpdate);
    transitions.add(newMove);
  }
  for (  SSTInputMove<P1,F1,S1> t : sst2.getInputMovesFrom(sst2.states)) {
    FunctionalVariableUpdate<P1,F1,S1> variableUpdate=t.variableUpdate.renameVars(varRenameSst2).liftToNVars(numberOfVariables);
    SSTInputMove<P1,F1,S1> newMove=new SSTInputMove<P1,F1,S1>(t.from + offSet,t.to + offSet,t.guard,variableUpdate);
    transitions.add(newMove);
  }
  for (  SSTEpsilon<P1,F1,S1> t : sst2.getEpsilonMovesFrom(sst2.states)) {
    SimpleVariableUpdate<P1,F1,S1> variableUpdate=t.variableUpdate.renameVars(varRenameSst2).liftToNVars(numberOfVariables);
    SSTEpsilon<P1,F1,S1> newMove=new SSTEpsilon<P1,F1,S1>(t.from + offSet,t.to + offSet,variableUpdate);
    transitions.add(newMove);
  }
  ArrayList<List<ConstantToken<P1,F1,S1>>> resUpdate=new ArrayList<List<ConstantToken<P1,F1,S1>>>();
  for (int i=0; i < numberOfVariables; i++)   resUpdate.add(new ArrayList<ConstantToken<P1,F1,S1>>());
  SSTEpsilon<P1,F1,S1> newMove1=new SSTEpsilon<P1,F1,S1>(initialState,sst1.initialState,new SimpleVariableUpdate<P1,F1,S1>(resUpdate));
  transitions.add(newMove1);
  SSTEpsilon<P1,F1,S1> newMove2=new SSTEpsilon<P1,F1,S1>(initialState,sst2.initialState + offSet,new SimpleVariableUpdate<P1,F1,S1>(resUpdate));
  transitions.add(newMove2);
  for (  Integer state : sst1.getFinalStates())   outputFunction.put(state,sst1.outputFunction.get(state).renameVars(varRenameSst1));
  for (  Integer state : sst2.getFinalStates())   outputFunction.put(state + offSet,sst2.outputFunction.get(state).renameVars(varRenameSst2));
  return MkSST(transitions,initialState,numberOfVariables,outputFunction,ba);
}

Fixed version (ground truth):
/** 
 * Computes the union of <code>sst1</code> and <code>sst2</code> as a new SST
 */
@SuppressWarnings("String_Node_Str") public static <P1,F1,S1>SST<P1,F1,S1> union(SST<P1,F1,S1> sst1,SST<P1,F1,S1> sst2,BooleanAlgebraSubst<P1,F1,S1> ba){
  if (sst1.isEmpty && sst2.isEmpty)   return getEmptySST(ba);
  if (sst1.isEmpty)   return (SST<P1,F1,S1>)sst2.clone();
  if (sst2.isEmpty)   return (SST<P1,F1,S1>)sst1.clone();
  Collection<SSTMove<P1,F1,S1>> transitions=new ArrayList<SSTMove<P1,F1,S1>>();
  Map<Integer,OutputUpdate<P1,F1,S1>> outputFunction=new HashMap<Integer,OutputUpdate<P1,F1,S1>>();
  Integer initialState;
  Integer numberOfVariables;
  int offSet=sst1.maxStateId + 2;
  initialState=sst1.maxStateId + 1;
  Integer varRenameSst1=0;
  Integer varRenameSst2=0;
  numberOfVariables=Math.max(sst1.variableCount,sst2.variableCount);
  for (  SSTInputMove<P1,F1,S1> t : sst1.getInputMovesFrom(sst1.states)) {
    FunctionalVariableUpdate<P1,F1,S1> variableUpdate=t.variableUpdate.renameVars(varRenameSst1).liftToNVars(numberOfVariables);
    SSTInputMove<P1,F1,S1> newMove=new SSTInputMove<P1,F1,S1>(t.from,t.to,t.guard,variableUpdate);
    transitions.add(newMove);
  }
  for (  SSTEpsilon<P1,F1,S1> t : sst1.getEpsilonMovesFrom(sst1.states)) {
    SimpleVariableUpdate<P1,F1,S1> variableUpdate=t.variableUpdate.renameVars(varRenameSst1).liftToNVars(numberOfVariables);
    SSTEpsilon<P1,F1,S1> newMove=new SSTEpsilon<P1,F1,S1>(t.from,t.to,variableUpdate);
    transitions.add(newMove);
  }
  for (  SSTInputMove<P1,F1,S1> t : sst2.getInputMovesFrom(sst2.states)) {
    FunctionalVariableUpdate<P1,F1,S1> variableUpdate=t.variableUpdate.renameVars(varRenameSst2).liftToNVars(numberOfVariables);
    SSTInputMove<P1,F1,S1> newMove=new SSTInputMove<P1,F1,S1>(t.from + offSet,t.to + offSet,t.guard,variableUpdate);
    transitions.add(newMove);
  }
  for (  SSTEpsilon<P1,F1,S1> t : sst2.getEpsilonMovesFrom(sst2.states)) {
    SimpleVariableUpdate<P1,F1,S1> variableUpdate=t.variableUpdate.renameVars(varRenameSst2).liftToNVars(numberOfVariables);
    SSTEpsilon<P1,F1,S1> newMove=new SSTEpsilon<P1,F1,S1>(t.from + offSet,t.to + offSet,variableUpdate);
    transitions.add(newMove);
  }
  ArrayList<List<ConstantToken<P1,F1,S1>>> resUpdate=new ArrayList<List<ConstantToken<P1,F1,S1>>>();
  for (int i=0; i < numberOfVariables; i++)   resUpdate.add(new ArrayList<ConstantToken<P1,F1,S1>>());
  SSTEpsilon<P1,F1,S1> newMove1=new SSTEpsilon<P1,F1,S1>(initialState,sst1.initialState,new SimpleVariableUpdate<P1,F1,S1>(resUpdate));
  transitions.add(newMove1);
  SSTEpsilon<P1,F1,S1> newMove2=new SSTEpsilon<P1,F1,S1>(initialState,sst2.initialState + offSet,new SimpleVariableUpdate<P1,F1,S1>(resUpdate));
  transitions.add(newMove2);
  for (  Integer state : sst1.getFinalStates())   outputFunction.put(state,sst1.outputFunction.get(state).renameVars(varRenameSst1));
  for (  Integer state : sst2.getFinalStates())   outputFunction.put(state + offSet,sst2.outputFunction.get(state).renameVars(varRenameSst2));
  return MkSST(transitions,initialState,numberOfVariables,outputFunction,ba);
}