1 44 45 package org.jfree.data.general; 46 47 import java.io.Serializable ; 48 49 import org.jfree.util.ObjectUtilities; 50 import org.jfree.util.PublicCloneable; 51 52 56 public class DefaultValueDataset extends AbstractDataset 57 implements ValueDataset, 58 Cloneable , PublicCloneable, 59 Serializable { 60 61 62 private static final long serialVersionUID = 8137521217249294891L; 63 64 65 private Number value; 66 67 70 public DefaultValueDataset() { 71 this(null); 72 } 73 74 79 public DefaultValueDataset(double value) { 80 this(new Double (value)); 81 } 82 83 88 public DefaultValueDataset(Number value) { 89 this.value = value; 90 } 91 92 97 public Number getValue() { 98 return this.value; 99 } 100 101 107 public void setValue(Number value) { 108 this.value = value; 109 notifyListeners(new DatasetChangeEvent(this, this)); 110 } 111 112 119 public boolean equals(Object obj) { 120 121 if (obj == null) { 122 return false; 123 } 124 125 if (obj == this) { 126 return true; 127 } 128 129 if (obj instanceof ValueDataset) { 130 ValueDataset vd = (ValueDataset) obj; 131 return ObjectUtilities.equal(this.value, vd.getValue()); 132 } 133 134 return false; 135 } 136 137 142 public int hashCode() { 143 return (this.value != null ? this.value.hashCode() : 0); 144 } 145 146 } 147 | Popular Tags |