001// PrintNullDiffVisitor.java
002
003package daikon.diff;
004
005import daikon.inv.Invariant;
006import java.io.PrintStream;
007
008/**
009 * <B>PrintNullDiffVIsitor</B> is a NodeVisitor that only reports an invariant as different when its
010 * existence in one set is not in another set. This avoids reported differences simply in confidence
011 * changes and other extra-sensitive reports.
012 */
013public class PrintNullDiffVisitor extends PrintDifferingInvariantsVisitor {
014
015  /** Create an instance of PrintNullDiffVisitor. */
016  public PrintNullDiffVisitor(PrintStream ps, boolean verbose) {
017    super(ps, verbose, false);
018  }
019
020  @Override
021  public void visit(InvNode node) {
022    Invariant inv1 = node.getInv1();
023    Invariant inv2 = node.getInv2();
024    // If (inv1 XOR inv2) is null
025    if (inv1 != null ^ inv2 == null) {
026      super.visit(node);
027    }
028  }
029}