commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject svn commit: r893083 - /commons/proper/lang/trunk/src/java/org/apache/commons/lang3/Range.java
Date Tue, 22 Dec 2009 06:23:28 GMT
Author: bayard
Date: Tue Dec 22 06:23:27 2009
New Revision: 893083

URL: http://svn.apache.org/viewvc?rev=893083&view=rev
Log:
Making class final, switching getMin/Max usage to this.min/max usage. LANG-551

Modified:
    commons/proper/lang/trunk/src/java/org/apache/commons/lang3/Range.java

Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang3/Range.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang3/Range.java?rev=893083&r1=893082&r2=893083&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/java/org/apache/commons/lang3/Range.java (original)
+++ commons/proper/lang/trunk/src/java/org/apache/commons/lang3/Range.java Tue Dec 22 06:23:27
2009
@@ -26,8 +26,7 @@
  * @since 3.0
  * @version $Id: Range.java 830032 2009-10-27 00:15:00Z scolebourne $
  */
-// TODO: Make class final and use fields instead of getters?
-public class Range<T> implements Serializable {
+public final class Range<T> implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
@@ -174,7 +173,7 @@
         if(element == null) {
             return false;
         }
-        return (comparator.compare(element, getMinimum()) > -1) && (comparator.compare(element,
getMaximum()) < 1);
+        return (comparator.compare(element, this.minimum) > -1) && (comparator.compare(element,
this.maximum) < 1);
     }
 
     /**
@@ -190,7 +189,7 @@
             return false;
         }
         
-        return this.comparator.compare(element, getMinimum()) < 0;
+        return this.comparator.compare(element, this.minimum) < 0;
     }
 
     /**
@@ -206,7 +205,7 @@
             return false;
         }
         
-        return this.comparator.compare(element, getMaximum()) > 0;
+        return this.comparator.compare(element, this.maximum) > 0;
     }
 
     /**
@@ -268,8 +267,8 @@
         if (range == null) {
             return false;
         }
-        return range.contains(getMinimum())
-            || range.contains(getMaximum())
+        return range.contains(this.minimum)
+            || range.contains(this.maximum)
             || contains(range.getMinimum());
     }
 
@@ -307,8 +306,8 @@
     public int hashCode() {
         int result = 17;
         result = 37 * result + getClass().hashCode();
-        result = 37 * result + getMinimum().hashCode();
-        result = 37 * result + getMaximum().hashCode();
+        result = 37 * result + this.minimum.hashCode();
+        result = 37 * result + this.maximum.hashCode();
         return result;
     }
 
@@ -323,9 +322,9 @@
     public String toString() {
         StringBuilder buf = new StringBuilder(32);
         buf.append("Range[");
-        buf.append(getMinimum());
+        buf.append(this.minimum);
         buf.append(',');
-        buf.append(getMaximum());
+        buf.append(this.maximum);
         buf.append(']');
         return buf.toString();
     }



Mime
View raw message