]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.project/src/org/simantics/project/GroupFilters.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.project / src / org / simantics / project / GroupFilters.java
index ef6d4edbf9aa6908efb3a6da7e767c7e14d4495f..67366be1f1e6958ae2ef6fa90aba4895209c8913 100644 (file)
@@ -1,85 +1,85 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.project;\r
-\r
-import java.util.Set;\r
-\r
-import org.simantics.project.features.registry.GroupReference;\r
-\r
-/**\r
- * Utilities for constructing {@link GroupFilter} instances.\r
- * \r
- * @author Tuukka Lehtonen\r
- */\r
-public final class GroupFilters {\r
-\r
-    public static GroupFilter constant(final boolean answer) {\r
-        return new GroupFilter() {\r
-            @Override\r
-            public boolean accept(GroupReference ref) {\r
-                return answer;\r
-            }\r
-        };\r
-    }\r
-\r
-    private static final GroupFilter ACCEPT_ALL = constant(true);\r
-    private static final GroupFilter DENY_ALL = constant(false);\r
-\r
-    public static GroupFilter acceptAll() {\r
-        return ACCEPT_ALL;\r
-    }\r
-\r
-    public static GroupFilter denyAll() {\r
-        return DENY_ALL;\r
-    }\r
-\r
-    /**\r
-     * Constructs a group filter that accepts only equal matches of all the\r
-     * group references provided in the argument set.\r
-     * \r
-     * @param refs the group references to accept\r
-     * @return a filter accepting the specified set of group references\r
-     */\r
-    public static GroupFilter containsEqual(final Set<GroupReference> refs) {\r
-        return new GroupFilter() {\r
-            @Override\r
-            public boolean accept(GroupReference ref) {\r
-                return refs.contains(ref);\r
-            }\r
-        };\r
-    }\r
-\r
-    /**\r
-     * Constructs a group filter that accepts groups that include one or\r
-     * more of the specified groups. Inclusion means that:\r
-     * <ol>\r
-     * <li>group ID's are equal</li>\r
-     * <li>if tested group has a version or version range it must include\r
-     * the version in the group of the specified set</li>\r
-     * </ol>\r
-     * \r
-     * @param refs\r
-     * @return\r
-     */\r
-    public static GroupFilter includesVersion(final Set<GroupReference> refs) {\r
-        return new GroupFilter() {\r
-            @Override\r
-            public boolean accept(GroupReference range) {\r
-                for (GroupReference ref : refs)\r
-                    if (range.includes(ref))\r
-                        return true;\r
-                return false;\r
-            }\r
-        };\r
-    }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.project;
+
+import java.util.Set;
+
+import org.simantics.project.features.registry.GroupReference;
+
+/**
+ * Utilities for constructing {@link GroupFilter} instances.
+ * 
+ * @author Tuukka Lehtonen
+ */
+public final class GroupFilters {
+
+    public static GroupFilter constant(final boolean answer) {
+        return new GroupFilter() {
+            @Override
+            public boolean accept(GroupReference ref) {
+                return answer;
+            }
+        };
+    }
+
+    private static final GroupFilter ACCEPT_ALL = constant(true);
+    private static final GroupFilter DENY_ALL = constant(false);
+
+    public static GroupFilter acceptAll() {
+        return ACCEPT_ALL;
+    }
+
+    public static GroupFilter denyAll() {
+        return DENY_ALL;
+    }
+
+    /**
+     * Constructs a group filter that accepts only equal matches of all the
+     * group references provided in the argument set.
+     * 
+     * @param refs the group references to accept
+     * @return a filter accepting the specified set of group references
+     */
+    public static GroupFilter containsEqual(final Set<GroupReference> refs) {
+        return new GroupFilter() {
+            @Override
+            public boolean accept(GroupReference ref) {
+                return refs.contains(ref);
+            }
+        };
+    }
+
+    /**
+     * Constructs a group filter that accepts groups that include one or
+     * more of the specified groups. Inclusion means that:
+     * <ol>
+     * <li>group ID's are equal</li>
+     * <li>if tested group has a version or version range it must include
+     * the version in the group of the specified set</li>
+     * </ol>
+     * 
+     * @param refs
+     * @return
+     */
+    public static GroupFilter includesVersion(final Set<GroupReference> refs) {
+        return new GroupFilter() {
+            @Override
+            public boolean accept(GroupReference range) {
+                for (GroupReference ref : refs)
+                    if (range.includes(ref))
+                        return true;
+                return false;
+            }
+        };
+    }
+
+}