diff options
author | Keith Packard <keithp@keithp.com> | 2013-08-29 19:24:51 -0500 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2013-08-29 19:24:51 -0500 |
commit | de8d9c5630ae46378c50faf97f7d2e97fe139e30 (patch) | |
tree | e8e41e4186c5d27e1a5184d915bdb9f08926fa7a /altosui/AltosGraphDataSet.java | |
parent | ce1378385ef273010498e81c205f42d8e32c7dc1 (diff) |
altoslib, altosui: Restructured state management now does TM eeprom files
Removed uses of AltosRecord from AltosState, now just need to rewrite
the other AltosState changing code to match
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosui/AltosGraphDataSet.java')
-rw-r--r-- | altosui/AltosGraphDataSet.java | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/altosui/AltosGraphDataSet.java b/altosui/AltosGraphDataSet.java index dc047e9a..1e469c8a 100644 --- a/altosui/AltosGraphDataSet.java +++ b/altosui/AltosGraphDataSet.java @@ -25,34 +25,31 @@ import org.altusmetrum.altosuilib_1.*; class AltosGraphIterator implements Iterator<AltosUIDataPoint> { AltosGraphDataSet dataSet; - Iterator<AltosRecord> iterator; - - AltosState state; + Iterator<AltosState> iterator; public boolean hasNext() { return iterator.hasNext(); } public AltosUIDataPoint next() { - state = new AltosState(iterator.next(), state); + AltosState state = iterator.next(); - if ((state.data.seen & AltosRecord.seen_flight) != 0) { - if (dataSet.callsign == null && state.data.callsign != null) - dataSet.callsign = state.data.callsign; + if (state.flight != AltosRecord.MISSING) { + if (dataSet.callsign == null && state.callsign != null) + dataSet.callsign = state.callsign; - if (dataSet.serial == 0 && state.data.serial != 0) - dataSet.serial = state.data.serial; + if (dataSet.serial == 0 && state.serial != 0) + dataSet.serial = state.serial; - if (dataSet.flight == 0 && state.data.flight != 0) - dataSet.flight = state.data.flight; + if (dataSet.flight == 0 && state.flight != 0) + dataSet.flight = state.flight; } return new AltosGraphDataPoint(state); } - public AltosGraphIterator (Iterator<AltosRecord> iterator, AltosGraphDataSet dataSet) { + public AltosGraphIterator (Iterator<AltosState> iterator, AltosGraphDataSet dataSet) { this.iterator = iterator; - this.state = null; this.dataSet = dataSet; } @@ -64,7 +61,7 @@ class AltosGraphIterable implements Iterable<AltosUIDataPoint> { AltosGraphDataSet dataSet; public Iterator<AltosUIDataPoint> iterator() { - return new AltosGraphIterator(dataSet.records.iterator(), dataSet); + return new AltosGraphIterator(dataSet.states.iterator(), dataSet); } public AltosGraphIterable(AltosGraphDataSet dataSet) { @@ -76,7 +73,7 @@ public class AltosGraphDataSet implements AltosUIDataSet { String callsign; int serial; int flight; - AltosRecordIterable records; + AltosStateIterable states; public String name() { if (callsign != null) @@ -89,8 +86,8 @@ public class AltosGraphDataSet implements AltosUIDataSet { return new AltosGraphIterable(this); } - public AltosGraphDataSet (AltosRecordIterable records) { - this.records = records; + public AltosGraphDataSet (AltosStateIterable states) { + this.states = states; this.callsign = null; this.serial = 0; this.flight = 0; |