You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ki...@apache.org on 2013/05/15 04:34:45 UTC
svn commit: r1482663 - in /commons/proper/functor/trunk:
core/src/main/java/org/apache/commons/functor/core/Limit.java
core/src/test/java/org/apache/commons/functor/core/TestLimit.java
src/changes/changes.xml
Author: kinow
Date: Wed May 15 02:34:45 2013
New Revision: 1482663
URL: http://svn.apache.org/r1482663
Log:
[FUNCTOR-27] add static method to Limit to create new instances
Modified:
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/core/Limit.java
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/core/TestLimit.java
commons/proper/functor/trunk/src/changes/changes.xml
Modified: commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/core/Limit.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/core/Limit.java?rev=1482663&r1=1482662&r2=1482663&view=diff
==============================================================================
--- commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/core/Limit.java (original)
+++ commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/core/Limit.java Wed May 15 02:34:45 2013
@@ -121,4 +121,17 @@ public final class Limit implements Pred
}
//default == equals/hashCode due to statefulness
+
+ // static methods
+ // ------------------------------------------------------------------------
+
+ /**
+ * Get a Limit instance for the specified value.
+ * @param count limit
+ * @return Limit
+ */
+ public static Limit of(int count) {
+ return new Limit(count);
+ }
+
}
Modified: commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/core/TestLimit.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/core/TestLimit.java?rev=1482663&r1=1482662&r2=1482663&view=diff
==============================================================================
--- commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/core/TestLimit.java (original)
+++ commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/core/TestLimit.java Wed May 15 02:34:45 2013
@@ -16,6 +16,7 @@
*/
package org.apache.commons.functor.core;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -94,4 +95,13 @@ public class TestLimit extends BaseFunct
assertObjectsAreNotEqual(new Limit(2), limit);
assertTrue(!limit.equals(null));
}
+
+ @Test
+ public void testLimits() {
+ Limit limit = new Limit(1);
+ assertEquals(Limit.of(1), limit);
+
+ assertObjectsAreEqual(Limit.of(1), limit);
+ assertObjectsAreNotEqual(Limit.of(3), limit);
+ }
}
Modified: commons/proper/functor/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/changes/changes.xml?rev=1482663&r1=1482662&r2=1482663&view=diff
==============================================================================
--- commons/proper/functor/trunk/src/changes/changes.xml (original)
+++ commons/proper/functor/trunk/src/changes/changes.xml Wed May 15 02:34:45 2013
@@ -23,6 +23,9 @@
</properties>
<body>
<release version="1.0" date="2012-??-??" description="First release.">
+ <action issue="FUNCTOR-27" dev="kinow">
+ Add static Limit#of method to create new Limit's.
+ </action>
<action issue="FUNCTOR-23" dev="simonetripodi" due-to="Liviu Tudor">
aggregator.xml generates broken JavaDoc links
</action>