@Test public void testToAutomaton() { SymbolicAsPathRegex r1 = new SymbolicAsPathRegex("^40$"); SymbolicAsPathRegex r2 = new SymbolicAsPathRegex("^$"); SymbolicAsPathRegex r3 = new SymbolicAsPathRegex(UNDERSCORE + "40$"); SymbolicAsPathRegex r4 = new SymbolicAsPathRegex("^40" + UNDERSCORE); SymbolicAsPathRegex r5 = new SymbolicAsPathRegex(UNDERSCORE + "40" + UNDERSCORE + "50" + UNDERSCORE); assertThat(r1.toAutomaton(), equalTo(new RegExp("^40$").toAutomaton())); assertThat(r2.toAutomaton(), equalTo(new RegExp("^$").toAutomaton())); assertThat(r3.toAutomaton(), equalTo(new RegExp("^((0|[1-9][0-9]*) )*40$").toAutomaton())); assertThat(r4.toAutomaton(), equalTo(new RegExp("^40( (0|[1-9][0-9]*))*$").toAutomaton())); assertThat( r5.toAutomaton(), equalTo(new RegExp("^((0|[1-9][0-9]*) )*40 50( (0|[1-9][0-9]*))*$").toAutomaton())); }
@Override public Automaton toAutomaton() { String regex = ".*" + "(" + _regex + ")" + ".*"; return new RegExp(regex).toAutomaton().intersection(AS_PATH_FSM); }
SymbolicAsPathRegex extends SymbolicRegex implements Comparable<SymbolicAsPathRegex> { @Override public Automaton toAutomaton() { String regex = ".*" + "(" + _regex + ")" + ".*"; return new RegExp(regex).toAutomaton().intersection(AS_PATH_FSM); } }
SymbolicAsPathRegex extends SymbolicRegex implements Comparable<SymbolicAsPathRegex> { @Override public Automaton toAutomaton() { String regex = ".*" + "(" + _regex + ")" + ".*"; return new RegExp(regex).toAutomaton().intersection(AS_PATH_FSM); } SymbolicAsPathRegex(String regex); }
SymbolicAsPathRegex extends SymbolicRegex implements Comparable<SymbolicAsPathRegex> { @Override public Automaton toAutomaton() { String regex = ".*" + "(" + _regex + ")" + ".*"; return new RegExp(regex).toAutomaton().intersection(AS_PATH_FSM); } SymbolicAsPathRegex(String regex); @Override Automaton toAutomaton(); @Override String toString(); @Override boolean equals(@Nullable Object o); @Override int hashCode(); @Override int compareTo(SymbolicAsPathRegex that); }
SymbolicAsPathRegex extends SymbolicRegex implements Comparable<SymbolicAsPathRegex> { @Override public Automaton toAutomaton() { String regex = ".*" + "(" + _regex + ")" + ".*"; return new RegExp(regex).toAutomaton().intersection(AS_PATH_FSM); } SymbolicAsPathRegex(String regex); @Override Automaton toAutomaton(); @Override String toString(); @Override boolean equals(@Nullable Object o); @Override int hashCode(); @Override int compareTo(SymbolicAsPathRegex that); static final SymbolicAsPathRegex ALL_AS_PATHS; }