use of com.inova8.pathql.element.AlternativePathElement in project com.inova8.intelligentgraph by peterjohnlawrence.
the class PathPatternVisitor method visitPathAlternative.
/**
* Visit path alternative.
*
* @param ctx the ctx
* @return the alternative path element
*/
@Override
public AlternativePathElement visitPathAlternative(PathAlternativeContext ctx) {
// pathPatterns : pathPatterns '|' pathPatterns #PathAlternative
if (ctx.pathPatterns().size() == 1) {
return (AlternativePathElement) visit(ctx.pathPatterns(0));
} else {
AlternativePathElement pathAlternativeElement = new AlternativePathElement(this.repositoryContext);
pathAlternativeElement.setLeftPathElement(visit(ctx.pathPatterns(0)));
pathAlternativeElement.setRightPathElement(visit(ctx.pathPatterns(1)));
return pathAlternativeElement;
}
}
Aggregations