return "(nodeId " + nodeId.getSelectorName() + ")";
}
};
}
if (operand instanceof NodePath) {
final NodePath nodePath = (NodePath)operand;
final int indexInRow = columns.getSelectorIndex(nodePath.getSelectorName());
final NodeCache cache = context.getNodeCache(sources.getWorkspaceName());
if (isLike) {
return new ExtractFromRow() {
@Override
public TypeFactory<?> getType() {
return stringFactory;
}
@Override
public Object getValueInRow( RowAccessor row ) {
CachedNode node = row.getNode(indexInRow);
if (node == null) return null;
Path path = node.getPath(cache);
if (path.isRoot()) {
return stringFactory.create(path);
}
// And the path that always has the SNS index ...
StringBuilder sb = new StringBuilder();
for (Path.Segment segment : path) {
// Add the segment WITH the index ...
sb.append("/");
sb.append(stringFactory.create(segment.getName()));
sb.append('[').append(segment.getIndex()).append(']');
}
return sb.toString();
}
@Override
public String toString() {
return "(nodePath " + nodePath.getSelectorName() + ")";
}
};
}
// Otherwise, just return the single path ...
return new ExtractFromRow() {
@Override
public TypeFactory<?> getType() {
return stringFactory;
}
@Override
public Object getValueInRow( RowAccessor row ) {
CachedNode node = row.getNode(indexInRow);
if (node == null) return null;
Path path = node.getPath(cache);
return stringFactory.create(path);
}
@Override
public String toString() {
return "(nodePath " + nodePath.getSelectorName() + ")";
}
};
}
if (operand instanceof NodeName) {
final NodeName nodeName = (NodeName)operand;