private void joinConcatenations(PBInstance instance)
{
SortedIntArrayList ids = new SortedIntArrayList();
CTTree tree = instance.getTree();
int terminalId, height;
CTNode node, parent;
List<PBLoc> lNew;
for (PBArg arg : instance.getArgs())
{
if (arg.isLabel(PBLib.PB_REL)) continue;
ids.clear();
for (PBLoc loc : arg.getLocs())
{
if (!loc.isType("") && !loc.isType(",")) return;
if (loc.height > 0) return;
ids.add(loc.terminalId);
}
lNew = new ArrayList<PBLoc>();
while (!ids.isEmpty())
{
terminalId = ids.get(0);
height = 0;
node = tree.getNode(terminalId, height);
while ((parent = node.getParent()) != null && !parent.isPTag(CTLib.PTAG_TOP) && UTHppc.isSubset(ids, parent.getSubTerminalIdSet()))
{
node = parent;
height++;
}
lNew.add(new PBLoc(terminalId, height, ","));
ids.removeAll(node.getSubTerminalIdSet());
}
if (lNew.size() < arg.getLocSize())
{
lNew.get(0).type = "";