]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.diagram/src/org/simantics/diagram/symbollibrary/ui/GroupFilter.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.diagram / src / org / simantics / diagram / symbollibrary / ui / GroupFilter.java
diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/symbollibrary/ui/GroupFilter.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/symbollibrary/ui/GroupFilter.java
new file mode 100644 (file)
index 0000000..86f79cb
--- /dev/null
@@ -0,0 +1,88 @@
+/*******************************************************************************\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.diagram.symbollibrary.ui;\r
+\r
+/**\r
+ * @author Tuukka Lehtonen\r
+ */\r
+class GroupFilter implements Comparable<GroupFilter> {\r
+    private String name;\r
+    private String filterText;\r
+    private boolean active;\r
+\r
+    public GroupFilter(String name, String filterText, boolean active) {\r
+        assert name != null;\r
+        assert filterText != null;\r
+        this.name = name;\r
+        this.filterText = filterText;\r
+        this.active = active;\r
+    }\r
+\r
+    public String getName() {\r
+        return name;\r
+    }\r
+\r
+    public void setName(String name) {\r
+        this.name = name;\r
+    }\r
+\r
+    public String getFilterText() {\r
+        return filterText;\r
+    }\r
+\r
+    public void setFilterText(String filterText) {\r
+        this.filterText = filterText;\r
+    }\r
+\r
+    public boolean isActive() {\r
+        return active;\r
+    }\r
+\r
+    public void setActive(boolean active) {\r
+        this.active = active;\r
+    }\r
+\r
+    @Override\r
+    public String toString() {\r
+        return getClass().getSimpleName() + "[" + name + ", filter=" + filterText + ", active=" + active + "]";\r
+    }\r
+\r
+    @Override\r
+    public int hashCode() {\r
+        final int prime = 31;\r
+        int result = 1;\r
+        result = prime * result + filterText.hashCode();\r
+        result = prime * result + name.hashCode();\r
+        return result;\r
+    }\r
+\r
+    @Override\r
+    public boolean equals(Object obj) {\r
+        if (this == obj)\r
+            return true;\r
+        if (obj == null)\r
+            return false;\r
+        if (!(obj instanceof GroupFilter))\r
+            return false;\r
+        GroupFilter other = (GroupFilter) obj;\r
+        if (!filterText.equals(other.filterText))\r
+            return false;\r
+        if (!name.equals(other.name))\r
+            return false;\r
+        return true;\r
+    }\r
+\r
+    @Override\r
+    public int compareTo(GroupFilter o) {\r
+        return name.compareToIgnoreCase(o.name);\r
+    }\r
+}
\ No newline at end of file