add internal run attempt/completion counters

This commit is contained in:
Gered 2015-12-03 18:28:42 -05:00
parent 621f7185bd
commit 57e38a58b1

View file

@ -166,6 +166,10 @@ public class Run implements TableModel, Serializable {
private Configuration configuration; private Configuration configuration;
private int numberOfAttempts;
private int numberOfCompletedAttempts;
// ----------------------------------------------------------- CONSTRUCTORS // ----------------------------------------------------------- CONSTRUCTORS
/** /**
@ -552,6 +556,14 @@ public class Run implements TableModel, Serializable {
return null; return null;
} }
public int getNumberOfAttempts() {
return numberOfAttempts;
}
public int getNumberOfCompletedAttempts() {
return numberOfCompletedAttempts;
}
// ---------------------------------------------------------------- SETTERS // ---------------------------------------------------------------- SETTERS
public<T> T getSetting( String key ) { public<T> T getSetting( String key ) {
@ -686,6 +698,8 @@ public class Run implements TableModel, Serializable {
state = State.ONGOING; state = State.ONGOING;
segments.get(current).setStartTime(startTime); segments.get(current).setStartTime(startTime);
numberOfAttempts += 1;
pcSupport.firePropertyChange(STATE_PROPERTY, State.READY, state); pcSupport.firePropertyChange(STATE_PROPERTY, State.READY, state);
pcSupport.firePropertyChange(CURRENT_SEGMENT_PROPERTY, -1, 0); pcSupport.firePropertyChange(CURRENT_SEGMENT_PROPERTY, -1, 0);
} }
@ -709,6 +723,8 @@ public class Run implements TableModel, Serializable {
segments.get(current - 1).setTime(time, Segment.LIVE); segments.get(current - 1).setTime(time, Segment.LIVE);
if (current == getRowCount()) { if (current == getRowCount()) {
// run is finished
numberOfCompletedAttempts += 1;
stop(); stop();
} else { } else {
segments.get(current).setStartTime(stopTime); segments.get(current).setStartTime(stopTime);