1 package com.puppycrawl.tools.checkstyle.api; 20 21 27 public final class SeverityLevelCounter implements AuditListener 28 { 29 30 private SeverityLevel mLevel; 31 32 33 private int mCount; 34 35 39 public SeverityLevelCounter(SeverityLevel aLevel) 40 { 41 if (aLevel == null) { 42 throw new IllegalArgumentException (); 43 } 44 mLevel = aLevel; 45 } 46 47 48 public void addError(AuditEvent aEvt) 49 { 50 if (mLevel.equals(aEvt.getSeverityLevel())) { 51 mCount++; 52 } 53 } 54 55 56 public void addException(AuditEvent aEvt, Throwable aThrowable) 57 { 58 if (SeverityLevel.ERROR.equals(mLevel)) { 59 mCount++; 60 } 61 } 62 63 64 public void auditStarted(AuditEvent aEvt) 65 { 66 mCount = 0; 67 } 68 69 70 public void fileStarted(AuditEvent aEvt) 71 { 72 } 73 74 75 public void auditFinished(AuditEvent aEvt) 76 { 77 } 78 79 80 public void fileFinished(AuditEvent aEvt) 81 { 82 } 83 84 88 public int getCount() 89 { 90 return mCount; 91 } 92 } 93 | Popular Tags |