List<Object> leftSortBy,
Set<SelectorName> rightSelectors,
List<Object> rightSortBy ) {
if (condition instanceof SameNodeJoinCondition) {
SameNodeJoinCondition joinCondition = (SameNodeJoinCondition)condition;
SelectorName name1 = joinCondition.selector1Name();
SelectorName name2 = joinCondition.selector2Name();
if (leftSelectors.contains(name1)) {
leftSortBy.add(name1);
rightSortBy.add(name2);
} else {
leftSortBy.add(name2);
rightSortBy.add(name1);
}
} else if (condition instanceof ChildNodeJoinCondition) {
ChildNodeJoinCondition joinCondition = (ChildNodeJoinCondition)condition;
SelectorName childName = joinCondition.childSelectorName();
SelectorName parentName = joinCondition.parentSelectorName();
if (leftSelectors.contains(childName)) {
leftSortBy.add(childName);
rightSortBy.add(parentName);
} else {
leftSortBy.add(parentName);
rightSortBy.add(childName);
}
} else if (condition instanceof EquiJoinCondition) {
EquiJoinCondition joinCondition = (EquiJoinCondition)condition;
SelectorName selector1 = joinCondition.selector1Name();
SelectorName selector2 = joinCondition.selector2Name();
String property1 = joinCondition.getProperty1Name();
String property2 = joinCondition.getProperty2Name();
// Create the Ordering for the first selector/property pair ...
DynamicOperand operand1 = new PropertyValue(selector1, property1);