Not not = (Not)constraint;
Constraint wrapped = replaceReferences(context, not.getConstraint(), mapping, node);
return wrapped == not.getConstraint() ? not : new Not(wrapped);
}
if (constraint instanceof SameNode) {
SameNode sameNode = (SameNode)constraint;
if (!mapping.getOriginalName().equals(sameNode.selectorName())) return sameNode;
if (!mapping.isMappedToSingleSelector()) return sameNode;
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.selectorName())) return childNode;
if (!mapping.isMappedToSingleSelector()) return childNode;