1 package org.simantics.history;
3 import org.simantics.databoard.accessor.StreamAccessor;
4 import org.simantics.databoard.accessor.error.AccessorException;
5 import org.simantics.history.util.StreamIterator;
7 public class HistorySamplerItem implements Comparable<HistorySamplerItem> {
10 HistoryManager history; // History source for this item
14 StreamAccessor accessor; // Stream accessor
15 public StreamIterator iter;
16 public int chartDataId;
18 public HistorySamplerItem(Collector collector, HistoryManager history, String historyItemId, int identityHashCode) {
19 this.collector = collector;
20 this.history = history;
21 this.historyItemId = historyItemId;
22 this.chartDataId = identityHashCode;
25 public void open() throws HistoryException {
26 accessor = history.openStream(historyItemId, "r");
27 iter = new StreamIterator( accessor );
34 } catch (AccessorException e) {
42 public int compareTo(HistorySamplerItem o) {
44 i = historyItemId.compareTo(o.historyItemId);
50 public int hashCode() {
52 code = 13*code + historyItemId.hashCode();
53 code = 13*code + history.hashCode();
58 public boolean equals(Object obj) {
59 if ( obj == null ) return false;
60 if ( obj instanceof HistorySamplerItem == false ) return false;
61 HistorySamplerItem other = (HistorySamplerItem) obj;
62 if ( !other.history.equals(history) ) return false;
63 if ( !other.historyItemId.equals(historyItemId) ) return false;