View Javadoc

1   package net.sourceforge.pmd.dfa.report;
2   
3   import net.sourceforge.pmd.RuleViolation;
4   import net.sourceforge.pmd.IRuleViolation;
5   
6   public class ViolationNode extends AbstractReportNode {
7   
8       private IRuleViolation ruleViolation;
9   
10      public ViolationNode(IRuleViolation violation) {
11          this.ruleViolation = violation;
12      }
13  
14      public IRuleViolation getRuleViolation() {
15          return ruleViolation;
16      }
17  
18      public boolean equalsNode(AbstractReportNode arg0) {
19          if (!(arg0 instanceof ViolationNode)) {
20              return false;
21          }
22  
23          ViolationNode vn = (ViolationNode) arg0;
24  
25          return vn.getRuleViolation().getFilename().equals(this.getRuleViolation().getFilename()) &&
26                  vn.getRuleViolation().getBeginLine() == this.getRuleViolation().getBeginLine() &&
27                  vn.getRuleViolation().getVariableName().equals(this.getRuleViolation().getVariableName());
28      }
29  
30  }