Search in sources :

Example 1 with LaneAction

use of us.mn.state.dot.tms.LaneAction 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 LaneAction

use of us.mn.state.dot.tms.LaneAction in project iris by mnit-rtmc.

the class LaneActionJob method perform.

/**
 * Perform all lane actions
 */
@Override
public void perform() {
    Iterator<LaneAction> it = LaneActionHelper.iterator();
    while (it.hasNext()) {
        LaneAction la = it.next();
        ActionPlan ap = la.getActionPlan();
        if (ap.getActive())
            performLaneAction(la, ap.getPhase());
    }
}
Also used : LaneAction(us.mn.state.dot.tms.LaneAction) ActionPlan(us.mn.state.dot.tms.ActionPlan)

Example 3 with LaneAction

use of us.mn.state.dot.tms.LaneAction in project iris by mnit-rtmc.

the class LaneActionModel method createColumns.

/**
 * Create the columns in the model
 */
@Override
protected ArrayList<ProxyColumn<LaneAction>> createColumns() {
    ArrayList<ProxyColumn<LaneAction>> cols = new ArrayList<ProxyColumn<LaneAction>>(2);
    cols.add(new ProxyColumn<LaneAction>("lane_marking", 160) {

        public Object getValueAt(LaneAction la) {
            return la.getLaneMarking();
        }
    });
    cols.add(new ProxyColumn<LaneAction>("action.plan.phase", 100) {

        public Object getValueAt(LaneAction la) {
            return la.getPhase();
        }

        public boolean isEditable(LaneAction la) {
            return canWrite(la);
        }

        public void setValueAt(LaneAction la, Object value) {
            if (value instanceof PlanPhase)
                la.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) LaneAction(us.mn.state.dot.tms.LaneAction) JComboBox(javax.swing.JComboBox) ArrayList(java.util.ArrayList) 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)

Example 4 with LaneAction

use of us.mn.state.dot.tms.LaneAction in project iris by mnit-rtmc.

the class PlanDispatcher method countLanes.

/**
 * Get a count a lane markings controlled by an action plan
 */
private int countLanes(ActionPlan p) {
    HashSet<LaneMarking> plan_lanes = new HashSet<LaneMarking>();
    Iterator<LaneAction> lit = LaneActionHelper.iterator();
    while (lit.hasNext()) {
        LaneAction la = lit.next();
        if (la.getActionPlan() == p)
            plan_lanes.add(la.getLaneMarking());
    }
    return plan_lanes.size();
}
Also used : LaneAction(us.mn.state.dot.tms.LaneAction) LaneMarking(us.mn.state.dot.tms.LaneMarking) HashSet(java.util.HashSet)

Aggregations

LaneAction (us.mn.state.dot.tms.LaneAction)4 PlanPhase (us.mn.state.dot.tms.PlanPhase)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 TreeSet (java.util.TreeSet)1 DefaultCellEditor (javax.swing.DefaultCellEditor)1 JComboBox (javax.swing.JComboBox)1 TableCellEditor (javax.swing.table.TableCellEditor)1 ActionPlan (us.mn.state.dot.tms.ActionPlan)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 LaneMarking (us.mn.state.dot.tms.LaneMarking)1 MeterAction (us.mn.state.dot.tms.MeterAction)1 ProxyColumn (us.mn.state.dot.tms.client.proxy.ProxyColumn)1 IComboBoxModel (us.mn.state.dot.tms.client.widget.IComboBoxModel)1