]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.utils.ui/src/org/simantics/utils/ui/color/ColorValue.java
Sync git svn branch with SVN repository r33269.
[simantics/platform.git] / bundles / org.simantics.utils.ui / src / org / simantics / utils / ui / color / ColorValue.java
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
3  * in Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.utils.ui.color;\r
13 \r
14 \r
15 /**\r
16  * \r
17  * \r
18  * @author Marko Luukkainen\r
19  *\r
20  */\r
21 public class ColorValue {\r
22     private Color color;\r
23     private double value;\r
24     \r
25     @Deprecated\r
26     public ColorValue() {\r
27         \r
28     }\r
29     \r
30     public ColorValue(Color color, double value) {\r
31         this.color = color;\r
32         this.value = value;\r
33     }\r
34     \r
35     public Color getColor() {\r
36         return color;\r
37     }\r
38     \r
39     public double getValue() {\r
40         return value;\r
41     }\r
42     \r
43     public void _setValue(double value) {\r
44         this.value = value;\r
45     }\r
46     \r
47     @Override\r
48     public int hashCode() {        \r
49         return color.hashCode() ^ new Double(value).hashCode();\r
50     }\r
51     \r
52     @Override\r
53     public boolean equals(Object obj) {\r
54         if (!(obj instanceof ColorValue))\r
55             return false;\r
56         ColorValue cv = (ColorValue) obj;\r
57         if (cv.value != value) return false;\r
58         if (!cv.color.equals(color)) return false;\r
59         return true;\r
60     }\r
61     \r
62 }\r