Revision: 1368
          http://svn.sourceforge.net/spring-rich-c/?rev=1368&view=rev
Author:   mathiasbr
Date:     2006-09-04 05:49:49 -0700 (Mon, 04 Sep 2006)

Log Message:
-----------
add iterator method to get access to the group elements

Modified Paths:
--------------
    
trunk/spring-richclient/support/src/main/java/org/springframework/rules/constraint/InGroup.java

Modified: 
trunk/spring-richclient/support/src/main/java/org/springframework/rules/constraint/InGroup.java
===================================================================
--- 
trunk/spring-richclient/support/src/main/java/org/springframework/rules/constraint/InGroup.java
     2006-09-04 08:36:03 UTC (rev 1367)
+++ 
trunk/spring-richclient/support/src/main/java/org/springframework/rules/constraint/InGroup.java
     2006-09-04 12:49:49 UTC (rev 1368)
@@ -17,37 +17,47 @@
 
 import java.util.Arrays;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.Set;
 
 import org.springframework.core.closure.Constraint;
 
 /**
- * A constraint that tests if an argument is one of a group.  Similiar to
- * a database's 'in' operator, and more convenient than using a bunch of ORs.
+ * A constraint that tests if an argument is one of a group. Similiar to a 
database's 'in' operator, and more convenient
+ * than using a bunch of ORs.
  * 
- * @author  Keith Donald
+ * @author Keith Donald
  */
 public class InGroup implements Constraint {
-       private Set group;
+    private Set group;
 
-       public InGroup(Set group) {
-               this.group = new HashSet(group);
-       }
+    public InGroup(Set group) {
+        this.group = new HashSet(group);
+    }
 
-       public InGroup(Object[] group) {
-               this.group = new HashSet(Arrays.asList(group));
-       }
+    public InGroup(Object[] group) {
+        this.group = new HashSet(Arrays.asList(group));
+    }
 
-       /**
-        * Tests the variable argument value is in this group.
-        * 
-        * @see 
org.springframework.core.closure.Constraint#test(java.lang.Object)
-        */
-       public boolean test(Object value) {
-               return group.contains(value);
-       }
+    /**
+     * returns an iterator of the group elements
+     * 
+     * @return iterator containing the elements of the group.
+     */
+    public Iterator iterator() {
+        return group.iterator();
+    }
 
-       public String toString() {
-               return "inGroup [" + group + "]";
-       }
+    /**
+     * Tests the variable argument value is in this group.
+     * 
+     * @see org.springframework.core.closure.Constraint#test(java.lang.Object)
+     */
+    public boolean test(Object value) {
+        return group.contains(value);
+    }
+
+    public String toString() {
+        return "inGroup [" + group + "]";
+    }
 }
\ No newline at end of file


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
spring-rich-c-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spring-rich-c-cvs

Reply via email to