-package org.simantics.history;\r
-\r
-import org.simantics.databoard.accessor.StreamAccessor;\r
-import org.simantics.databoard.accessor.error.AccessorException;\r
-import org.simantics.history.util.StreamIterator;\r
-\r
-public class HistorySamplerItem implements Comparable<HistorySamplerItem> {\r
- \r
- Collector collector;\r
- HistoryManager history; // History source for this item\r
- String historyItemId;\r
-\r
- // State data\r
- StreamAccessor accessor; // Stream accessor\r
- public StreamIterator iter;\r
- public int chartDataId;\r
- \r
- public HistorySamplerItem(Collector collector, HistoryManager history, String historyItemId, int identityHashCode) {\r
- this.collector = collector;\r
- this.history = history;\r
- this.historyItemId = historyItemId;\r
- this.chartDataId = identityHashCode;\r
- }\r
- \r
- public void open() throws HistoryException {\r
- accessor = history.openStream(historyItemId, "r");\r
- iter = new StreamIterator( accessor );\r
- }\r
- \r
- public void close() {\r
- if (accessor!=null) {\r
- try {\r
- accessor.close();\r
- } catch (AccessorException e) {\r
- }\r
- }\r
- accessor = null;\r
- iter = null;\r
- }\r
-\r
- @Override\r
- public int compareTo(HistorySamplerItem o) {\r
- int i;\r
- i = historyItemId.compareTo(o.historyItemId); \r
- if (i!=0) return i;\r
- return 0;\r
- }\r
- \r
- @Override\r
- public int hashCode() {\r
- int code = 0x2304;\r
- code = 13*code + historyItemId.hashCode();\r
- code = 13*code + history.hashCode(); \r
- return code;\r
- }\r
- \r
- @Override\r
- public boolean equals(Object obj) {\r
- if ( obj == null ) return false;\r
- if ( obj instanceof HistorySamplerItem == false ) return false;\r
- HistorySamplerItem other = (HistorySamplerItem) obj; \r
- if ( !other.history.equals(history) ) return false;\r
- if ( !other.historyItemId.equals(historyItemId) ) return false;\r
- return true;\r
- }\r
- \r
-}\r
+package org.simantics.history;
+
+import org.simantics.databoard.accessor.StreamAccessor;
+import org.simantics.databoard.accessor.error.AccessorException;
+import org.simantics.history.util.StreamIterator;
+
+public class HistorySamplerItem implements Comparable<HistorySamplerItem> {
+
+ Collector collector;
+ HistoryManager history; // History source for this item
+ String historyItemId;
+
+ // State data
+ StreamAccessor accessor; // Stream accessor
+ public StreamIterator iter;
+ public int chartDataId;
+
+ public HistorySamplerItem(Collector collector, HistoryManager history, String historyItemId, int identityHashCode) {
+ this.collector = collector;
+ this.history = history;
+ this.historyItemId = historyItemId;
+ this.chartDataId = identityHashCode;
+ }
+
+ public void open() throws HistoryException {
+ accessor = history.openStream(historyItemId, "r");
+ iter = new StreamIterator( accessor );
+ }
+
+ public void close() {
+ if (accessor!=null) {
+ try {
+ accessor.close();
+ } catch (AccessorException e) {
+ }
+ }
+ accessor = null;
+ iter = null;
+ }
+
+ @Override
+ public int compareTo(HistorySamplerItem o) {
+ int i;
+ i = historyItemId.compareTo(o.historyItemId);
+ if (i!=0) return i;
+ return 0;
+ }
+
+ @Override
+ public int hashCode() {
+ int code = 0x2304;
+ code = 13*code + historyItemId.hashCode();
+ code = 13*code + history.hashCode();
+ return code;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if ( obj == null ) return false;
+ if ( obj instanceof HistorySamplerItem == false ) return false;
+ HistorySamplerItem other = (HistorySamplerItem) obj;
+ if ( !other.history.equals(history) ) return false;
+ if ( !other.historyItemId.equals(historyItemId) ) return false;
+ return true;
+ }
+
+}