Tabnine Logo
Exclusion
Code IndexAdd Tabnine to your IDE (free)

How to use
Exclusion
in
org.batfish.datamodel.questions

Best Java code snippets using org.batfish.datamodel.questions.Exclusion (Showing top 13 results out of 315)

origin: batfish/batfish

/**
 * Given an initial set of rows produced by an {@link org.batfish.common.Answerer}, this procedure
 * processes exclusions, assertions, and summary to update this object.
 *
 * @param question The question that generated the initial set of rows
 * @param initialSet The initial set of rows
 */
public void postProcessAnswer(Question question, Iterable<Row> initialSet) {
 initialSet.forEach(
   initialRow -> {
    // exclude or not?
    Exclusion exclusion = Exclusion.covered(initialRow, question.getExclusions());
    if (exclusion != null) {
     addExcludedRow(initialRow, exclusion.getName());
    } else {
     addRow(initialRow);
    }
   });
 setSummary(computeSummary(question.getAssertion()));
}
origin: batfish/batfish

/**
 * Checks is this row is covered by the provided exclusion.
 *
 * @param exclusion The exclusion to check against.
 * @return The result of the check
 */
public boolean isCovered(ObjectNode exclusion) {
 return Exclusion.firstCoversSecond(exclusion, _data);
}
origin: batfish/batfish

/**
 * Checks if {@code row} is covered by one of the exlusions
 *
 * @param row The object whose coverage is to be checked
 * @return The exclusion that covers {@code row}. null if no such exclusion exists
 */
public static Exclusion covered(Row row, List<Exclusion> exclusions) {
 if (exclusions == null) {
  return null;
 }
 for (Exclusion exclusion : exclusions) {
  if (row.isCovered(exclusion.getExclusion())) {
   return exclusion;
  }
 }
 return null;
}
origin: batfish/batfish

new Exclusion(
  null,
  (ObjectNode)
origin: batfish/batfish

testQuestion.setExclusions(
  ImmutableList.of(
    new Exclusion(
      "exc",
      BatfishObjectMapper.mapper()
origin: batfish/batfish

boolean covered = false;
for (JsonNode secondElement : second) {
 if (firstCoversSecond(firstElement, secondElement)) {
  covered = true;
  break;
 return false;
if (!firstCoversSecond(first.get(key), second.get(key))) {
 return false;
origin: batfish/batfish

Row answerValues =
  computeRowValues(query.getExtractions(), query.getCompositions(), result, tableMetadata);
Exclusion exclusion = Exclusion.covered(answerValues, question.getExclusions());
if (exclusion != null) {
 answer.addExcludedRow(answerValues, exclusion.getName());
} else {
 answer.addRow(answerValues);
origin: batfish/batfish

@Test
public void firstCoversSecondObjectCovers() {
 JsonNode node1 =
   BatfishObjectMapper.mapper().createObjectNode().set("key1", new TextNode("value"));
 JsonNode node2 =
   BatfishObjectMapper.mapper().createObjectNode().set("key1", new TextNode("value"));
 // we couldn't just chain the two sets because set returns JsonNode, not ObjectNode
 ((ObjectNode) node2).set("key2", new TextNode("value"));
 boolean result = Exclusion.firstCoversSecond(node1, node2);
 assertThat(result, equalTo(true));
}
origin: batfish/batfish

@Test
public void firstCoversSecondObjectMissingKey() {
 JsonNode node1 =
   BatfishObjectMapper.mapper().createObjectNode().set("key1", new TextNode("value"));
 JsonNode node2 =
   BatfishObjectMapper.mapper().createObjectNode().set("key2", new TextNode("value"));
 boolean result = Exclusion.firstCoversSecond(node1, node2);
 assertThat(result, equalTo(false));
}
origin: batfish/batfish

 @Test
 public void firstCoversSecondValueMismatch() {
  JsonNode node1 = new TextNode("2");
  JsonNode node2 = new IntNode(2); // different type

  boolean result = Exclusion.firstCoversSecond(node1, node2);

  assertThat(result, equalTo(false));
 }
}
origin: batfish/batfish

@Test
public void firstCoversSecondValueMatch() {
 JsonNode node1 = new TextNode("abc");
 JsonNode node2 = new TextNode("abc");
 boolean result = Exclusion.firstCoversSecond(node1, node2);
 assertThat(result, equalTo(true));
}
origin: batfish/batfish

@Test
public void firstCoversSecondObjectMismatchType() {
 JsonNode node1 =
   BatfishObjectMapper.mapper().createObjectNode().set("key1", new TextNode("value"));
 JsonNode node2 = BatfishObjectMapper.mapper().createArrayNode().add(new TextNode("value"));
 boolean result = Exclusion.firstCoversSecond(node1, node2);
 assertThat(result, equalTo(false));
}
origin: batfish/batfish

@Test
public void firstCoversSecondArrayCovers() {
 JsonNode node1 = BatfishObjectMapper.mapper().createArrayNode().add(new TextNode("value"));
 JsonNode node2 =
   BatfishObjectMapper.mapper()
     .createArrayNode()
     .add(new TextNode("value2"))
     .add(new TextNode("value"));
 boolean result = Exclusion.firstCoversSecond(node1, node2);
 assertThat(result, equalTo(true));
}
org.batfish.datamodel.questionsExclusion

Javadoc

Describes rows to be excluded in a org.batfish.datamodel.table.TableAnswerElement. An Exclusion may "cover" multiple rows and cause them to be excluded.

Most used methods

  • <init>
  • covered
    Checks if row is covered by one of the exlusions
  • firstCoversSecond
    Evaluates if the first object covers the second object. For it to be true, the two objects should be
  • getName
  • getExclusion

Popular in Java

  • Reading from database using SQL prepared statement
  • notifyDataSetChanged (ArrayAdapter)
  • runOnUiThread (Activity)
  • putExtra (Intent)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now