@Test public void shouldParseOrderByMultipleAttributeNameClauses() { assertThat(parser.parseOrderBy(tokenize("order by @a1,@a2")), is(orderBy(asc(nameTest("a1")), asc(nameTest("a2"))))); assertThat(parser.parseOrderBy(tokenize("order by @a1 ascending , @a2 ascending")), is(orderBy(asc(nameTest("a1")), asc(nameTest("a2"))))); assertThat(parser.parseOrderBy(tokenize("order by @a1 descending, @a2 ascending")), is(orderBy(desc(nameTest("a1")), asc(nameTest("a2"))))); assertThat(parser.parseOrderBy(tokenize("order by @a1 ascending , @a2 descending")), is(orderBy(asc(nameTest("a1")), desc(nameTest("a2"))))); assertThat(parser.parseOrderBy(tokenize("order by @a1 descending, @a2 descending")), is(orderBy(desc(nameTest("a1")), desc(nameTest("a2"))))); assertThat(parser.parseOrderBy(tokenize("order by @pre:a1, @pre:a2")), is(orderBy(asc(nameTest("pre", "a1")), asc(nameTest("pre", "a2"))))); assertThat(parser.parseOrderBy(tokenize("order by @a1 ascending, @pre:a2 ascending")), is(orderBy(asc(nameTest("a1")), asc(nameTest("pre", "a2"))))); assertThat(parser.parseOrderBy(tokenize("order by @a1 descending, @pre:a2 ascending")), is(orderBy(desc(nameTest("a1")), asc(nameTest("pre", "a2"))))); assertThat(parser.parseOrderBy(tokenize("order by @a1 ascending, @pre:a2 descending")), is(orderBy(asc(nameTest("a1")), desc(nameTest("pre", "a2"))))); assertThat(parser.parseOrderBy(tokenize("order by @a1 descending, @pre:a2 descending")), is(orderBy(desc(nameTest("a1")), desc(nameTest("pre", "a2"))))); }
protected OrderBy parseOrderBy( TokenStream tokens ) { if (tokens.canConsume("order", "by")) { List<OrderBySpec> specs = new ArrayList<OrderBySpec>(); do { OrderBySpec spec = parseOrderBySpec(tokens); specs.add(spec); } while (tokens.canConsume(',')); if (!specs.isEmpty()) return new OrderBy(specs); } return null; }
XPathParser { protected OrderBy parseOrderBy( TokenStream tokens ) { if (tokens.canConsume("order", "by")) { List<OrderBySpec> specs = new ArrayList<OrderBySpec>(); do { OrderBySpec spec = parseOrderBySpec(tokens); specs.add(spec); } while (tokens.canConsume(',')); if (!specs.isEmpty()) return new OrderBy(specs); } return null; } }
XPathParser { protected OrderBy parseOrderBy( TokenStream tokens ) { if (tokens.canConsume("order", "by")) { List<OrderBySpec> specs = new ArrayList<OrderBySpec>(); do { OrderBySpec spec = parseOrderBySpec(tokens); specs.add(spec); } while (tokens.canConsume(',')); if (!specs.isEmpty()) return new OrderBy(specs); } return null; } XPathParser( TypeSystem context ); }
XPathParser { protected OrderBy parseOrderBy( TokenStream tokens ) { if (tokens.canConsume("order", "by")) { List<OrderBySpec> specs = new ArrayList<OrderBySpec>(); do { OrderBySpec spec = parseOrderBySpec(tokens); specs.add(spec); } while (tokens.canConsume(',')); if (!specs.isEmpty()) return new OrderBy(specs); } return null; } XPathParser( TypeSystem context ); Component parseXPath( String xpath ); }
XPathParser { protected OrderBy parseOrderBy( TokenStream tokens ) { if (tokens.canConsume("order", "by")) { List<OrderBySpec> specs = new ArrayList<OrderBySpec>(); do { OrderBySpec spec = parseOrderBySpec(tokens); specs.add(spec); } while (tokens.canConsume(',')); if (!specs.isEmpty()) return new OrderBy(specs); } return null; } XPathParser( TypeSystem context ); Component parseXPath( String xpath );  }