@Test public void getMatchingNodesByName() { NodesSpecifier specifier = new NodesSpecifier("name:lhr-.*"); String matchingRouter = "lhr-border1"; String nonMatchingRouter = "svr-border1"; Set<String> nodes = new ImmutableSet.Builder<String>().add(matchingRouter).add(nonMatchingRouter).build(); Set<String> matchingNodes = specifier.getMatchingNodesByName(nodes); assertThat(matchingNodes, hasItem(matchingRouter)); assertThat(matchingNodes, not(hasItem(nonMatchingRouter))); }
public Set<String> getMatchingNodesByName(Set<String> nodes) { return nodes.stream() .filter(n -> _regex.matcher(n).matches()) .collect(ImmutableSet.toImmutableSet()); }
NodesSpecifier { public Set<String> getMatchingNodesByName(Set<String> nodes) { return nodes.stream() .filter(n -> _regex.matcher(n).matches()) .collect(ImmutableSet.toImmutableSet()); } }
NodesSpecifier { public Set<String> getMatchingNodesByName(Set<String> nodes) { return nodes.stream() .filter(n -> _regex.matcher(n).matches()) .collect(ImmutableSet.toImmutableSet()); } NodesSpecifier(String expression, boolean caseSensitive); @JsonCreator  NodesSpecifier(String expression); }
NodesSpecifier { public Set<String> getMatchingNodesByName(Set<String> nodes) { return nodes.stream() .filter(n -> _regex.matcher(n).matches()) .collect(ImmutableSet.toImmutableSet()); } NodesSpecifier(String expression, boolean caseSensitive); @JsonCreator  NodesSpecifier(String expression); @Override boolean equals(Object obj); static List<AutocompleteSuggestion> autoComplete(
      String query, Set<String> nodes, NodeRolesData nodeRoleData); String getExpression(); Set<String> getMatchingNodes(IBatfish batfish, NetworkSnapshot snapshot); @JsonIgnore Set<String> getMatchingNodes(SpecifierContext ctxt); Set<String> getMatchingNodesByName(Set<String> nodes); Set<String> getMatchingNodesByRole(NodeRoleDimension roleDimension, Set<String> nodes); @JsonIgnore Pattern getRegex(); @JsonIgnore String getRoleDimension(); @JsonIgnore Type getType(); @JsonIgnore boolean getCaseSensitive(); @Override int hashCode(); @Override @JsonValue String toString(); }
NodesSpecifier { public Set<String> getMatchingNodesByName(Set<String> nodes) { return nodes.stream() .filter(n -> _regex.matcher(n).matches()) .collect(ImmutableSet.toImmutableSet()); } NodesSpecifier(String expression, boolean caseSensitive); @JsonCreator  NodesSpecifier(String expression); @Override boolean equals(Object obj); static List<AutocompleteSuggestion> autoComplete(
      String query, Set<String> nodes, NodeRolesData nodeRoleData); String getExpression(); Set<String> getMatchingNodes(IBatfish batfish, NetworkSnapshot snapshot); @JsonIgnore Set<String> getMatchingNodes(SpecifierContext ctxt); Set<String> getMatchingNodesByName(Set<String> nodes); Set<String> getMatchingNodesByRole(NodeRoleDimension roleDimension, Set<String> nodes); @JsonIgnore Pattern getRegex(); @JsonIgnore String getRoleDimension(); @JsonIgnore Type getType(); @JsonIgnore boolean getCaseSensitive(); @Override int hashCode(); @Override @JsonValue String toString(); static final NodesSpecifier ALL; static final NodesSpecifier NONE; }