@Override protected void visit(RENode.Disjunction disjunction) throws RuntimeException { if (current != null) { RENode.Alternative alternative = disjunction.getAlternative(); if (alternative != null) { alternative.accept(this); } } else { RENode.Alternative alternative = disjunction.getAlternative(); if (alternative != null) { current = new Alternative(); alternative.accept(this); current.suffix = current.buffer.toString(); current.buffer.setLength(0); alternatives.add(current); current = null; } // RENode.Disjunction next = disjunction.getNext(); if (next != null) { next.accept(this); } } }
for (int i = 0;i < alt.size();i++) { ValueResolverFactory.Alternative v = alt.get(i); StringBuilder valueMatcher = v.getValueMatcher(); valueMatcher.insert(0, '^'); valueMatcher.append("$"); renderingRegexes[i] = router.compile(valueMatcher.toString()); templatePrefixes[i] = v.getPrefix(); templateSuffixes[i] = v.getSuffix();
for (int i = 0;i < alt.size();i++) { ValueResolverFactory.Alternative v = alt.get(i); StringBuilder valueMatcher = v.getValueMatcher(); valueMatcher.insert(0, '^'); valueMatcher.append("$"); renderingRegexes[i] = router.compile(valueMatcher.toString()); templatePrefixes[i] = v.getPrefix(); templateSuffixes[i] = v.getSuffix();
@Override protected void visit(RENode.Disjunction disjunction) throws RuntimeException { if (current != null) { RENode.Alternative alternative = disjunction.getAlternative(); if (alternative != null) { alternative.accept(this); } } else { RENode.Alternative alternative = disjunction.getAlternative(); if (alternative != null) { current = new Alternative(); alternative.accept(this); current.suffix = current.buffer.toString(); current.buffer.setLength(0); alternatives.add(current); current = null; } // RENode.Disjunction next = disjunction.getNext(); if (next != null) { next.accept(this); } } }
private static void assertSatisfied(String expression, String... expected) throws Exception { RENode root = new REParser(expression).parse(); List<ValueResolverFactory.Alternative> alternatives = new ValueResolverFactory().foo(root); assertEquals(expected.length, alternatives.size()); for (int i = 0;i < expected.length;i++) { assertEquals(expected[i], alternatives.get(i).getResolvingExpression().toString()); } }
private static void assertSatisfied(String expression, String... expected) throws Exception { RENode root = new REParser(expression).parse(); root.accept(new CaptureGroupTransformation()); List<ValueResolverFactory.Alternative> alternatives = new ValueResolverFactory().foo(root); assertEquals(expected.length, alternatives.size()); for (int i = 0;i < expected.length;i++) { assertEquals(expected[i], alternatives.get(i).getResolvingExpression().toString()); } }
private static void assertSatisfied(String expression, String... expected) throws Exception { RENode root = new REParser(expression).parse(); List<ValueResolverFactory.Alternative> alternatives = new ValueResolverFactory().foo(root); assertEquals(expected.length, alternatives.size()); for (int i = 0;i < expected.length;i++) { assertEquals(expected[i], alternatives.get(i).getResolvingExpression().toString()); } }
private static void assertSatisfied(String expression, String... expected) throws Exception { RENode root = new REParser(expression).parse(); root.accept(new CaptureGroupTransformation()); List<ValueResolverFactory.Alternative> alternatives = new ValueResolverFactory().foo(root); assertEquals(expected.length, alternatives.size()); for (int i = 0;i < expected.length;i++) { assertEquals(expected[i], alternatives.get(i).getResolvingExpression().toString()); } }