@Test public void geoPolygon() { assertTrue(new UriTokenizer("geography'SRID=4326;Polygon((0 0,1 0,0 1,0 0))'").next(TokenKind.GeographyPolygon)); assertTrue(new UriTokenizer("geometry'SRID=0;Polygon((0 0,1 0,0 1,0 0))'").next(TokenKind.GeometryPolygon)); assertTrue(new UriTokenizer("geometry'SRID=0;Polygon((1 1,2 1,2 2,1 2,1 1),(0 0,4 0,4 4,0 4,0 0))'") .next(TokenKind.GeometryPolygon)); assertTrue(new UriTokenizer( "geometry'SRID=0;Polygon((0 0,1 1,2 2,0 0),(1 1,2 1,2 2,1 2,1 1),(0 0,4 0,4 4,0 4,0 0))'") .next(TokenKind.GeometryPolygon)); wrongToken(TokenKind.GeometryPolygon, "geometry'SRID=0;Polygon((0 0,4 0,4 4,0 4,0 0),(1 1,2 1,2 2,1 2,1 1))'", 'x'); }
public boolean next(final TokenKind allowedTokenKind) { if (allowedTokenKind == null) { return false; } boolean found = false; final int previousIndex = index; switch (allowedTokenKind) { case EOF: found = index >= parseString.length(); break; case REF: found = nextConstant("$ref"); break; case VALUE: found = nextConstant("$value"); break; case COUNT: found = nextConstant("$count"); break; case CROSSJOIN: found = nextConstant("$crossjoin"); break; case ROOT: found = nextConstant("$root"); break; case IT: found = nextConstant("$it"); break; case APPLY: found = nextConstant("$apply"); break; case EXPAND: found = nextConstant("$expand"); break; case FILTER: found = nextConstant("$filter"); break; case LEVELS: found = nextConstant("$levels"); break; case ORDERBY: found = nextConstant("$orderby"); break; case SEARCH: found = nextConstant("$search"); break; case SELECT: found = nextConstant("$select"); break; case SKIP: found = nextConstant("$skip"); break; case TOP: found = nextConstant("$top"); break; case ANY: found = nextConstant("any"); break; case ALL: found = nextConstant("all"); break; case OPEN: found = nextCharacter('('); break; case CLOSE: found = nextCharacter(')'); break; case COMMA: found = nextCharacter(','); break; case SEMI: found = nextCharacter(';'); break; case COLON: found = nextCharacter(':'); break; case DOT: found = nextCharacter('.'); break; case SLASH: found = nextCharacter('/'); break; case EQ: found = nextCharacter('='); break; case STAR: found = nextCharacter('*'); break; case PLUS: found = nextCharacter('+'); break; case NULL: found = nextConstant("null"); break; case MAX: found = nextConstant("max"); break; case AVERAGE: found = nextConstant("average"); break; case COUNTDISTINCT: found = nextConstant("countdistinct"); break; case IDENTITY: found = nextConstant("identity"); break; case MIN: found = nextConstant("min"); break; case SUM: found = nextConstant("sum"); break; case ROLLUP_ALL: found = nextConstant("$all"); break; case ODataIdentifier: found = nextODataIdentifier(); break; case QualifiedName: found = nextQualifiedName(); break; case ParameterAliasName: found = nextParameterAliasName(); break; case BooleanValue: found = nextBooleanValue(); break; case StringValue: found = nextStringValue(); break; case IntegerValue: found = nextIntegerValue(true); break; case GuidValue: found = nextGuidValue(); break; case DateValue: found = nextDateValue(); break; case DateTimeOffsetValue: found = nextDateTimeOffsetValue(); break; case TimeOfDayValue: found = nextTimeOfDayValue(); break; case DecimalValue: found = nextDecimalValue(); break; case DoubleValue: found = nextDoubleValue(); break; case DurationValue: found = nextDurationValue(); break; case BinaryValue: found = nextBinaryValue(); break; case EnumValue: found = nextEnumValue(); break; case GeographyPoint: found = nextGeoPoint(true); break; case GeometryPoint: found = nextGeoPoint(false); break; case GeographyLineString: found = nextGeoLineString(true); break; case GeometryLineString: found = nextGeoLineString(false); break; case GeographyPolygon: found = nextGeoPolygon(true); break; case GeometryPolygon: found = nextGeoPolygon(false); break; case GeographyMultiPoint: found = nextGeoMultiPoint(true); break; case GeometryMultiPoint: found = nextGeoMultiPoint(false); break; case GeographyMultiLineString: found = nextGeoMultiLineString(true); break; case GeometryMultiLineString: found = nextGeoMultiLineString(false); break; case GeographyMultiPolygon: found = nextGeoMultiPolygon(true); break; case GeometryMultiPolygon: found = nextGeoMultiPolygon(false); break; case GeographyCollection: found = nextGeoCollection(true); break; case GeometryCollection: found = nextGeoCollection(false); break; case jsonArrayOrObject: found = nextJsonArrayOrObject(); break; case Word: found = nextWord(); break; case Phrase: found = nextPhrase(); break; case OrOperatorSearch: found = nextBinaryOperator("OR"); break; case AndOperatorSearch: found = nextAndOperatorSearch(); break; case NotOperatorSearch: found = nextUnaryOperator("NOT"); break; case OrOperator: found = nextBinaryOperator("or"); break; case AndOperator: found = nextBinaryOperator("and"); break; case EqualsOperator: found = nextBinaryOperator("eq"); break; case NotEqualsOperator: found = nextBinaryOperator("ne"); break; case GreaterThanOperator: found = nextBinaryOperator("gt"); break; case GreaterThanOrEqualsOperator: found = nextBinaryOperator("ge"); break; case LessThanOperator: found = nextBinaryOperator("lt"); break; case LessThanOrEqualsOperator: found = nextBinaryOperator("le"); break; case HasOperator: found = nextBinaryOperator("has"); break; case InOperator: found = nextBinaryOperator("in"); break; case AddOperator: found = nextBinaryOperator("add"); break; case SubOperator: found = nextBinaryOperator("sub"); break; case MulOperator: found = nextBinaryOperator("mul"); break; case DivOperator: found = nextBinaryOperator("div"); break; case ModOperator: found = nextBinaryOperator("mod"); break; case MinusOperator: found = nextCharacter('-') && !nextDigit() && !nextConstant("INF"); break; case NotOperator: found = nextUnaryOperator("not"); break; case AsOperator: found = nextBinaryOperator("as"); break; case FromOperator: found = nextBinaryOperator("from"); break; case WithOperator: found = nextBinaryOperator("with"); break; case CastMethod: found = nextMethod("cast"); break; case CeilingMethod: found = nextMethod("ceiling"); break; case ConcatMethod: found = nextMethod("concat"); break; case ContainsMethod: found = nextMethod("contains"); break; case DateMethod: found = nextMethod("date"); break; case DayMethod: found = nextMethod("day"); break; case EndswithMethod: found = nextMethod("endswith"); break; case FloorMethod: found = nextMethod("floor"); break; case FractionalsecondsMethod: found = nextMethod("fractionalseconds"); break; case GeoDistanceMethod: found = nextMethod("geo.distance"); break; case GeoIntersectsMethod: found = nextMethod("geo.intersects"); break; case GeoLengthMethod: found = nextMethod("geo.length"); break; case HourMethod: found = nextMethod("hour"); break; case IndexofMethod: found = nextMethod("indexof"); break; case IsofMethod: found = nextMethod("isof"); break; case LengthMethod: found = nextMethod("length"); break; case MaxdatetimeMethod: found = nextMethod("maxdatetime"); break; case MindatetimeMethod: found = nextMethod("mindatetime"); break; case MinuteMethod: found = nextMethod("minute"); break; case MonthMethod: found = nextMethod("month"); break; case NowMethod: found = nextMethod("now"); break; case RoundMethod: found = nextMethod("round"); break; case SecondMethod: found = nextMethod("second"); break; case StartswithMethod: found = nextMethod("startswith"); break; case SubstringMethod: found = nextMethod("substring"); break; case TimeMethod: found = nextMethod("time"); break; case TolowerMethod: found = nextMethod("tolower"); break; case TotaloffsetminutesMethod: found = nextMethod("totaloffsetminutes"); break; case TotalsecondsMethod: found = nextMethod("totalseconds"); break; case ToupperMethod: found = nextMethod("toupper"); break; case TrimMethod: found = nextMethod("trim"); break; case YearMethod: found = nextMethod("year"); break; case SubstringofMethod: found = nextMethod("substringof"); break; case IsDefinedMethod: found = nextMethod("isdefined"); break; case AggregateTrafo: found = nextMethod("aggregate"); break; case BottomCountTrafo: found = nextMethod("bottomcount"); break; case BottomPercentTrafo: found = nextMethod("bottompercent"); break; case BottomSumTrafo: found = nextMethod("bottomsum"); break; case ComputeTrafo: found = nextMethod("compute"); break; case ExpandTrafo: found = nextMethod("expand"); break; case FilterTrafo: found = nextMethod("filter"); break; case GroupByTrafo: found = nextMethod("groupby"); break; case SearchTrafo: found = nextMethod("search"); break; case TopCountTrafo: found = nextMethod("topcount"); break; case TopPercentTrafo: found = nextMethod("toppercent"); break; case TopSumTrafo: found = nextMethod("topsum"); break; case RollUpSpec: found = nextMethod("rollup"); break; case AscSuffix: found = nextSuffix("asc"); break; case DescSuffix: found = nextSuffix("desc"); break; } if (found) { startIndex = previousIndex; } else { index = previousIndex; } return found; }
UriTokenizer { public boolean next(final TokenKind allowedTokenKind) { if (allowedTokenKind == null) { return false; } boolean found = false; final int previousIndex = index; switch (allowedTokenKind) { case EOF: found = index >= parseString.length(); break; case REF: found = nextConstant("$ref"); break; case VALUE: found = nextConstant("$value"); break; case COUNT: found = nextConstant("$count"); break; case CROSSJOIN: found = nextConstant("$crossjoin"); break; case ROOT: found = nextConstant("$root"); break; case IT: found = nextConstant("$it"); break; case APPLY: found = nextConstant("$apply"); break; case EXPAND: found = nextConstant("$expand"); break; case FILTER: found = nextConstant("$filter"); break; case LEVELS: found = nextConstant("$levels"); break; case ORDERBY: found = nextConstant("$orderby"); break; case SEARCH: found = nextConstant("$search"); break; case SELECT: found = nextConstant("$select"); break; case SKIP: found = nextConstant("$skip"); break; case TOP: found = nextConstant("$top"); break; case ANY: found = nextConstant("any"); break; case ALL: found = nextConstant("all"); break; case OPEN: found = nextCharacter('('); break; case CLOSE: found = nextCharacter(')'); break; case COMMA: found = nextCharacter(','); break; case SEMI: found = nextCharacter(';'); break; case COLON: found = nextCharacter(':'); break; case DOT: found = nextCharacter('.'); break; case SLASH: found = nextCharacter('/'); break; case EQ: found = nextCharacter('='); break; case STAR: found = nextCharacter('*'); break; case PLUS: found = nextCharacter('+'); break; case NULL: found = nextConstant("null"); break; case MAX: found = nextConstant("max"); break; case AVERAGE: found = nextConstant("average"); break; case COUNTDISTINCT: found = nextConstant("countdistinct"); break; case IDENTITY: found = nextConstant("identity"); break; case MIN: found = nextConstant("min"); break; case SUM: found = nextConstant("sum"); break; case ROLLUP_ALL: found = nextConstant("$all"); break; case ODataIdentifier: found = nextODataIdentifier(); break; case QualifiedName: found = nextQualifiedName(); break; case ParameterAliasName: found = nextParameterAliasName(); break; case BooleanValue: found = nextBooleanValue(); break; case StringValue: found = nextStringValue(); break; case IntegerValue: found = nextIntegerValue(true); break; case GuidValue: found = nextGuidValue(); break; case DateValue: found = nextDateValue(); break; case DateTimeOffsetValue: found = nextDateTimeOffsetValue(); break; case TimeOfDayValue: found = nextTimeOfDayValue(); break; case DecimalValue: found = nextDecimalValue(); break; case DoubleValue: found = nextDoubleValue(); break; case DurationValue: found = nextDurationValue(); break; case BinaryValue: found = nextBinaryValue(); break; case EnumValue: found = nextEnumValue(); break; case GeographyPoint: found = nextGeoPoint(true); break; case GeometryPoint: found = nextGeoPoint(false); break; case GeographyLineString: found = nextGeoLineString(true); break; case GeometryLineString: found = nextGeoLineString(false); break; case GeographyPolygon: found = nextGeoPolygon(true); break; case GeometryPolygon: found = nextGeoPolygon(false); break; case GeographyMultiPoint: found = nextGeoMultiPoint(true); break; case GeometryMultiPoint: found = nextGeoMultiPoint(false); break; case GeographyMultiLineString: found = nextGeoMultiLineString(true); break; case GeometryMultiLineString: found = nextGeoMultiLineString(false); break; case GeographyMultiPolygon: found = nextGeoMultiPolygon(true); break; case GeometryMultiPolygon: found = nextGeoMultiPolygon(false); break; case GeographyCollection: found = nextGeoCollection(true); break; case GeometryCollection: found = nextGeoCollection(false); break; case jsonArrayOrObject: found = nextJsonArrayOrObject(); break; case Word: found = nextWord(); break; case Phrase: found = nextPhrase(); break; case OrOperatorSearch: found = nextBinaryOperator("OR"); break; case AndOperatorSearch: found = nextAndOperatorSearch(); break; case NotOperatorSearch: found = nextUnaryOperator("NOT"); break; case OrOperator: found = nextBinaryOperator("or"); break; case AndOperator: found = nextBinaryOperator("and"); break; case EqualsOperator: found = nextBinaryOperator("eq"); break; case NotEqualsOperator: found = nextBinaryOperator("ne"); break; case GreaterThanOperator: found = nextBinaryOperator("gt"); break; case GreaterThanOrEqualsOperator: found = nextBinaryOperator("ge"); break; case LessThanOperator: found = nextBinaryOperator("lt"); break; case LessThanOrEqualsOperator: found = nextBinaryOperator("le"); break; case HasOperator: found = nextBinaryOperator("has"); break; case InOperator: found = nextBinaryOperator("in"); break; case AddOperator: found = nextBinaryOperator("add"); break; case SubOperator: found = nextBinaryOperator("sub"); break; case MulOperator: found = nextBinaryOperator("mul"); break; case DivOperator: found = nextBinaryOperator("div"); break; case ModOperator: found = nextBinaryOperator("mod"); break; case MinusOperator: found = nextCharacter('-') && !nextDigit() && !nextConstant("INF"); break; case NotOperator: found = nextUnaryOperator("not"); break; case AsOperator: found = nextBinaryOperator("as"); break; case FromOperator: found = nextBinaryOperator("from"); break; case WithOperator: found = nextBinaryOperator("with"); break; case CastMethod: found = nextMethod("cast"); break; case CeilingMethod: found = nextMethod("ceiling"); break; case ConcatMethod: found = nextMethod("concat"); break; case ContainsMethod: found = nextMethod("contains"); break; case DateMethod: found = nextMethod("date"); break; case DayMethod: found = nextMethod("day"); break; case EndswithMethod: found = nextMethod("endswith"); break; case FloorMethod: found = nextMethod("floor"); break; case FractionalsecondsMethod: found = nextMethod("fractionalseconds"); break; case GeoDistanceMethod: found = nextMethod("geo.distance"); break; case GeoIntersectsMethod: found = nextMethod("geo.intersects"); break; case GeoLengthMethod: found = nextMethod("geo.length"); break; case HourMethod: found = nextMethod("hour"); break; case IndexofMethod: found = nextMethod("indexof"); break; case IsofMethod: found = nextMethod("isof"); break; case LengthMethod: found = nextMethod("length"); break; case MaxdatetimeMethod: found = nextMethod("maxdatetime"); break; case MindatetimeMethod: found = nextMethod("mindatetime"); break; case MinuteMethod: found = nextMethod("minute"); break; case MonthMethod: found = nextMethod("month"); break; case NowMethod: found = nextMethod("now"); break; case RoundMethod: found = nextMethod("round"); break; case SecondMethod: found = nextMethod("second"); break; case StartswithMethod: found = nextMethod("startswith"); break; case SubstringMethod: found = nextMethod("substring"); break; case TimeMethod: found = nextMethod("time"); break; case TolowerMethod: found = nextMethod("tolower"); break; case TotaloffsetminutesMethod: found = nextMethod("totaloffsetminutes"); break; case TotalsecondsMethod: found = nextMethod("totalseconds"); break; case ToupperMethod: found = nextMethod("toupper"); break; case TrimMethod: found = nextMethod("trim"); break; case YearMethod: found = nextMethod("year"); break; case SubstringofMethod: found = nextMethod("substringof"); break; case IsDefinedMethod: found = nextMethod("isdefined"); break; case AggregateTrafo: found = nextMethod("aggregate"); break; case BottomCountTrafo: found = nextMethod("bottomcount"); break; case BottomPercentTrafo: found = nextMethod("bottompercent"); break; case BottomSumTrafo: found = nextMethod("bottomsum"); break; case ComputeTrafo: found = nextMethod("compute"); break; case ExpandTrafo: found = nextMethod("expand"); break; case FilterTrafo: found = nextMethod("filter"); break; case GroupByTrafo: found = nextMethod("groupby"); break; case SearchTrafo: found = nextMethod("search"); break; case TopCountTrafo: found = nextMethod("topcount"); break; case TopPercentTrafo: found = nextMethod("toppercent"); break; case TopSumTrafo: found = nextMethod("topsum"); break; case RollUpSpec: found = nextMethod("rollup"); break; case AscSuffix: found = nextSuffix("asc"); break; case DescSuffix: found = nextSuffix("desc"); break; } if (found) { startIndex = previousIndex; } else { index = previousIndex; } return found; } }
UriTokenizer { public boolean next(final TokenKind allowedTokenKind) { if (allowedTokenKind == null) { return false; } boolean found = false; final int previousIndex = index; switch (allowedTokenKind) { case EOF: found = index >= parseString.length(); break; case REF: found = nextConstant("$ref"); break; case VALUE: found = nextConstant("$value"); break; case COUNT: found = nextConstant("$count"); break; case CROSSJOIN: found = nextConstant("$crossjoin"); break; case ROOT: found = nextConstant("$root"); break; case IT: found = nextConstant("$it"); break; case APPLY: found = nextConstant("$apply"); break; case EXPAND: found = nextConstant("$expand"); break; case FILTER: found = nextConstant("$filter"); break; case LEVELS: found = nextConstant("$levels"); break; case ORDERBY: found = nextConstant("$orderby"); break; case SEARCH: found = nextConstant("$search"); break; case SELECT: found = nextConstant("$select"); break; case SKIP: found = nextConstant("$skip"); break; case TOP: found = nextConstant("$top"); break; case ANY: found = nextConstant("any"); break; case ALL: found = nextConstant("all"); break; case OPEN: found = nextCharacter('('); break; case CLOSE: found = nextCharacter(')'); break; case COMMA: found = nextCharacter(','); break; case SEMI: found = nextCharacter(';'); break; case COLON: found = nextCharacter(':'); break; case DOT: found = nextCharacter('.'); break; case SLASH: found = nextCharacter('/'); break; case EQ: found = nextCharacter('='); break; case STAR: found = nextCharacter('*'); break; case PLUS: found = nextCharacter('+'); break; case NULL: found = nextConstant("null"); break; case MAX: found = nextConstant("max"); break; case AVERAGE: found = nextConstant("average"); break; case COUNTDISTINCT: found = nextConstant("countdistinct"); break; case IDENTITY: found = nextConstant("identity"); break; case MIN: found = nextConstant("min"); break; case SUM: found = nextConstant("sum"); break; case ROLLUP_ALL: found = nextConstant("$all"); break; case ODataIdentifier: found = nextODataIdentifier(); break; case QualifiedName: found = nextQualifiedName(); break; case ParameterAliasName: found = nextParameterAliasName(); break; case BooleanValue: found = nextBooleanValue(); break; case StringValue: found = nextStringValue(); break; case IntegerValue: found = nextIntegerValue(true); break; case GuidValue: found = nextGuidValue(); break; case DateValue: found = nextDateValue(); break; case DateTimeOffsetValue: found = nextDateTimeOffsetValue(); break; case TimeOfDayValue: found = nextTimeOfDayValue(); break; case DecimalValue: found = nextDecimalValue(); break; case DoubleValue: found = nextDoubleValue(); break; case DurationValue: found = nextDurationValue(); break; case BinaryValue: found = nextBinaryValue(); break; case EnumValue: found = nextEnumValue(); break; case GeographyPoint: found = nextGeoPoint(true); break; case GeometryPoint: found = nextGeoPoint(false); break; case GeographyLineString: found = nextGeoLineString(true); break; case GeometryLineString: found = nextGeoLineString(false); break; case GeographyPolygon: found = nextGeoPolygon(true); break; case GeometryPolygon: found = nextGeoPolygon(false); break; case GeographyMultiPoint: found = nextGeoMultiPoint(true); break; case GeometryMultiPoint: found = nextGeoMultiPoint(false); break; case GeographyMultiLineString: found = nextGeoMultiLineString(true); break; case GeometryMultiLineString: found = nextGeoMultiLineString(false); break; case GeographyMultiPolygon: found = nextGeoMultiPolygon(true); break; case GeometryMultiPolygon: found = nextGeoMultiPolygon(false); break; case GeographyCollection: found = nextGeoCollection(true); break; case GeometryCollection: found = nextGeoCollection(false); break; case jsonArrayOrObject: found = nextJsonArrayOrObject(); break; case Word: found = nextWord(); break; case Phrase: found = nextPhrase(); break; case OrOperatorSearch: found = nextBinaryOperator("OR"); break; case AndOperatorSearch: found = nextAndOperatorSearch(); break; case NotOperatorSearch: found = nextUnaryOperator("NOT"); break; case OrOperator: found = nextBinaryOperator("or"); break; case AndOperator: found = nextBinaryOperator("and"); break; case EqualsOperator: found = nextBinaryOperator("eq"); break; case NotEqualsOperator: found = nextBinaryOperator("ne"); break; case GreaterThanOperator: found = nextBinaryOperator("gt"); break; case GreaterThanOrEqualsOperator: found = nextBinaryOperator("ge"); break; case LessThanOperator: found = nextBinaryOperator("lt"); break; case LessThanOrEqualsOperator: found = nextBinaryOperator("le"); break; case HasOperator: found = nextBinaryOperator("has"); break; case InOperator: found = nextBinaryOperator("in"); break; case AddOperator: found = nextBinaryOperator("add"); break; case SubOperator: found = nextBinaryOperator("sub"); break; case MulOperator: found = nextBinaryOperator("mul"); break; case DivOperator: found = nextBinaryOperator("div"); break; case ModOperator: found = nextBinaryOperator("mod"); break; case MinusOperator: found = nextCharacter('-') && !nextDigit() && !nextConstant("INF"); break; case NotOperator: found = nextUnaryOperator("not"); break; case AsOperator: found = nextBinaryOperator("as"); break; case FromOperator: found = nextBinaryOperator("from"); break; case WithOperator: found = nextBinaryOperator("with"); break; case CastMethod: found = nextMethod("cast"); break; case CeilingMethod: found = nextMethod("ceiling"); break; case ConcatMethod: found = nextMethod("concat"); break; case ContainsMethod: found = nextMethod("contains"); break; case DateMethod: found = nextMethod("date"); break; case DayMethod: found = nextMethod("day"); break; case EndswithMethod: found = nextMethod("endswith"); break; case FloorMethod: found = nextMethod("floor"); break; case FractionalsecondsMethod: found = nextMethod("fractionalseconds"); break; case GeoDistanceMethod: found = nextMethod("geo.distance"); break; case GeoIntersectsMethod: found = nextMethod("geo.intersects"); break; case GeoLengthMethod: found = nextMethod("geo.length"); break; case HourMethod: found = nextMethod("hour"); break; case IndexofMethod: found = nextMethod("indexof"); break; case IsofMethod: found = nextMethod("isof"); break; case LengthMethod: found = nextMethod("length"); break; case MaxdatetimeMethod: found = nextMethod("maxdatetime"); break; case MindatetimeMethod: found = nextMethod("mindatetime"); break; case MinuteMethod: found = nextMethod("minute"); break; case MonthMethod: found = nextMethod("month"); break; case NowMethod: found = nextMethod("now"); break; case RoundMethod: found = nextMethod("round"); break; case SecondMethod: found = nextMethod("second"); break; case StartswithMethod: found = nextMethod("startswith"); break; case SubstringMethod: found = nextMethod("substring"); break; case TimeMethod: found = nextMethod("time"); break; case TolowerMethod: found = nextMethod("tolower"); break; case TotaloffsetminutesMethod: found = nextMethod("totaloffsetminutes"); break; case TotalsecondsMethod: found = nextMethod("totalseconds"); break; case ToupperMethod: found = nextMethod("toupper"); break; case TrimMethod: found = nextMethod("trim"); break; case YearMethod: found = nextMethod("year"); break; case SubstringofMethod: found = nextMethod("substringof"); break; case IsDefinedMethod: found = nextMethod("isdefined"); break; case AggregateTrafo: found = nextMethod("aggregate"); break; case BottomCountTrafo: found = nextMethod("bottomcount"); break; case BottomPercentTrafo: found = nextMethod("bottompercent"); break; case BottomSumTrafo: found = nextMethod("bottomsum"); break; case ComputeTrafo: found = nextMethod("compute"); break; case ExpandTrafo: found = nextMethod("expand"); break; case FilterTrafo: found = nextMethod("filter"); break; case GroupByTrafo: found = nextMethod("groupby"); break; case SearchTrafo: found = nextMethod("search"); break; case TopCountTrafo: found = nextMethod("topcount"); break; case TopPercentTrafo: found = nextMethod("toppercent"); break; case TopSumTrafo: found = nextMethod("topsum"); break; case RollUpSpec: found = nextMethod("rollup"); break; case AscSuffix: found = nextSuffix("asc"); break; case DescSuffix: found = nextSuffix("desc"); break; } if (found) { startIndex = previousIndex; } else { index = previousIndex; } return found; } UriTokenizer(final String parseString); }
UriTokenizer { public boolean next(final TokenKind allowedTokenKind) { if (allowedTokenKind == null) { return false; } boolean found = false; final int previousIndex = index; switch (allowedTokenKind) { case EOF: found = index >= parseString.length(); break; case REF: found = nextConstant("$ref"); break; case VALUE: found = nextConstant("$value"); break; case COUNT: found = nextConstant("$count"); break; case CROSSJOIN: found = nextConstant("$crossjoin"); break; case ROOT: found = nextConstant("$root"); break; case IT: found = nextConstant("$it"); break; case APPLY: found = nextConstant("$apply"); break; case EXPAND: found = nextConstant("$expand"); break; case FILTER: found = nextConstant("$filter"); break; case LEVELS: found = nextConstant("$levels"); break; case ORDERBY: found = nextConstant("$orderby"); break; case SEARCH: found = nextConstant("$search"); break; case SELECT: found = nextConstant("$select"); break; case SKIP: found = nextConstant("$skip"); break; case TOP: found = nextConstant("$top"); break; case ANY: found = nextConstant("any"); break; case ALL: found = nextConstant("all"); break; case OPEN: found = nextCharacter('('); break; case CLOSE: found = nextCharacter(')'); break; case COMMA: found = nextCharacter(','); break; case SEMI: found = nextCharacter(';'); break; case COLON: found = nextCharacter(':'); break; case DOT: found = nextCharacter('.'); break; case SLASH: found = nextCharacter('/'); break; case EQ: found = nextCharacter('='); break; case STAR: found = nextCharacter('*'); break; case PLUS: found = nextCharacter('+'); break; case NULL: found = nextConstant("null"); break; case MAX: found = nextConstant("max"); break; case AVERAGE: found = nextConstant("average"); break; case COUNTDISTINCT: found = nextConstant("countdistinct"); break; case IDENTITY: found = nextConstant("identity"); break; case MIN: found = nextConstant("min"); break; case SUM: found = nextConstant("sum"); break; case ROLLUP_ALL: found = nextConstant("$all"); break; case ODataIdentifier: found = nextODataIdentifier(); break; case QualifiedName: found = nextQualifiedName(); break; case ParameterAliasName: found = nextParameterAliasName(); break; case BooleanValue: found = nextBooleanValue(); break; case StringValue: found = nextStringValue(); break; case IntegerValue: found = nextIntegerValue(true); break; case GuidValue: found = nextGuidValue(); break; case DateValue: found = nextDateValue(); break; case DateTimeOffsetValue: found = nextDateTimeOffsetValue(); break; case TimeOfDayValue: found = nextTimeOfDayValue(); break; case DecimalValue: found = nextDecimalValue(); break; case DoubleValue: found = nextDoubleValue(); break; case DurationValue: found = nextDurationValue(); break; case BinaryValue: found = nextBinaryValue(); break; case EnumValue: found = nextEnumValue(); break; case GeographyPoint: found = nextGeoPoint(true); break; case GeometryPoint: found = nextGeoPoint(false); break; case GeographyLineString: found = nextGeoLineString(true); break; case GeometryLineString: found = nextGeoLineString(false); break; case GeographyPolygon: found = nextGeoPolygon(true); break; case GeometryPolygon: found = nextGeoPolygon(false); break; case GeographyMultiPoint: found = nextGeoMultiPoint(true); break; case GeometryMultiPoint: found = nextGeoMultiPoint(false); break; case GeographyMultiLineString: found = nextGeoMultiLineString(true); break; case GeometryMultiLineString: found = nextGeoMultiLineString(false); break; case GeographyMultiPolygon: found = nextGeoMultiPolygon(true); break; case GeometryMultiPolygon: found = nextGeoMultiPolygon(false); break; case GeographyCollection: found = nextGeoCollection(true); break; case GeometryCollection: found = nextGeoCollection(false); break; case jsonArrayOrObject: found = nextJsonArrayOrObject(); break; case Word: found = nextWord(); break; case Phrase: found = nextPhrase(); break; case OrOperatorSearch: found = nextBinaryOperator("OR"); break; case AndOperatorSearch: found = nextAndOperatorSearch(); break; case NotOperatorSearch: found = nextUnaryOperator("NOT"); break; case OrOperator: found = nextBinaryOperator("or"); break; case AndOperator: found = nextBinaryOperator("and"); break; case EqualsOperator: found = nextBinaryOperator("eq"); break; case NotEqualsOperator: found = nextBinaryOperator("ne"); break; case GreaterThanOperator: found = nextBinaryOperator("gt"); break; case GreaterThanOrEqualsOperator: found = nextBinaryOperator("ge"); break; case LessThanOperator: found = nextBinaryOperator("lt"); break; case LessThanOrEqualsOperator: found = nextBinaryOperator("le"); break; case HasOperator: found = nextBinaryOperator("has"); break; case InOperator: found = nextBinaryOperator("in"); break; case AddOperator: found = nextBinaryOperator("add"); break; case SubOperator: found = nextBinaryOperator("sub"); break; case MulOperator: found = nextBinaryOperator("mul"); break; case DivOperator: found = nextBinaryOperator("div"); break; case ModOperator: found = nextBinaryOperator("mod"); break; case MinusOperator: found = nextCharacter('-') && !nextDigit() && !nextConstant("INF"); break; case NotOperator: found = nextUnaryOperator("not"); break; case AsOperator: found = nextBinaryOperator("as"); break; case FromOperator: found = nextBinaryOperator("from"); break; case WithOperator: found = nextBinaryOperator("with"); break; case CastMethod: found = nextMethod("cast"); break; case CeilingMethod: found = nextMethod("ceiling"); break; case ConcatMethod: found = nextMethod("concat"); break; case ContainsMethod: found = nextMethod("contains"); break; case DateMethod: found = nextMethod("date"); break; case DayMethod: found = nextMethod("day"); break; case EndswithMethod: found = nextMethod("endswith"); break; case FloorMethod: found = nextMethod("floor"); break; case FractionalsecondsMethod: found = nextMethod("fractionalseconds"); break; case GeoDistanceMethod: found = nextMethod("geo.distance"); break; case GeoIntersectsMethod: found = nextMethod("geo.intersects"); break; case GeoLengthMethod: found = nextMethod("geo.length"); break; case HourMethod: found = nextMethod("hour"); break; case IndexofMethod: found = nextMethod("indexof"); break; case IsofMethod: found = nextMethod("isof"); break; case LengthMethod: found = nextMethod("length"); break; case MaxdatetimeMethod: found = nextMethod("maxdatetime"); break; case MindatetimeMethod: found = nextMethod("mindatetime"); break; case MinuteMethod: found = nextMethod("minute"); break; case MonthMethod: found = nextMethod("month"); break; case NowMethod: found = nextMethod("now"); break; case RoundMethod: found = nextMethod("round"); break; case SecondMethod: found = nextMethod("second"); break; case StartswithMethod: found = nextMethod("startswith"); break; case SubstringMethod: found = nextMethod("substring"); break; case TimeMethod: found = nextMethod("time"); break; case TolowerMethod: found = nextMethod("tolower"); break; case TotaloffsetminutesMethod: found = nextMethod("totaloffsetminutes"); break; case TotalsecondsMethod: found = nextMethod("totalseconds"); break; case ToupperMethod: found = nextMethod("toupper"); break; case TrimMethod: found = nextMethod("trim"); break; case YearMethod: found = nextMethod("year"); break; case SubstringofMethod: found = nextMethod("substringof"); break; case IsDefinedMethod: found = nextMethod("isdefined"); break; case AggregateTrafo: found = nextMethod("aggregate"); break; case BottomCountTrafo: found = nextMethod("bottomcount"); break; case BottomPercentTrafo: found = nextMethod("bottompercent"); break; case BottomSumTrafo: found = nextMethod("bottomsum"); break; case ComputeTrafo: found = nextMethod("compute"); break; case ExpandTrafo: found = nextMethod("expand"); break; case FilterTrafo: found = nextMethod("filter"); break; case GroupByTrafo: found = nextMethod("groupby"); break; case SearchTrafo: found = nextMethod("search"); break; case TopCountTrafo: found = nextMethod("topcount"); break; case TopPercentTrafo: found = nextMethod("toppercent"); break; case TopSumTrafo: found = nextMethod("topsum"); break; case RollUpSpec: found = nextMethod("rollup"); break; case AscSuffix: found = nextSuffix("asc"); break; case DescSuffix: found = nextSuffix("desc"); break; } if (found) { startIndex = previousIndex; } else { index = previousIndex; } return found; } UriTokenizer(final String parseString); void saveState(); void returnToSavedState(); String getText(); boolean next(final TokenKind allowedTokenKind); }
UriTokenizer { public boolean next(final TokenKind allowedTokenKind) { if (allowedTokenKind == null) { return false; } boolean found = false; final int previousIndex = index; switch (allowedTokenKind) { case EOF: found = index >= parseString.length(); break; case REF: found = nextConstant("$ref"); break; case VALUE: found = nextConstant("$value"); break; case COUNT: found = nextConstant("$count"); break; case CROSSJOIN: found = nextConstant("$crossjoin"); break; case ROOT: found = nextConstant("$root"); break; case IT: found = nextConstant("$it"); break; case APPLY: found = nextConstant("$apply"); break; case EXPAND: found = nextConstant("$expand"); break; case FILTER: found = nextConstant("$filter"); break; case LEVELS: found = nextConstant("$levels"); break; case ORDERBY: found = nextConstant("$orderby"); break; case SEARCH: found = nextConstant("$search"); break; case SELECT: found = nextConstant("$select"); break; case SKIP: found = nextConstant("$skip"); break; case TOP: found = nextConstant("$top"); break; case ANY: found = nextConstant("any"); break; case ALL: found = nextConstant("all"); break; case OPEN: found = nextCharacter('('); break; case CLOSE: found = nextCharacter(')'); break; case COMMA: found = nextCharacter(','); break; case SEMI: found = nextCharacter(';'); break; case COLON: found = nextCharacter(':'); break; case DOT: found = nextCharacter('.'); break; case SLASH: found = nextCharacter('/'); break; case EQ: found = nextCharacter('='); break; case STAR: found = nextCharacter('*'); break; case PLUS: found = nextCharacter('+'); break; case NULL: found = nextConstant("null"); break; case MAX: found = nextConstant("max"); break; case AVERAGE: found = nextConstant("average"); break; case COUNTDISTINCT: found = nextConstant("countdistinct"); break; case IDENTITY: found = nextConstant("identity"); break; case MIN: found = nextConstant("min"); break; case SUM: found = nextConstant("sum"); break; case ROLLUP_ALL: found = nextConstant("$all"); break; case ODataIdentifier: found = nextODataIdentifier(); break; case QualifiedName: found = nextQualifiedName(); break; case ParameterAliasName: found = nextParameterAliasName(); break; case BooleanValue: found = nextBooleanValue(); break; case StringValue: found = nextStringValue(); break; case IntegerValue: found = nextIntegerValue(true); break; case GuidValue: found = nextGuidValue(); break; case DateValue: found = nextDateValue(); break; case DateTimeOffsetValue: found = nextDateTimeOffsetValue(); break; case TimeOfDayValue: found = nextTimeOfDayValue(); break; case DecimalValue: found = nextDecimalValue(); break; case DoubleValue: found = nextDoubleValue(); break; case DurationValue: found = nextDurationValue(); break; case BinaryValue: found = nextBinaryValue(); break; case EnumValue: found = nextEnumValue(); break; case GeographyPoint: found = nextGeoPoint(true); break; case GeometryPoint: found = nextGeoPoint(false); break; case GeographyLineString: found = nextGeoLineString(true); break; case GeometryLineString: found = nextGeoLineString(false); break; case GeographyPolygon: found = nextGeoPolygon(true); break; case GeometryPolygon: found = nextGeoPolygon(false); break; case GeographyMultiPoint: found = nextGeoMultiPoint(true); break; case GeometryMultiPoint: found = nextGeoMultiPoint(false); break; case GeographyMultiLineString: found = nextGeoMultiLineString(true); break; case GeometryMultiLineString: found = nextGeoMultiLineString(false); break; case GeographyMultiPolygon: found = nextGeoMultiPolygon(true); break; case GeometryMultiPolygon: found = nextGeoMultiPolygon(false); break; case GeographyCollection: found = nextGeoCollection(true); break; case GeometryCollection: found = nextGeoCollection(false); break; case jsonArrayOrObject: found = nextJsonArrayOrObject(); break; case Word: found = nextWord(); break; case Phrase: found = nextPhrase(); break; case OrOperatorSearch: found = nextBinaryOperator("OR"); break; case AndOperatorSearch: found = nextAndOperatorSearch(); break; case NotOperatorSearch: found = nextUnaryOperator("NOT"); break; case OrOperator: found = nextBinaryOperator("or"); break; case AndOperator: found = nextBinaryOperator("and"); break; case EqualsOperator: found = nextBinaryOperator("eq"); break; case NotEqualsOperator: found = nextBinaryOperator("ne"); break; case GreaterThanOperator: found = nextBinaryOperator("gt"); break; case GreaterThanOrEqualsOperator: found = nextBinaryOperator("ge"); break; case LessThanOperator: found = nextBinaryOperator("lt"); break; case LessThanOrEqualsOperator: found = nextBinaryOperator("le"); break; case HasOperator: found = nextBinaryOperator("has"); break; case InOperator: found = nextBinaryOperator("in"); break; case AddOperator: found = nextBinaryOperator("add"); break; case SubOperator: found = nextBinaryOperator("sub"); break; case MulOperator: found = nextBinaryOperator("mul"); break; case DivOperator: found = nextBinaryOperator("div"); break; case ModOperator: found = nextBinaryOperator("mod"); break; case MinusOperator: found = nextCharacter('-') && !nextDigit() && !nextConstant("INF"); break; case NotOperator: found = nextUnaryOperator("not"); break; case AsOperator: found = nextBinaryOperator("as"); break; case FromOperator: found = nextBinaryOperator("from"); break; case WithOperator: found = nextBinaryOperator("with"); break; case CastMethod: found = nextMethod("cast"); break; case CeilingMethod: found = nextMethod("ceiling"); break; case ConcatMethod: found = nextMethod("concat"); break; case ContainsMethod: found = nextMethod("contains"); break; case DateMethod: found = nextMethod("date"); break; case DayMethod: found = nextMethod("day"); break; case EndswithMethod: found = nextMethod("endswith"); break; case FloorMethod: found = nextMethod("floor"); break; case FractionalsecondsMethod: found = nextMethod("fractionalseconds"); break; case GeoDistanceMethod: found = nextMethod("geo.distance"); break; case GeoIntersectsMethod: found = nextMethod("geo.intersects"); break; case GeoLengthMethod: found = nextMethod("geo.length"); break; case HourMethod: found = nextMethod("hour"); break; case IndexofMethod: found = nextMethod("indexof"); break; case IsofMethod: found = nextMethod("isof"); break; case LengthMethod: found = nextMethod("length"); break; case MaxdatetimeMethod: found = nextMethod("maxdatetime"); break; case MindatetimeMethod: found = nextMethod("mindatetime"); break; case MinuteMethod: found = nextMethod("minute"); break; case MonthMethod: found = nextMethod("month"); break; case NowMethod: found = nextMethod("now"); break; case RoundMethod: found = nextMethod("round"); break; case SecondMethod: found = nextMethod("second"); break; case StartswithMethod: found = nextMethod("startswith"); break; case SubstringMethod: found = nextMethod("substring"); break; case TimeMethod: found = nextMethod("time"); break; case TolowerMethod: found = nextMethod("tolower"); break; case TotaloffsetminutesMethod: found = nextMethod("totaloffsetminutes"); break; case TotalsecondsMethod: found = nextMethod("totalseconds"); break; case ToupperMethod: found = nextMethod("toupper"); break; case TrimMethod: found = nextMethod("trim"); break; case YearMethod: found = nextMethod("year"); break; case SubstringofMethod: found = nextMethod("substringof"); break; case IsDefinedMethod: found = nextMethod("isdefined"); break; case AggregateTrafo: found = nextMethod("aggregate"); break; case BottomCountTrafo: found = nextMethod("bottomcount"); break; case BottomPercentTrafo: found = nextMethod("bottompercent"); break; case BottomSumTrafo: found = nextMethod("bottomsum"); break; case ComputeTrafo: found = nextMethod("compute"); break; case ExpandTrafo: found = nextMethod("expand"); break; case FilterTrafo: found = nextMethod("filter"); break; case GroupByTrafo: found = nextMethod("groupby"); break; case SearchTrafo: found = nextMethod("search"); break; case TopCountTrafo: found = nextMethod("topcount"); break; case TopPercentTrafo: found = nextMethod("toppercent"); break; case TopSumTrafo: found = nextMethod("topsum"); break; case RollUpSpec: found = nextMethod("rollup"); break; case AscSuffix: found = nextSuffix("asc"); break; case DescSuffix: found = nextSuffix("desc"); break; } if (found) { startIndex = previousIndex; } else { index = previousIndex; } return found; } UriTokenizer(final String parseString); void saveState(); void returnToSavedState(); String getText(); boolean next(final TokenKind allowedTokenKind);  }