@Test public void shouldParseGeneralComp() { assertThat(parser.parseGeneralComp(tokenize("!=")), is(Operator.NOT_EQUAL_TO)); assertThat(parser.parseGeneralComp(tokenize("=")), is(Operator.EQUAL_TO)); assertThat(parser.parseGeneralComp(tokenize("<")), is(Operator.LESS_THAN)); assertThat(parser.parseGeneralComp(tokenize("<=")), is(Operator.LESS_THAN_OR_EQUAL_TO)); assertThat(parser.parseGeneralComp(tokenize(">")), is(Operator.GREATER_THAN)); assertThat(parser.parseGeneralComp(tokenize(">=")), is(Operator.GREATER_THAN_OR_EQUAL_TO)); assertThat(parser.parseGeneralComp(tokenize("<5")), is(Operator.LESS_THAN)); assertThat(parser.parseGeneralComp(tokenize(">5")), is(Operator.GREATER_THAN)); }
protected Operator parseGeneralComp( TokenStream tokens ) { if (tokens.canConsume("!", "=")) return Operator.NOT_EQUAL_TO; if (tokens.canConsume("=")) return Operator.EQUAL_TO; if (tokens.canConsume("<", "=")) return Operator.LESS_THAN_OR_EQUAL_TO; if (tokens.canConsume(">", "=")) return Operator.GREATER_THAN_OR_EQUAL_TO; if (tokens.canConsume("<")) return Operator.LESS_THAN; if (tokens.canConsume(">")) return Operator.GREATER_THAN; return null; }
XPathParser { protected Operator parseGeneralComp( TokenStream tokens ) { if (tokens.canConsume("!", "=")) return Operator.NOT_EQUAL_TO; if (tokens.canConsume("=")) return Operator.EQUAL_TO; if (tokens.canConsume("<", "=")) return Operator.LESS_THAN_OR_EQUAL_TO; if (tokens.canConsume(">", "=")) return Operator.GREATER_THAN_OR_EQUAL_TO; if (tokens.canConsume("<")) return Operator.LESS_THAN; if (tokens.canConsume(">")) return Operator.GREATER_THAN; return null; } }
XPathParser { protected Operator parseGeneralComp( TokenStream tokens ) { if (tokens.canConsume("!", "=")) return Operator.NOT_EQUAL_TO; if (tokens.canConsume("=")) return Operator.EQUAL_TO; if (tokens.canConsume("<", "=")) return Operator.LESS_THAN_OR_EQUAL_TO; if (tokens.canConsume(">", "=")) return Operator.GREATER_THAN_OR_EQUAL_TO; if (tokens.canConsume("<")) return Operator.LESS_THAN; if (tokens.canConsume(">")) return Operator.GREATER_THAN; return null; } XPathParser( TypeSystem context ); }
XPathParser { protected Operator parseGeneralComp( TokenStream tokens ) { if (tokens.canConsume("!", "=")) return Operator.NOT_EQUAL_TO; if (tokens.canConsume("=")) return Operator.EQUAL_TO; if (tokens.canConsume("<", "=")) return Operator.LESS_THAN_OR_EQUAL_TO; if (tokens.canConsume(">", "=")) return Operator.GREATER_THAN_OR_EQUAL_TO; if (tokens.canConsume("<")) return Operator.LESS_THAN; if (tokens.canConsume(">")) return Operator.GREATER_THAN; return null; } XPathParser( TypeSystem context ); Component parseXPath( String xpath ); }
XPathParser { protected Operator parseGeneralComp( TokenStream tokens ) { if (tokens.canConsume("!", "=")) return Operator.NOT_EQUAL_TO; if (tokens.canConsume("=")) return Operator.EQUAL_TO; if (tokens.canConsume("<", "=")) return Operator.LESS_THAN_OR_EQUAL_TO; if (tokens.canConsume(">", "=")) return Operator.GREATER_THAN_OR_EQUAL_TO; if (tokens.canConsume("<")) return Operator.LESS_THAN; if (tokens.canConsume(">")) return Operator.GREATER_THAN; return null; } XPathParser( TypeSystem context ); Component parseXPath( String xpath );  }