if (childSelector == condition.getChildSelectorName() && parentSelector == condition.getParentSelectorName()) return condition;
node.addSelector(childSelector, parentSelector);
return new ChildNodeJoinCondition(parentSelector, childSelector);
}
if (joinCondition instanceof DescendantNodeJoinCondition) {
DescendantNodeJoinCondition condition = (DescendantNodeJoinCondition)joinCondition;
SelectorName ancestor = condition.getAncestorSelectorName();
SelectorName descendant = condition.getDescendantSelectorName();
if (ancestor.equals(viewName)) ancestor = sourceName;
if (descendant.equals(viewName)) descendant = sourceName;
if (ancestor == condition.getAncestorSelectorName() && descendant == condition.getDescendantSelectorName()) return condition;
node.addSelector(ancestor, descendant);
return new ChildNodeJoinCondition(ancestor, descendant);
}
return joinCondition;
}