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 TimesliceValue other = (TimesliceValue)arg;
10 return _date.compareTo(other._date);
11 }
12
13 public boolean equals(Object arg) {
14 TimesliceValue other = (TimesliceValue)arg;
15 return _value.equals(other._value) && _date.equals(other._date);
16 }
17
18 public TimesliceValue(EquatableComparable month, int i) {
19 _date = month;
20 _value = new Double(i);
21 }
22
23 public TimesliceValue(EquatableComparable month, Double amount) {
24 _date = month;
25 _value = amount;
26 }
27
28 public double doubleValue() {
29 return _value.doubleValue();
30 }
31
32 public void setValue(Double amount) {
33 _value = amount;
34 }
35
36 public void copyInto(TimesliceValue other) {
37 other._date = _date;
38 other._value = _value;
39 }
40
41 public String getDisplayMonth() {
42 return _date.toString();
43 }
44
45 public Double getDisplayValue() {
46 return _value;
47 }
48
49 public String getDisplayHeight(TimesliceValue max) {
50 return ""+new Double(doubleValue() / max.doubleValue() * 200).intValue();
51 }
52
53 }