1 41 42 package org.jfree.data.time; 43 44 import java.io.Serializable ; 45 46 49 public class TimePeriodValue implements Cloneable , Serializable { 50 51 52 private static final long serialVersionUID = 3390443360845711275L; 53 54 55 private TimePeriod period; 56 57 58 private Number value; 59 60 66 public TimePeriodValue(TimePeriod period, Number value) { 67 this.period = period; 68 this.value = value; 69 } 70 71 77 public TimePeriodValue(TimePeriod period, double value) { 78 this(period, new Double (value)); 79 } 80 81 86 public TimePeriod getPeriod() { 87 return this.period; 88 } 89 90 95 public Number getValue() { 96 return this.value; 97 } 98 99 104 public void setValue(Number value) { 105 this.value = value; 106 } 107 108 115 public boolean equals(Object obj) { 116 if (this == obj) { 117 return true; 118 } 119 if (!(obj instanceof TimePeriodValue)) { 120 return false; 121 } 122 123 TimePeriodValue timePeriodValue = (TimePeriodValue) obj; 124 125 if (this.period != null ? !this.period.equals(timePeriodValue.period) 126 : timePeriodValue.period != null) { 127 return false; 128 } 129 if (this.value != null ? !this.value.equals(timePeriodValue.value) 130 : timePeriodValue.value != null) { 131 return false; 132 } 133 134 return true; 135 } 136 137 142 public int hashCode() { 143 int result; 144 result = (this.period != null ? this.period.hashCode() : 0); 145 result = 29 * result + (this.value != null ? this.value.hashCode() : 0); 146 return result; 147 } 148 149 157 public Object clone() { 158 Object clone = null; 159 try { 160 clone = super.clone(); 161 } 162 catch (CloneNotSupportedException e) { System.err.println("Operation not supported."); 164 } 165 return clone; 166 167 } 168 169 } 170 | Popular Tags |