protected RDF3XIndexScan getIndex(final LeafNodePlan plan,
final BasicIndexScan indexScan,
final Collection<Variable> sortCriterium,
final Map<Variable, Literal> minima,
final Map<Variable, Literal> maxima) {
final RDF3XIndexScan index1 = new RDF3XIndexScan((OperatorIDTuple) null, plan.getTriplePatterns(), indexScan.getGraphConstraint(), minima, maxima, indexScan.getRoot());
// determine the collation order to be used to access the index during an index scan
int[] collationOrder1 = { -1, -1, -1 };
int i1 = 0;
for (int i = 0; i < 3; i++) {
if (!index1.getTriplePattern().iterator().next().getPos(i).isVariable()) {
collationOrder1[i1] = i;
i1++;
}
}
for (final Variable v : plan.getOrder()) {
collationOrder1[i1] = index1.getTriplePattern().iterator().next().getPos(v);
i1++;
}
collationOrder1 = fill(collationOrder1, i1);
final CollationOrder co1 = getCollationOrder(collationOrder1);
index1.setCollationOrder(co1);
return index1;
}