SelectorName selector = mapping.getSingleMappedSelectorName();
node.addSelector(selector);
return new SameNode(selector, sameNode.getPath());
}
if (constraint instanceof ChildNode) {
ChildNode childNode = (ChildNode)constraint;
if (!mapping.getOriginalName().equals(childNode.getSelectorName())) return childNode;
if (!mapping.isMappedToSingleSelector()) return childNode;
SelectorName selector = mapping.getSingleMappedSelectorName();
node.addSelector(selector);
return new ChildNode(selector, childNode.getParentPath());
}
if (constraint instanceof DescendantNode) {
DescendantNode descendantNode = (DescendantNode)constraint;
if (!mapping.getOriginalName().equals(descendantNode.getSelectorName())) return descendantNode;
if (!mapping.isMappedToSingleSelector()) return descendantNode;