public static Path pathMod(Path path, long min, long max) { return new P_Mod(path, min, max) ; } public static Path pathFixedLength(Path path, long count) { return new P_FixedLength(path, count) ; }
@Override public void visit(P_Mod pathMod) { // do..Or.. need to take a visited set. if ( pathMod.isZeroOrMore() ) { // :p{0,} engine.doOneOrMoreN(pathMod.getSubPath(), node, output) ; return ; } if ( pathMod.isOneOrMore() ) { engine.doOneOrMoreN(pathMod.getSubPath(), node, output) ; return ; } if ( pathMod.isFixedLength() ) engine.doFixedLengthPath(pathMod.getSubPath(), node, pathMod.getFixedLength(), output) ; else engine.doMultiLengthPath(pathMod.getSubPath(), node, pathMod.getMin(), pathMod.getMax(), output) ; }
@Override public void visit(P_Mod pathMod) { if ( pathMod.getMin() > pathMod.getMax() ) throw new ARQException("Bad path: "+pathMod) ; Op op = null ; for ( long i = pathMod.getMin() ; i <= pathMod.getMax() ; i++ ) { Path p = PathFactory.pathFixedLength(pathMod.getSubPath(), i) ; Op sub = transformPath(null, subject, p, object) ; op = union(op, sub) ; } result = op ; }
public void visit(P_Mod pathMod) if ( pathMod.isZeroOrMore() ) doZeroOrMore(pathMod.getSubPath()) ; return ; if ( pathMod.isOneOrMore() ) doOneOrMore(pathMod.getSubPath()) ; return ; if ( pathMod.getMin() == 0 ) output.add(node) ; if ( pathMod.getMax() == 0 ) return ; Iterator<Node> iter = eval(graph, node, pathMod.getSubPath(), forwardMode) ; long min2 = dec(pathMod.getMin()) ; long max2 = dec(pathMod.getMax()) ; P_Mod nextPath = new P_Mod(pathMod.getSubPath(), min2, max2) ;
if ( pMod.isFixedLength() && pMod.getFixedLength() > 0 ) long N = pMod.getFixedLength() ; if ( N > 0 ) reduce(x, varAlloc, stepStart, pMod.getSubPath(), v) ; stepStart = v ; reduce(x, varAlloc, stepStart, pMod.getSubPath(), endNode) ; return ; if ( pMod.getMin() > 0 ) Path p1 = PathFactory.pathFixedLength(pMod.getSubPath(), pMod.getMin()) ; Path p2 ; if ( pMod.getMax() < 0 ) p2 = PathFactory.pathZeroOrMore(pMod.getSubPath()) ; else long len2 = pMod.getMax()-pMod.getMin() ; if ( len2 < 0 ) len2 = 0 ; p2 = PathFactory.pathMod(pMod.getSubPath(),0, len2) ;
@Override public int hashCode() { return hashMod ^ (int)min ^ (int)max ^ getSubPath().hashCode() ; }
public long getFixedLength() { if ( ! isFixedLength() ) return -1 ; return min ; }
if ( pathMod.isZeroOrMore() ) doZeroOrMore(pathMod.getSubPath()) ; if ( DEBUG ) IndentedWriter.stdout.println("ZeroOrMore: "+output) ; return ; long min1 = pathMod.getMin() ; long max1 = pathMod.getMax() ; long max2 = dec(max1) ; Path p1 = pathMod.getSubPath() ; Path p2 = new P_Mod(pathMod.getSubPath(), min2, max2) ;
if ( pMod.isFixedLength() && pMod.getFixedLength() > 0 ) long N = pMod.getFixedLength() ; if ( N > 0 ) reduce(x, varAlloc, stepStart, pMod.getSubPath(), v) ; stepStart = v ; reduce(x, varAlloc, stepStart, pMod.getSubPath(), endNode) ; return ; if ( pMod.getMin() > 0 ) Path p1 = PathFactory.pathFixedLength(pMod.getSubPath(), pMod.getMin()) ; Path p2 ; if ( pMod.getMax() < 0 ) p2 = PathFactory.pathZeroOrMoreN(pMod.getSubPath()) ; else long len2 = pMod.getMax()-pMod.getMin() ; if ( len2 < 0 ) len2 = 0 ; p2 = PathFactory.pathMod(pMod.getSubPath(),0, len2) ;
if ( alwaysInnerParens ) out.print("(") ; pathMod.getSubPath().visit(this) ; if ( alwaysInnerParens ) out.print(")") ; if ( pathMod.getMin() != UNSET ) out.print(Long.toString(pathMod.getMin())) ; out.print(",") ; if ( pathMod.getMax() != UNSET ) out.print(Long.toString(pathMod.getMax())) ; out.print("}") ;
@Override public int hashCode() { return hashMod ^ (int)min ^ (int)max ^ getSubPath().hashCode() ; }
public long getFixedLength() { if ( ! isFixedLength() ) return -1 ; return min ; }
public void visit(P_Mod pathMod) { out.print("(") ; out.print(Tags.tagPathMod) ; out.print(" ") ; out.print(modInt(pathMod.getMin())) ; out.print(" ") ; out.print(modInt(pathMod.getMax())) ; writeOneLiner(pathMod.getSubPath()) ; out.print(")") ; }
public static Path pathMod(Path path, long min, long max) { return new P_Mod(path, min, max) ; } public static Path pathFixedLength(Path path, long count) { return new P_FixedLength(path, count) ; }
@Override public boolean equalTo(Path path2, NodeIsomorphismMap isoMap) { if ( ! ( path2 instanceof P_Mod ) ) return false ; P_Mod other = (P_Mod)path2 ; return other.min == min && other.max == max && getSubPath().equalTo(other.getSubPath(), isoMap) ; }
@Override public void visit(P_Mod pathMod) { out.print("(") ; out.print(Tags.tagPathMod) ; out.print(" ") ; out.print(modInt(pathMod.getMin())) ; out.print(" ") ; out.print(modInt(pathMod.getMax())) ; writeOneLiner(pathMod.getSubPath()) ; out.print(")") ; }
Path p2 = new P_Mod(pathStep, min2, max2) ;
@Override public boolean equalTo(Path path2, NodeIsomorphismMap isoMap) { if ( ! ( path2 instanceof P_Mod ) ) return false ; P_Mod other = (P_Mod)path2 ; return other.min == min && other.max == max && getSubPath().equalTo(other.getSubPath(), isoMap) ; }
if ( alwaysInnerParens ) out.print("(") ; pathMod.getSubPath().visit(this) ; if ( alwaysInnerParens ) out.print(")") ; if ( pathMod.getMin() != UNSET ) out.print(Long.toString(pathMod.getMin())) ; out.print(",") ; if ( pathMod.getMax() != UNSET ) out.print(Long.toString(pathMod.getMax())) ; out.print("}") ;
Path p2 = new P_Mod(pathStep, min2, max2) ;