1 | |
package org.paneris.jammyjoes.mvp; |
2 | |
|
3 | |
public class TimesliceValue implements Comparable { |
4 | |
|
5 | |
Double _value; |
6 | |
EquatableComparable _date; |
7 | |
|
8 | |
public int compareTo(Object arg) { |
9 | 0 | TimesliceValue other = (TimesliceValue)arg; |
10 | 0 | return _date.compareTo(other._date); |
11 | |
} |
12 | |
|
13 | |
public boolean equals(Object arg) { |
14 | 0 | TimesliceValue other = (TimesliceValue)arg; |
15 | 0 | return _value.equals(other._value) && _date.equals(other._date); |
16 | |
} |
17 | |
|
18 | 0 | public TimesliceValue(EquatableComparable month, int i) { |
19 | 0 | _date = month; |
20 | 0 | _value = new Double(i); |
21 | 0 | } |
22 | |
|
23 | 0 | public TimesliceValue(EquatableComparable month, Double amount) { |
24 | 0 | _date = month; |
25 | 0 | _value = amount; |
26 | 0 | } |
27 | |
|
28 | |
public double doubleValue() { |
29 | 0 | return _value.doubleValue(); |
30 | |
} |
31 | |
|
32 | |
public void setValue(Double amount) { |
33 | 0 | _value = amount; |
34 | 0 | } |
35 | |
|
36 | |
public void copyInto(TimesliceValue other) { |
37 | 0 | other._date = _date; |
38 | 0 | other._value = _value; |
39 | 0 | } |
40 | |
|
41 | |
public String getDisplayMonth() { |
42 | 0 | return _date.toString(); |
43 | |
} |
44 | |
|
45 | |
public Double getDisplayValue() { |
46 | 0 | return _value; |
47 | |
} |
48 | |
|
49 | |
public String getDisplayHeight(TimesliceValue max) { |
50 | 0 | return ""+new Double(doubleValue() / max.doubleValue() * 200).intValue(); |
51 | |
} |
52 | |
|
53 | |
} |