Search in sources :

Example 1 with AlternativePathElement

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;
    }
}
Also used : AlternativePathElement(com.inova8.pathql.element.AlternativePathElement)

Aggregations

AlternativePathElement (com.inova8.pathql.element.AlternativePathElement)1