]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.diagram/src/org/simantics/diagram/symbollibrary/ui/GroupFilter.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.diagram / src / org / simantics / diagram / symbollibrary / ui / GroupFilter.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.diagram.symbollibrary.ui;
13
14 /**
15  * @author Tuukka Lehtonen
16  */
17 class GroupFilter implements Comparable<GroupFilter> {
18     private String name;
19     private String filterText;
20     private boolean active;
21
22     public GroupFilter(String name, String filterText, boolean active) {
23         assert name != null;
24         assert filterText != null;
25         this.name = name;
26         this.filterText = filterText;
27         this.active = active;
28     }
29
30     public String getName() {
31         return name;
32     }
33
34     public void setName(String name) {
35         this.name = name;
36     }
37
38     public String getFilterText() {
39         return filterText;
40     }
41
42     public void setFilterText(String filterText) {
43         this.filterText = filterText;
44     }
45
46     public boolean isActive() {
47         return active;
48     }
49
50     public void setActive(boolean active) {
51         this.active = active;
52     }
53
54     @Override
55     public String toString() {
56         return getClass().getSimpleName() + "[" + name + ", filter=" + filterText + ", active=" + active + "]";
57     }
58
59     @Override
60     public int hashCode() {
61         final int prime = 31;
62         int result = 1;
63         result = prime * result + filterText.hashCode();
64         result = prime * result + name.hashCode();
65         return result;
66     }
67
68     @Override
69     public boolean equals(Object obj) {
70         if (this == obj)
71             return true;
72         if (obj == null)
73             return false;
74         if (!(obj instanceof GroupFilter))
75             return false;
76         GroupFilter other = (GroupFilter) obj;
77         if (!filterText.equals(other.filterText))
78             return false;
79         if (!name.equals(other.name))
80             return false;
81         return true;
82     }
83
84     @Override
85     public int compareTo(GroupFilter o) {
86         return name.compareToIgnoreCase(o.name);
87     }
88 }