merged.insert(edgeToAdd);
}
return;
}
// otherwise unpack via input signs
DerivationHistory history = alt.sign.getDerivationHistory();
Sign[] inputSigns = history.getInputs();
// base case: no inputs
if (inputSigns == null) {
merged.insert(alt); return;
}
// otherwise recursively unpack
Edge[] inputEdges = new Edge[inputSigns.length];
for (int i = 0; i < inputSigns.length; i++) {
inputEdges[i] = signMap.get(inputSigns[i]); // get input edge using signMap
unpack(inputEdges[i], unpacked);
}
// then make edges for new combos, and add to merged (if unseen)
Category resultCat = alt.sign.getCategory();
boolean lefthead = (alt.sign.getLexHead() == inputSigns[0].getLexHead());
List<Sign[]> altCombos = inputCombos(inputEdges, 0);
for (Sign[] combo : altCombos) {
Sign lexHead = (lefthead) ? combo[0].getLexHead() : combo[1].getLexHead();
Sign sign = Sign.createDerivedSignWithNewLF(resultCat, combo, history.getRule(), lexHead);
Edge edgeToAdd = (sign.equals(alt.sign))
? alt // use this alt for equiv sign
: edgeFactory.makeAltEdge(sign, alt); // otherwise make edge for new alt
merged.insert(edgeToAdd);
}