]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.browsing.ui.common/src/org/simantics/browsing/ui/common/labelers/LabelerContent.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.browsing.ui.common / src / org / simantics / browsing / ui / common / labelers / LabelerContent.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.browsing.ui.common.labelers;
13
14 import java.util.Arrays;
15 import java.util.Map;
16
17 import org.simantics.browsing.ui.content.Labeler;
18
19 public class LabelerContent {
20
21         public static LabelerContent NO_CONTENT = new LabelerContent(0, Labeler.NO_LABELS);
22
23         public final int                 category;
24     public final Map<String, String> labels;
25     
26     public LabelerContent(int category, Map<String, String> labels) {
27         this.category = category;
28         this.labels = labels;
29     }
30     
31     @Override
32     public String toString() {
33         return "LabelerContent[" + Arrays.toString(labels.values().toArray()) + "]";
34     }
35     
36     @Override
37     public int hashCode() {
38         return category + 31 * labels.hashCode();
39     }
40     
41     @Override
42     public boolean equals(Object object) {
43         
44         if (this == object)
45             return true;
46         else if (object == null)
47             return false;
48         else if (!(object instanceof LabelerContent))
49             return false;
50
51         LabelerContent lc = (LabelerContent)object;
52         return category == lc.category && labels.equals(lc.labels);
53         
54     }
55     
56 }