]> gerrit.simantics Code Review - simantics/sysdyn.git/blob
fb3522775d4803ade162b277eeb3b02b8cf80cc5
[simantics/sysdyn.git] /
1 package org.simantics.jfreechart.chart.properties;\r
2 \r
3 public class ChartVariable implements Comparable<ChartVariable>{\r
4         \r
5         private String rvi;\r
6         private String label;\r
7         \r
8         public ChartVariable(String rvi) {\r
9                 this.rvi = rvi;\r
10         }\r
11         \r
12         public ChartVariable(String rvi, String label) {\r
13                 this.rvi = rvi;\r
14                 this.label = label;\r
15         }\r
16         \r
17         public String getRvi() {\r
18                 return rvi;\r
19         }\r
20         \r
21         public String getLabel() {\r
22                 return label;\r
23         }\r
24         \r
25         @Override\r
26         public String toString() {\r
27                 if (label != null)\r
28                         return label;\r
29                 return rvi;\r
30         }\r
31         \r
32         @Override\r
33         public int hashCode() {\r
34                 return rvi.hashCode();\r
35         }\r
36         \r
37         @Override\r
38         public boolean equals(Object obj) {\r
39                 if (obj == null)\r
40                         return false;\r
41                 if (obj.getClass() != getClass())\r
42                         return false;\r
43                 ChartVariable other = (ChartVariable)obj;\r
44                 return rvi.equals(other.rvi);\r
45         }\r
46         \r
47         @Override\r
48         public int compareTo(ChartVariable o) {\r
49                 if (label != null && o.label != null) {\r
50                         return label.compareTo(o.label);\r
51                 }\r
52                 return rvi.compareTo(o.rvi);\r
53         }\r
54 \r
55 }\r