1 38 39 package org.jfree.data; 40 41 import java.io.Serializable ; 42 43 import org.jfree.util.ObjectUtils; 44 45 50 public class DefaultValueDataset extends AbstractDataset 51 implements ValueDataset, Cloneable , Serializable { 52 53 54 private Number value; 55 56 59 public DefaultValueDataset() { 60 61 this(null); 62 63 } 64 65 70 public DefaultValueDataset(double value) { 71 this(new Double (value)); 72 } 73 74 79 public DefaultValueDataset(Number value) { 80 this.value = value; 81 } 82 83 88 public Number getValue() { 89 return this.value; 90 } 91 92 97 public void setValue(Number value) { 98 this.value = value; 99 notifyListeners(new DatasetChangeEvent(this, this)); 100 } 101 102 109 public boolean equals(Object obj) { 110 111 if (obj == null) { 112 return false; 113 } 114 115 if (obj == this) { 116 return true; 117 } 118 119 if (obj instanceof ValueDataset) { 120 ValueDataset vd = (ValueDataset) obj; 121 return ObjectUtils.equal(this.value, vd.getValue()); 122 } 123 124 return false; 125 } 126 127 } 128 | Popular Tags |