BusItineraryHalt extends AbstractBusPrimitive<BusItinerary> { public boolean setBusStop(BusStop busStop) { final BusStop old = getBusStop(); if ((busStop == null && old != null) || (busStop != null && !busStop.equals(old))) { if (old != null) { old.removeBusHalt(this); } this.busStop = busStop == null ? null : new WeakReference<>(busStop); if (busStop != null) { busStop.addBusHalt(this); } clearPositionBuffers(); fireShapeChanged(); checkPrimitiveValidity(); return true; } return false; } BusItineraryHalt(BusItinerary itinerary, String name, BusItineraryHaltType type);   BusItineraryHalt(UUID id, BusItinerary itinerary, String name, BusItineraryHaltType type);   BusItineraryHalt(BusItinerary itinerary, String name, BusItineraryHaltType type, AttributeCollection attributeProvider);   BusItineraryHalt(UUID id, BusItinerary itinerary, String name, BusItineraryHaltType type,
			AttributeCollection attributeProvider); @Override @Pure void toJson(JsonBuffer buffer); @Pure static String getFirstFreeBushaltName(BusItinerary busItinerary); @Override void rebuild(boolean fireEvents); @Pure int getInvalidListIndex(); @Override @Pure BusNetwork getBusNetwork(); @Pure BusStop getBusStop(); boolean setBusStop(BusStop busStop); @Override void setName(String name); @Pure Point2d getPosition2D(); @Pure Point1d getPosition1D(); @Pure RoadSegment getRoadSegment(); @Pure int getRoadSegmentIndex(); @Pure double getPositionOnSegment(); @Pure Direction1D getRoadSegmentDirection(); @Pure BusItineraryHaltType getType(); void setType(BusItineraryHaltType type); @Pure boolean isTerminus(); @Override @Pure int indexInParent(); @Pure boolean isStartingBusHalt(); @Pure boolean isEndingBusHalt(); @Pure boolean insideBusHub(); @Pure Iterable<BusHub> busHubs(); @Pure Iterator<BusHub> busHubIterator(); @Override Shape2d<?> getShape(); @Override @Pure final GeoLocation getGeoLocation(); @Pure GeoLocationPoint getGeoPosition(); @Pure double distanceToBusStop(); @Pure double distance(double x, double y); @Pure double distance(Point2D<?, ?> point); @Pure double distance(BusItineraryHalt halt); @Pure double distance(BusStop busStop); @Pure double distance(GeoLocationPoint point); static final double DISTANCE_BETWEEN_HALT_AND_ROAD_BORDER; }
@Test public void testSetBusStop() { assertNull(this.halt.getBusStop()); this.eventHandler.clear(); assertTrue(this.halt.setBusStop(this.stop)); assertSame(this.stop, this.halt.getBusStop()); this.eventHandler.assertBusChangedEvent(BusChangeEventType.VALIDITY, this.halt); this.eventHandler.assertBusShapeChangedEvent(BusChangeEventType.ITINERARY_HALT_CHANGED, this.halt); this.eventHandler.assertNoBusShapeAttrChangedEvent(); this.eventHandler.clear(); assertFalse(this.halt.setBusStop(this.stop)); this.eventHandler.assertNoEvent(); this.eventHandler.clear(); assertTrue(this.halt.setBusStop(null)); assertNull(this.halt.getBusStop()); this.eventHandler.assertBusChangedEvent(BusChangeEventType.VALIDITY, this.halt); this.eventHandler.assertBusShapeChangedEvent(BusChangeEventType.ITINERARY_HALT_CHANGED, this.halt); this.eventHandler.assertNoBusShapeAttrChangedEvent(); this.eventHandler.clear(); assertFalse(this.halt.setBusStop(null)); this.eventHandler.assertNoEvent(); }