public static PredictionContext mergeRoot(SingletonPredictionContext a,SingletonPredictionContext b,boolean rootIsWildcard){if ( rootIsWildcard ) {if ( a == EMPTY ) return EMPTY;  if ( b == EMPTY ) return EMPTY;  }else {if ( a == EMPTY && b == EMPTY ) return EMPTY; if ( a == EMPTY ) { int[] payloads = {b.returnState, EMPTY_RETURN_STATE};PredictionContext[] parents = {b.parent, null};PredictionContext joined =new ArrayPredictionContext(parents, payloads);return joined;}if ( b == EMPTY ) { int[] payloads = {a.returnState, EMPTY_RETURN_STATE};PredictionContext[] parents = {a.parent, null};PredictionContext joined =new ArrayPredictionContext(parents, payloads);return joined;}}return null;}

public static PredictionContext MergeRoot(SingletonPredictionContext a,SingletonPredictionContext b,bool rootIsWildcard){if (rootIsWildcard){if (a == PredictionContext.EMPTY)return PredictionContext.EMPTY;  if (b == PredictionContext.EMPTY)return PredictionContext.EMPTY;  }else {if (a == EMPTY && b == EMPTY) return EMPTY; if (a == EMPTY){ int[] payloads = { b.returnState, EMPTY_RETURN_STATE };PredictionContext[] parents = { b.parent, null };PredictionContext joined =new ArrayPredictionContext(parents, payloads);return joined;}if (b == EMPTY){ int[] payloads = { a.returnState, EMPTY_RETURN_STATE };PredictionContext[] parents = { a.parent, null };PredictionContext joined =new ArrayPredictionContext(parents, payloads);return joined;}}return null;}
