use of us.mn.state.dot.tms.TimeAction in project iris by mnit-rtmc.
the class TimeActionModel method createColumns.
/**
* Create the columns in the model
*/
@Override
protected ArrayList<ProxyColumn<TimeAction>> createColumns() {
ArrayList<ProxyColumn<TimeAction>> cols = new ArrayList<ProxyColumn<TimeAction>>(4);
cols.add(new ProxyColumn<TimeAction>("action.plan.day", 100) {
public Object getValueAt(TimeAction ta) {
return ta.getDayPlan();
}
});
cols.add(new ProxyColumn<TimeAction>("action.plan.date", 100) {
public Object getValueAt(TimeAction ta) {
return ta.getSchedDate();
}
});
cols.add(new ProxyColumn<TimeAction>("action.plan.time", 80) {
public Object getValueAt(TimeAction ta) {
return ta.getTimeOfDay();
}
});
cols.add(new ProxyColumn<TimeAction>("action.plan.phase", 100) {
public Object getValueAt(TimeAction ta) {
return ta.getPhase();
}
public boolean isEditable(TimeAction ta) {
return canWrite(ta);
}
public void setValueAt(TimeAction ta, Object value) {
if (value instanceof PlanPhase)
ta.setPhase((PlanPhase) value);
}
protected TableCellEditor createCellEditor() {
JComboBox<PlanPhase> cbx = new JComboBox<PlanPhase>();
cbx.setModel(new IComboBoxModel<PlanPhase>(phase_mdl));
return new DefaultCellEditor(cbx);
}
});
return cols;
}
use of us.mn.state.dot.tms.TimeAction in project iris by mnit-rtmc.
the class ActionPlanImpl method getScheduledPhase.
/**
* Get the currently scheduled phase
*/
private PlanPhase getScheduledPhase() {
// Use time in thirty seconds to avoid missing time actions
long now = TimeSteward.currentTimeMillis() + 30 * 1000;
TimeAction ta = TimeActionHelper.getMostRecentAction(this, new Date(now));
return (ta != null) ? ta.getPhase() : default_phase;
}
use of us.mn.state.dot.tms.TimeAction in project iris by mnit-rtmc.
the class RampMeterImpl method getTimeActionMinute.
/**
* Get the minute for a matching time action
*/
private int getTimeActionMinute(boolean start) {
int period = currentPeriod();
ArrayList<MeterAction> act = getMeterActions();
Iterator<TimeAction> it = TimeActionHelper.iterator();
while (it.hasNext()) {
TimeAction ta = it.next();
Integer min = TimeActionHelper.getMinuteOfDay(ta);
if (min != null) {
if (TimeActionHelper.getPeriod(min) == period) {
if (checkTimeAction(ta, start, act))
return min;
}
}
}
return TimeActionHelper.NOON;
}
use of us.mn.state.dot.tms.TimeAction in project iris by mnit-rtmc.
the class TimeActionJob method perform.
/**
* Perform time actions
*/
@Override
public void perform() throws TMSException {
Calendar cal = TimeSteward.getCalendarInstance();
int min = TimeSteward.currentMinuteOfDayInt();
Iterator<TimeAction> it = TimeActionHelper.iterator();
while (it.hasNext()) {
TimeAction ta = it.next();
if (ta instanceof TimeActionImpl) {
TimeActionImpl tai = (TimeActionImpl) ta;
tai.perform(cal, min);
}
}
}
Aggregations