Search in sources :

Example 1 with MeterAction

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;
}
Also used : LaneAction(us.mn.state.dot.tms.LaneAction) MeterAction(us.mn.state.dot.tms.MeterAction) BeaconAction(us.mn.state.dot.tms.BeaconAction) DmsAction(us.mn.state.dot.tms.DmsAction) TreeSet(java.util.TreeSet) PlanPhase(us.mn.state.dot.tms.PlanPhase) CameraAction(us.mn.state.dot.tms.CameraAction)

Example 2 with MeterAction

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;
}
Also used : TimeAction(us.mn.state.dot.tms.TimeAction) MeterAction(us.mn.state.dot.tms.MeterAction)

Example 3 with MeterAction

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());
}
Also used : MeterAction(us.mn.state.dot.tms.MeterAction) Map(java.util.Map) HashMap(java.util.HashMap) ActionPlan(us.mn.state.dot.tms.ActionPlan)

Example 4 with MeterAction

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;
}
Also used : MeterAction(us.mn.state.dot.tms.MeterAction) ArrayList(java.util.ArrayList) ActionPlan(us.mn.state.dot.tms.ActionPlan)

Example 5 with MeterAction

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;
}
Also used : IComboBoxModel(us.mn.state.dot.tms.client.widget.IComboBoxModel) JComboBox(javax.swing.JComboBox) ArrayList(java.util.ArrayList) MeterAction(us.mn.state.dot.tms.MeterAction) PlanPhase(us.mn.state.dot.tms.PlanPhase) TableCellEditor(javax.swing.table.TableCellEditor) ProxyColumn(us.mn.state.dot.tms.client.proxy.ProxyColumn) DefaultCellEditor(javax.swing.DefaultCellEditor)

Aggregations

MeterAction (us.mn.state.dot.tms.MeterAction)6 ArrayList (java.util.ArrayList)2 ActionPlan (us.mn.state.dot.tms.ActionPlan)2 PlanPhase (us.mn.state.dot.tms.PlanPhase)2 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 TreeSet (java.util.TreeSet)1 DefaultCellEditor (javax.swing.DefaultCellEditor)1 JComboBox (javax.swing.JComboBox)1 TableCellEditor (javax.swing.table.TableCellEditor)1 BeaconAction (us.mn.state.dot.tms.BeaconAction)1 CameraAction (us.mn.state.dot.tms.CameraAction)1 DmsAction (us.mn.state.dot.tms.DmsAction)1 LaneAction (us.mn.state.dot.tms.LaneAction)1 RampMeter (us.mn.state.dot.tms.RampMeter)1 TimeAction (us.mn.state.dot.tms.TimeAction)1 ProxyColumn (us.mn.state.dot.tms.client.proxy.ProxyColumn)1 IComboBoxModel (us.mn.state.dot.tms.client.widget.IComboBoxModel)1