use of us.mn.state.dot.tms.MeterAction in project iris by mnit-rtmc.
the class PlanDispatcher method createPhaseSet.
/**
* Create a set of phases for an action plan
*/
private TreeSet<PlanPhase> createPhaseSet(final ActionPlan ap) {
final TreeSet<PlanPhase> phases = new TreeSet<PlanPhase>(comparator);
Iterator<DmsAction> dit = DmsActionHelper.iterator();
while (dit.hasNext()) {
DmsAction da = dit.next();
if (da.getActionPlan() == ap)
phases.add(da.getPhase());
}
Iterator<BeaconAction> bit = BeaconActionHelper.iterator();
while (bit.hasNext()) {
BeaconAction ba = bit.next();
if (ba.getActionPlan() == ap)
phases.add(ba.getPhase());
}
Iterator<CameraAction> cit = CameraActionHelper.iterator();
while (cit.hasNext()) {
CameraAction ca = cit.next();
if (ca.getActionPlan() == ap)
phases.add(ca.getPhase());
}
Iterator<LaneAction> lit = LaneActionHelper.iterator();
while (lit.hasNext()) {
LaneAction la = lit.next();
if (la.getActionPlan() == ap)
phases.add(la.getPhase());
}
Iterator<MeterAction> mit = MeterActionHelper.iterator();
while (mit.hasNext()) {
MeterAction ma = mit.next();
if (ma.getActionPlan() == ap)
phases.add(ma.getPhase());
}
return phases;
}
use of us.mn.state.dot.tms.MeterAction 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.MeterAction in project iris by mnit-rtmc.
the class MeterActionJob method perform.
/**
* Perform all ramp meter actions
*/
@Override
public void perform() {
Iterator<MeterAction> it = MeterActionHelper.iterator();
while (it.hasNext()) {
MeterAction ma = it.next();
ActionPlan ap = ma.getActionPlan();
if (ap.getActive())
updateMeterMap(ma, ap.getPhase());
}
for (Map.Entry<RampMeterImpl, Boolean> e : meters.entrySet()) e.getKey().setOperating(e.getValue());
}
use of us.mn.state.dot.tms.MeterAction in project iris by mnit-rtmc.
the class RampMeterImpl method getMeterActions.
/**
* Get a list of all meter actions which control the meter
*/
private ArrayList<MeterAction> getMeterActions() {
ArrayList<MeterAction> act = new ArrayList<MeterAction>();
Iterator<MeterAction> it = MeterActionHelper.iterator();
while (it.hasNext()) {
MeterAction ma = it.next();
if (ma.getRampMeter() == this) {
ActionPlan ap = ma.getActionPlan();
if (ap.getActive())
act.add(ma);
}
}
return act;
}
use of us.mn.state.dot.tms.MeterAction in project iris by mnit-rtmc.
the class MeterActionModel method createColumns.
/**
* Create the columns in the model
*/
@Override
protected ArrayList<ProxyColumn<MeterAction>> createColumns() {
ArrayList<ProxyColumn<MeterAction>> cols = new ArrayList<ProxyColumn<MeterAction>>(2);
cols.add(new ProxyColumn<MeterAction>("ramp_meter", 160) {
public Object getValueAt(MeterAction ma) {
return ma.getRampMeter();
}
});
cols.add(new ProxyColumn<MeterAction>("action.plan.phase", 100) {
public Object getValueAt(MeterAction ma) {
return ma.getPhase();
}
public boolean isEditable(MeterAction ma) {
return canWrite(ma);
}
public void setValueAt(MeterAction ma, Object value) {
if (value instanceof PlanPhase)
ma.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;
}
Aggregations