1 package com.puppycrawl.tools.checkstyle.filters; 20 21 25 class IntRangeFilter implements IntFilter 26 { 27 28 private static final int HASH_MULT = 29; 29 30 31 private Integer mLowerBound; 32 33 34 private Integer mUpperBound; 35 36 42 public IntRangeFilter(int aLowerBound, int aUpperBound) 43 { 44 mLowerBound = new Integer (aLowerBound); 45 mUpperBound = new Integer (aUpperBound); 46 } 47 48 49 public boolean accept(Integer aInt) 50 { 51 return ((mLowerBound.compareTo(aInt) <= 0) 52 && (mUpperBound.compareTo(aInt) >= 0)); 53 } 54 55 56 public int hashCode() 57 { 58 return HASH_MULT * mLowerBound.intValue() + mUpperBound.intValue(); 59 } 60 61 62 public boolean equals(Object aObject) 63 { 64 if (aObject instanceof IntRangeFilter) { 65 final IntRangeFilter other = (IntRangeFilter) aObject; 66 return (this.mLowerBound.equals(other.mLowerBound) 67 && this.mUpperBound.equals(other.mUpperBound)); 68 } 69 return false; 70 } 71 72 public String toString() 73 { 74 return "IntRangeFilter[" + mLowerBound + "," + mUpperBound + "]"; 75 } 76 77 } 78 | Popular Tags |