[
https://issues.apache.org/jira/browse/FUNCTOR-27?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13657836#comment-13657836
]
Bruno P. Kinoshita commented on FUNCTOR-27:
-------------------------------------------
[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>
> Add static method to create a Limit like in other classes in [functor]
> ----------------------------------------------------------------------
>
> Key: FUNCTOR-27
> URL: https://issues.apache.org/jira/browse/FUNCTOR-27
> Project: Commons Functor
> Issue Type: Improvement
> Reporter: Bruno P. Kinoshita
> Assignee: Bruno P. Kinoshita
> Priority: Trivial
>
> Other classes in oac.functor.core provide static methods to create the
> objects (NoOp#instance, Constant#of, LeftIdentity#predicate, etc), but Limit
> is missing one.
> It could be Limit#of(i:int), that would simply invoke Limit(i:int)
> constructor.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira