@Override public void receiveParcel(Auctioneer<T> auctioneer, Parcel p, long auctionStartTime) { LOGGER.info("{} receiveParcel {}", this, p); assignedParcels.add(p); eventDispatcher .dispatchEvent(new Event(CommunicatorEventType.CHANGE, this)); }
@SuppressWarnings("unchecked") <T extends TimedEvent> void dispatch(T e) { ((TimedEventHandler<T>) handlers.get(e.getClass())).handleTimedEvent(e, simulator); disp.dispatchEvent(new ScenarioEvent(e)); }
@SuppressWarnings("unchecked") <T extends TimedEvent> void dispatch(T e) { ((TimedEventHandler<T>) handlers.get(e.getClass())).handleTimedEvent(e, simulator); disp.dispatchEvent(new ScenarioEvent(e)); }
void addDevice(CommDevice device, CommUser user) { usersDevices.put(user, device); usersHasChanged = true; if (eventDispatcher.hasListenerFor(EventTypes.ADD_COMM_USER)) { eventDispatcher.dispatchEvent(new CommModelEvent( EventTypes.ADD_COMM_USER, this, device, user)); } }
@Override public boolean releaseParcel(Parcel p) { checkArgument(!pdpModel.get().getParcelState(p).isPickedUp() && !pdpModel.get().getParcelState(p).isTransitionState()); LOGGER.info("{} releaseParcel {}", this, p); checkArgument(assignedParcels.contains(p)); assignedParcels.remove(p); checkState(!assignedParcels.contains(p)); eventDispatcher .dispatchEvent(new Event(CommunicatorEventType.CHANGE, this)); return true; }
/** * Start the simulation. */ @Override public final void start() { checkState(!isTicking(), "Time is already ticking."); isTicking = true; eventDispatcher.dispatchEvent(new Event(ClockEventType.STARTED, this)); doStart(); eventDispatcher.dispatchEvent(new Event(ClockEventType.STOPPED, this)); }
@Override public void addConnection(Connection<E> connection) { delegate.addConnection(connection); eventDispatcher.dispatchEvent(new GraphEvent(EventTypes.ADD_CONNECTION, this, connection)); }
@Override public void addConnection(Connection<E> connection) { delegate.addConnection(connection); eventDispatcher.dispatchEvent(new GraphEvent(EventTypes.ADD_CONNECTION, this, connection)); }
@OverridingMethodsMustInvokeSuper void cleanUpAfterException() { eventDispatcher.dispatchEvent(new Event(ClockEventType.STOPPED, this)); }
@Override public Optional<E> setConnectionData(Point from, Point to, E connectionData) { final Optional<E> val = delegate.setConnectionData(from, to, connectionData); eventDispatcher.dispatchEvent(new GraphEvent( EventTypes.CHANGE_CONNECTION_DATA, this, getConnection(from, to))); return val; }
@Override public Optional<E> removeConnectionData(Point from, Point to) { final Optional<E> val = delegate.removeConnectionData(from, to); eventDispatcher.dispatchEvent(new GraphEvent( EventTypes.CHANGE_CONNECTION_DATA, this, getConnection(from, to))); return val; }
@Override public void removeConnection(Point from, Point to) { final Connection<?> conn = delegate.getConnection(from, to); delegate.removeConnection(from, to); eventDispatcher .dispatchEvent(new GraphEvent( EventTypes.REMOVE_CONNECTION, this, conn)); }
@Override public void removeObject(RoadUser roadUser) { checkArgument(registry().containsObject(roadUser), "RoadUser: %s does not exist.", roadUser); registry().removeObject(roadUser); objDestinations.remove(roadUser); eventDispatcher.dispatchEvent(new RoadModelEvent( RoadEventType.REMOVE_ROAD_USER, this, roadUser)); }
@Override public Optional<E> removeConnectionData(Point from, Point to) { final Optional<E> val = delegate.removeConnectionData(from, to); eventDispatcher.dispatchEvent(new GraphEvent( EventTypes.CHANGE_CONNECTION_DATA, this, getConnection(from, to))); return val; }
@Override public void addConnection(Point from, Point to) { delegate.addConnection(from, to); eventDispatcher.dispatchEvent(new GraphEvent(EventTypes.ADD_CONNECTION, this, getConnection(from, to))); }
@Override public void addConnection(Point from, Point to, E connData) { delegate.addConnection(from, to, connData); eventDispatcher.dispatchEvent(new GraphEvent(EventTypes.ADD_CONNECTION, this, getConnection(from, to))); }
@Override public void addConnection(Point from, Point to) { delegate.addConnection(from, to); eventDispatcher.dispatchEvent(new GraphEvent(EventTypes.ADD_CONNECTION, this, getConnection(from, to))); }
@Override public void addConnection(Point from, Point to, E connData) { delegate.addConnection(from, to, connData); eventDispatcher.dispatchEvent(new GraphEvent(EventTypes.ADD_CONNECTION, this, getConnection(from, to))); }
@Override public void removeConnection(Point from, Point to) { final Connection<?> conn = delegate.getConnection(from, to); delegate.removeConnection(from, to); eventDispatcher .dispatchEvent(new GraphEvent( EventTypes.REMOVE_CONNECTION, this, conn)); }
@Override public void addObjectAt(RoadUser newObj, Point pos) { checkArgument(!registry().containsObject(newObj), "Object is already added: %s.", newObj); registry().addAt(newObj, pos); eventDispatcher.dispatchEvent(new RoadModelEvent( RoadEventType.ADD_ROAD_USER, this, newObj)); }