]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.charts/src/org/simantics/charts/ui/ChartLinkData.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.charts / src / org / simantics / charts / ui / ChartLinkData.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2011 Association for Decentralized Information Management in
3  * 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.charts.ui;
13
14 import org.simantics.databoard.util.ObjectUtils;
15
16 /**
17  * Shared time in the desktop environment when analysing data. 
18  *
19  * @author toni.kalajainen@semantum.fi
20  */
21 public class ChartLinkData /*extends Bean*/ {
22         
23     // Actually is TimeSeriesEditor itself
24         public transient Object sender;
25         public double from, end, sx;
26         public Double valueTipTime; 
27
28         public ChartLinkData() {}
29         
30         public ChartLinkData(Object sender, double from, double end, double sx) {
31                 this.sender = sender;
32                 this.from = from;
33                 this.end = end;
34                 this.sx = sx;
35         }       
36         
37         @Override
38         public int hashCode() {
39         long bits1 = Double.doubleToLongBits(from);
40         long bits2 = Double.doubleToLongBits(end);
41         long bits3 = Double.doubleToLongBits(sx);
42         long bits4 = valueTipTime==null?0:Double.doubleToLongBits(valueTipTime);
43         int hash = (int) (
44                         (bits1 ^ (bits1 >>> 32)) + 
45                         (bits2 ^ (bits2 >>> 32)) +
46                         (bits3 ^ (bits3 >>> 32)) +
47                         (bits4 ^ (bits4 >>> 32)) );
48         return hash;
49         }
50         
51         @Override
52         public boolean equals(Object obj) {
53                 if (obj ==null) return false;
54                 if (obj instanceof ChartLinkData==false) return false;
55                 ChartLinkData other = (ChartLinkData) obj;
56                 return from==other.from &&
57                                 end==other.end &&
58                                 sx==other.sx &&
59                                 ObjectUtils.objectEquals(valueTipTime, other.valueTipTime);
60         }
61
62 }