View Javadoc

1   /**
2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3    */
4   package net.sourceforge.pmd.lang.dfa.report;
5   
6   import net.sourceforge.pmd.RuleViolation;
7   
8   public class ViolationNode extends AbstractReportNode {
9   
10      private RuleViolation ruleViolation;
11  
12      public ViolationNode(RuleViolation violation) {
13          this.ruleViolation = violation;
14      }
15  
16      public RuleViolation getRuleViolation() {
17          return ruleViolation;
18      }
19  
20      public boolean equalsNode(AbstractReportNode arg0) {
21          if (!(arg0 instanceof ViolationNode)) {
22              return false;
23          }
24  
25          RuleViolation rv = ((ViolationNode) arg0).getRuleViolation();
26  
27          return rv.getFilename().equals(getRuleViolation().getFilename()) &&
28          	rv.getBeginLine() == getRuleViolation().getBeginLine() &&
29          	rv.getBeginColumn() == getRuleViolation().getBeginColumn() &&
30          	rv.getEndLine() == getRuleViolation().getEndLine() &&
31          	rv.getEndColumn()== getRuleViolation().getEndColumn() &&
32          	rv.getVariableName().equals(getRuleViolation().getVariableName());
33      }
34  
35  }