]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.utils.ui/src/org/simantics/utils/ui/color/ColorValue.java
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / bundles / org.simantics.utils.ui / src / org / simantics / utils / ui / color / ColorValue.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.utils.ui.color;
13
14
15 /**
16  * 
17  * 
18  * @author Marko Luukkainen
19  *
20  */
21 public class ColorValue {
22     private Color color;
23     private double value;
24     
25     @Deprecated
26     public ColorValue() {
27         
28     }
29     
30     public ColorValue(Color color, double value) {
31         this.color = color;
32         this.value = value;
33     }
34     
35     public Color getColor() {
36         return color;
37     }
38     
39     public double getValue() {
40         return value;
41     }
42     
43     public void _setValue(double value) {
44         this.value = value;
45     }
46     
47     @Override
48     public int hashCode() {        
49         return color.hashCode() ^ new Double(value).hashCode();
50     }
51     
52     @Override
53     public boolean equals(Object obj) {
54         if (!(obj instanceof ColorValue))
55             return false;
56         ColorValue cv = (ColorValue) obj;
57         if (cv.value != value) return false;
58         if (!cv.color.equals(color)) return false;
59         return true;
60     }
61     
62 }