public void update(double timeInterval) { super.resetAvSpeedStats(); for (Road r : getOutgoingRoads()) { if (r != null) { r.handleLC(this, false); } } // Tom : Do le normal lane update Cliff: ME GUSTA for (Road r : getIncomingRoads()) { if (r != null) { r.handleLC(this, false); for (Lane l : r.getLanes()) { if (l.getCars().size() > 0) { Car fCar = l.getCars().getFirst(); if (!fCar.isIsGate() && fCar.getPosition() + fCar.getLength() >= (l.getLength() - fCar.getMinSpace())) { // The front of the car reaches the end of the road within its minimal spacing if (fCar.getPath().isEmpty()) { l.deleteCar(fCar); } else { super.updateFirst(timeInterval, r, l, getNextRoadForCar(fCar), fCar); } } else { fCar.drive(0, 0, true, timeInterval); } super.updateLane(timeInterval, l, r); } } } } }
/** * Creates a negation of several criterion * * @return The negation */ public Junction negation() { Negation dis = new Negation(); if (criteria.isEmpty()) { criteria = dis; return criteria; } else { criteria.add(dis); return dis; } }
public void add(Criterion criterion) { if (criterion instanceof Equals) { final Equals eq = (Equals) criterion; eq.setValue(resolveIdIfEntity(eq.getValue())); } criteria.add(criterion); }
/** Initialisation of the simulation. */ public static void init() { Junction.registerJunctionType(BlockedLaneJunction.class); Junction.registerJunctionType(TwoLaneJunction.class); Junction.registerJunctionType(TurnJunc.class); settings = new HashMap<>(); settings.put(MIN_DENSITY, 0); settings.put(MAX_DENSITY, 0); settings.put(AGGRESSION, 0); settings.put(CAR_RATIO, 0); settings.put(TRUCK_RATIO, 0); settings.put(MAXIMUM_SPEED, 0); settings.put(JUNCTION_TYPE, null); settings.put(TIME_STEP, 0); paused = false; started = false; simulationThread = new SimulationThread(); new SettingsWindow(); totalTimeSteps = 0; }
/** * Creates a disjunction using two specified criterion * * @param a The left hand side * @param b The right hand side * @return This query instance */ public Query or(Criterion a, Criterion b) { Assert.notNull(a, "Left hand side of AND cannot be null"); Assert.notNull(b, "Right hand side of AND cannot be null"); criteria.add(Restrictions.or(a, b)); return this; }
/** * Restricts the results by the given properties value * * @param property The name of the property * @param expr The expression to restrict by * @return This query instance */ public Query like(String property, String expr) { criteria.add(Restrictions.like(property, expr)); return this; }
/** * Restricts the results by the given property value range * * @param property The name of the property * @param start The start of the range * @param end The end of the range * @return This query instance */ public Query between(String property, Object start, Object end) { criteria.add(Restrictions.between(property, start, end)); return this; }
/** * Restricts the results by the given property values * * @param property The name of the property * @param values The values to restrict by * @return This query instance */ public Query in(String property, List values) { criteria.add(Restrictions.in(property, values)); return this; }
/** * Used to restrict a value to be less than the given value * * @param property The name of the property * @param value The value to restrict by * @return This query instance */ public Query lt(String property, Object value) { criteria.add(Restrictions.lt(property, value)); return this; }
/** * Restricts the results by the given properties value * * @param property The name of the property * @param value The value to restrict by * @return This query instance */ public Query eq(String property, Object value) { value = resolveIdIfEntity(value); criteria.add(Restrictions.eq(property, value)); return this; }