// {
// LOGGER.info("Skipping quickFindHSSRoute to test full HSS reduction to elementary HSS");
// return new ObjectArrayList(new Object[] { null });
// }
ObjectArrayList result = new ObjectArrayList(tiersCount);
ObjectArrayList structures = new ObjectArrayList();
OpenIntObjectHashMap verticesFromLastTiers = new OpenIntObjectHashMap();
fillVerticesFromLastTier(hss, structures, verticesFromLastTiers);
byte prevVertexTierKey = findIntersectionWithFirstTier(hss, result, structures, verticesFromLastTiers);
if (prevVertexTierKey == -1)
{
throw new AssertionError("There must be at least one non-empty same-name intersection of last-tier vertex with first-tier vertex of HSS");
}
for (int j = 1; j < tiersCount - 1; j++)
{
ObjectArrayList intersections = new ObjectArrayList();
ObjectArrayList targetVertices = new ObjectArrayList();
boolean allNotEmpty = true;
// Check bottomVertex1
for (int h = 0; h < hss.size(); h++)
{
IHyperStructure hs = (IHyperStructure) hss.get(h);
OpenIntObjectHashMap prevTier = (OpenIntObjectHashMap) hs.getTiers().get(j - 1);
IVertex prevTierVertex = (IVertex) prevTier.get(prevVertexTierKey);
OpenIntObjectHashMap nextTier = (OpenIntObjectHashMap) hs.getTiers().get(j);
IVertex bottomVertex1 = prevTierVertex.getBottomVertex1();
if (bottomVertex1 == null)
{
allNotEmpty = false;
break;
}
IVertex nextTierVertex = (IVertex) nextTier.get(bottomVertex1.getTripletValue().getTierKey());
if (nextTierVertex == null)
{
allNotEmpty = false;
break;
}
ICompactTripletsStructure clone = (ICompactTripletsStructure) ((ICompactTripletsStructure) structures.get(h)).clone();
clone.intersect(nextTierVertex.getCTS());
if (clone.isEmpty())
{
allNotEmpty = false;
break;
}
targetVertices.add(nextTierVertex);
intersections.add(clone);
}
allNotEmpty = allNotEmpty && forwardFilterPassed(hss, targetVertices, j, tiersCount, intersections, verticesFromLastTiers);
if (allNotEmpty)
{
// Intersection with bottomVertex1
OpenIntObjectHashMap prevTier = (OpenIntObjectHashMap) basicGraph.getTiers().get(j - 1);
IVertex prevTierVertex = (IVertex) prevTier.get(prevVertexTierKey);
IVertex vertex = prevTierVertex.getBottomVertex1();
result.add(vertex);
prevVertexTierKey = vertex.getTripletValue().getTierKey();
updateStructures(hss, structures, j, prevVertexTierKey);
continue;
}
intersections = new ObjectArrayList();
targetVertices = new ObjectArrayList();
allNotEmpty = true;
// Check bottomVertex2
for (int h = 0; h < hss.size(); h++)
{
IHyperStructure hs = (IHyperStructure) hss.get(h);
OpenIntObjectHashMap prevTier = (OpenIntObjectHashMap) hs.getTiers().get(j - 1);
IVertex prevTierVertex = (IVertex) prevTier.get(prevVertexTierKey);
OpenIntObjectHashMap nextTier = (OpenIntObjectHashMap) hs.getTiers().get(j);
IVertex bottomVertex2 = prevTierVertex.getBottomVertex2();
if (bottomVertex2 == null)
{
allNotEmpty = false;
break;
}
IVertex nextTierVertex = (IVertex) nextTier.get(bottomVertex2.getTripletValue().getTierKey());
if (nextTierVertex == null)
{
allNotEmpty = false;
break;
}
ICompactTripletsStructure clone = (ICompactTripletsStructure) ((ICompactTripletsStructure) structures.get(h)).clone();
clone.intersect(nextTierVertex.getCTS());
if (clone.isEmpty())
{
allNotEmpty = false;
break;
}
targetVertices.add(nextTierVertex);
intersections.add(clone);
}
allNotEmpty = allNotEmpty && forwardFilterPassed(hss, targetVertices, j, tiersCount, intersections, verticesFromLastTiers);