Codota Logo
NodeRole.matches
Code IndexAdd Codota to your IDE (free)

How to use
matches
method
in
org.batfish.role.NodeRole

Best Java code snippets using org.batfish.role.NodeRole.matches (Showing top 6 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
DateTime d =
  • Codota Iconnew DateTime()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseDateTime(text)
  • Codota IconObject instant;new DateTime(instant)
  • Smart code suggestions by Codota
}
origin: batfish/batfish

/** Does this nodeName match any of roles that match our _regex? */
private boolean nodeNameInMatchingRole(String nodeName, Set<NodeRole> roles) {
 for (NodeRole role : roles) {
  if (_regex.matcher(role.getName()).matches() && role.matches(nodeName)) {
   return true;
  }
 }
 return false;
}
origin: batfish/batfish

/**
 * Create a map from each role name to the set of nodes that play that role
 *
 * @param nodeNames The universe of nodes that we need to classify
 * @return The created map
 */
public SortedMap<String, SortedSet<String>> createRoleNodesMap(Set<String> nodeNames) {
 SortedMap<String, SortedSet<String>> roleNodesMap = new TreeMap<>();
 for (NodeRole role : _roles) {
  for (String node : nodeNames) {
   if (role.matches(node)) {
    SortedSet<String> roleNodes =
      roleNodesMap.computeIfAbsent(role.getName(), k -> new TreeSet<>());
    roleNodes.add(node);
   }
  }
 }
 return roleNodesMap;
}
origin: batfish/batfish

/**
 * Create a map from each node name to its set of roles
 *
 * @param nodeNames The universe of nodes that we need to classify
 * @return The created map
 */
public SortedMap<String, SortedSet<String>> createNodeRolesMap(Set<String> nodeNames) {
 SortedMap<String, SortedSet<String>> nodeRolesMap = new TreeMap<>();
 for (String node : nodeNames) {
  for (NodeRole role : _roles) {
   if (role.matches(node)) {
    SortedSet<String> nodeRoles = nodeRolesMap.computeIfAbsent(node, k -> new TreeSet<>());
    nodeRoles.add(role.getName());
   }
  }
 }
 return nodeRolesMap;
}
origin: batfish/batfish

 @Override
 public Set<String> resolve(SpecifierContext ctxt) {
  Optional<NodeRoleDimension> dimension = ctxt.getNodeRoleDimension(_roleDimension);
  Set<NodeRole> roles =
    dimension.isPresent()
      ? dimension.get().getRoles().stream()
        .filter(role -> _rolePattern.matcher(role.getName()).matches())
        .collect(ImmutableSet.toImmutableSet())
      : ImmutableSet.of();

  return ctxt.getConfigs().keySet().stream()
    .filter(node -> roles.stream().anyMatch(role -> role.matches(node)))
    .collect(ImmutableSet.toImmutableSet());
 }
}
origin: batfish/batfish

 @Override
 public Set<Location> resolve(SpecifierContext ctxt) {
  Optional<NodeRoleDimension> dimension = ctxt.getNodeRoleDimension(_roleDimension);
  Set<NodeRole> matchingRoles =
    dimension.isPresent()
      ? dimension.get().getRoles().stream()
        .filter(role -> _rolePattern.matcher(role.getName()).matches())
        .collect(ImmutableSet.toImmutableSet())
      : ImmutableSet.of();

  return ctxt.getConfigs().values().stream()
    .filter(node -> matchingRoles.stream().anyMatch(role -> role.matches(node.getHostname())))
    .flatMap(this::getNodeLocations)
    .collect(ImmutableSet.toImmutableSet());
 }
}
origin: batfish/batfish

 @Test
 public void matches() {
  NodeRole role = new NodeRole("hello", "a.*");

  assertThat(role.matches("a1"), equalTo(true));
  assertThat(role.matches("b1"), equalTo(false));
 }
}
org.batfish.roleNodeRolematches

Javadoc

Does the provided node name belong to this role?

Popular methods of NodeRole

  • <init>
  • getName
  • getRegex

Popular in Java

  • Making http requests using okhttp
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • requestLocationUpdates (LocationManager)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • Locale (java.util)
    A Locale object represents a specific geographical, political, or cultural region. An operation that
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement.A servlet is a small Java program that runs within
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now