BusItinerary extends AbstractBusContainer<BusLine, BusItineraryHalt> implements RoadNetworkListener { @Pure public final BusItineraryHalt getNearestBusHalt(Point2D<?, ?> point) { return getNearestBusHalt(point.getX(), point.getY()); } BusItinerary(BusLine busline, String name);  BusItinerary(UUID id, BusLine busline, String name);  BusItinerary(BusLine busline, String name, AttributeCollection attributeProvider);  BusItinerary(UUID id, BusLine busline, String name, AttributeCollection attributeProvider);  BusItinerary(String name);  BusItinerary(UUID id, String name);  BusItinerary(String name, AttributeCollection attributeProvider);  BusItinerary(UUID id, String name, AttributeCollection attributeProvider);  BusItinerary(BusLine busline);  BusItinerary(UUID id, BusLine busline);  BusItinerary(BusLine busline, AttributeCollection attributeProvider);  BusItinerary(UUID id, BusLine busline, AttributeCollection attributeProvider);  BusItinerary();  BusItinerary(UUID id);  BusItinerary(AttributeCollection attributeProvider);  BusItinerary(UUID id, AttributeCollection attributeProvider); @Override @Pure void toJson(JsonBuffer buffer); @Pure static String getFirstFreeBusItineraryName(BusLine busline); @Override void rebuild(boolean fireEvents); @Override void revalidate(); @Override Class<? extends BusItineraryHalt> getElementType(); @Override @Pure BusNetwork getBusNetwork(); @Override void setName(String name); @Override Shape2d<?> getShape(); @Override void resetBoundingBox(); @Pure Path2d toPath2D(); @Pure void toPath2D(Path2d path); @Override @Pure int size(); @Override @Pure Iterator<BusItineraryHalt> iterator(); @Pure Direction1D getRoadSegmentDirection(int idxSegment); void invert(); @Pure boolean hasBusHaltOnSegment(RoadSegment segment); @Pure List<BusItineraryHalt> getBusHaltsOnSegment(RoadSegment segment); @Pure Map<BusItineraryHalt, Pair<Integer, Double>> getBusHaltBinding(); void setBusHaltBinding(Map<BusItineraryHalt, Pair<Integer, Float>> binding); @Pure double getLength(); @Pure double getDistanceBetweenBusHalts(int firsthaltIndex, int lasthaltIndex); @Pure double getTroneonLength(int troneonIndex); @Pure int getTroneonCount(); @Pure final BusItineraryHalt getNearestBusHalt(Point2D<?, ?> point); @Pure final BusItineraryHalt getNearestBusHalt(GeoLocationPoint point); @Pure BusItineraryHalt getNearestBusHalt(double x, double y); final BusItineraryHalt addBusHalt(String name, BusItineraryHaltType type); final BusItineraryHalt addBusHalt(BusItineraryHaltType type); BusItineraryHalt addBusHalt(UUID id, String name, BusItineraryHaltType type); final BusItineraryHalt addBusHalt(UUID id, BusItineraryHaltType type); BusItineraryHalt insertBusHaltAfter(BusItineraryHalt afterHalt, UUID id, BusItineraryHaltType type); BusItineraryHalt insertBusHaltAfter(BusItineraryHalt afterHalt, String name, BusItineraryHaltType type); BusItineraryHalt insertBusHaltAfter(BusItineraryHalt afterHalt, UUID id, String name, BusItineraryHaltType type); BusItineraryHalt insertBusHaltBefore(BusItineraryHalt beforeHalt, String name, BusItineraryHaltType type); BusItineraryHalt insertBusHaltBefore(BusItineraryHalt beforeHalt, UUID id, BusItineraryHaltType type); BusItineraryHalt insertBusHaltBefore(BusItineraryHalt beforeHalt, UUID id, String name, BusItineraryHaltType type); void removeAllBusHalts(); boolean removeBusHalt(BusItineraryHalt bushalt); boolean removeBusHalt(String name); boolean removeBusHalt(int index); @Pure int getValidBusHaltCount(); @Pure int getInvalidBusHaltCount(); @Pure int indexOf(BusItineraryHalt bushalt); @Pure int indexOf(RoadSegment segment); @Pure int lastIndexOf(RoadSegment segment); @Override @Pure int indexInParent(); @Pure boolean contains(BusItineraryHalt bushalt); @SuppressWarnings("unlikely-arg-type") @Pure boolean contains(RoadSegment segment); @Pure BusItineraryHalt getBusHaltAt(int index); @Pure BusItineraryHalt getBusHalt(String name); @Pure BusItineraryHalt getBusHalt(UUID uuid); @Pure BusItineraryHalt getBusHalt(String name, Comparator<String> nameComparator); @Pure Iterator<BusItineraryHalt> busHaltIterator(); @Pure Iterable<BusItineraryHalt> busHalts(); @Pure BusItineraryHalt[] toBusHaltArray(); @Pure BusItineraryHalt[] toInvalidBusHaltArray(); @Pure BusItineraryHalt[] toValidBusHaltArray(); @Pure final RoadSegment getNearestRoadSegment(double x, double y); @Pure final RoadSegment getNearestRoadSegment(GeoLocationPoint point); @Pure RoadSegment getNearestRoadSegment(Point2D<?, ?> point); final boolean addRoadSegment(RoadSegment segment); final boolean addRoadSegment(RoadSegment segment, boolean autoConnectHalts); final boolean addRoadSegments(RoadPath segments); final boolean addRoadSegments(RoadPath segments, boolean autoConnectHalts); boolean addRoadSegments(RoadPath segments, boolean autoConnectHalts, boolean enableLoopAutoBuild); void putInvalidHaltsOnRoads(BusItineraryHalt... restrictionList); @SuppressWarnings("checkstyle:nestedifdepth") boolean putHaltOnRoad(BusItineraryHalt halt, RoadSegment road); @SuppressWarnings("checkstyle:nestedifdepth") boolean putHaltOnRoad(BusItineraryHalt halt, RoadSegment road, Point2D<?, ?> nearPoint); void removeAllRoadSegments(); boolean removeRoadSegment(int segmentIndex); Set<Integer> removeRoadSegment(RoadSegment segment); @SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity"}) Set<Integer> removeRoadSegment(RoadSegment segment, boolean tryToReconnect); @Pure int getRoadSegmentCount(); @Pure RoadSegment getRoadSegmentAt(int index); @Pure Iterator<RoadSegment> roadSegmentsIterator(); @Pure Iterable<RoadSegment> roadSegments(); @Pure RoadPath getRoadPath(); @Pure Collection<RoadPath> getRoadPaths(); @Pure int getRoadPathCount(); @Override void onBusPrimitiveChanged(BusChangeEvent event); @Override void onBusPrimitiveShapeChanged(BusChangeEvent event); @Override void onRoadSegmentAdded(RoadNetwork network, RoadSegment segment); @Override void onRoadSegmentChanged(RoadNetwork network, RoadSegment segment); @Override void onRoadSegmentRemoved(RoadNetwork network, RoadSegment segment);  }
@Test public void testGetNearestBusHaltPoint2d() { initTest(); assertSame(this.halt2, this.itinerary.getNearestBusHalt(new Point2d(0., 0.))); assertSame(this.halt1, this.itinerary.getNearestBusHalt(new Point2d(200., 100.))); assertSame(this.halt1, this.itinerary.getNearestBusHalt(new Point2d(100., 100.))); assertSame(this.halt2, this.itinerary.getNearestBusHalt(new Point2d(-100., -100.))); assertSame(this.halt1, this.itinerary.getNearestBusHalt(new Point2d(100., -100.))); assertSame(this.halt2, this.itinerary.getNearestBusHalt(new Point2d(-100., 100.))); }
@Test public void testGetNearestBusHaltGeoLocationPoint() { initTest(); assertSame(this.halt2, this.itinerary.getNearestBusHalt(new GeoLocationPoint(0., 0.))); assertSame(this.halt1, this.itinerary.getNearestBusHalt(new GeoLocationPoint(200., 100.))); assertSame(this.halt1, this.itinerary.getNearestBusHalt(new GeoLocationPoint(100., 100.))); assertSame(this.halt2, this.itinerary.getNearestBusHalt(new GeoLocationPoint(-100., -100.))); assertSame(this.halt1, this.itinerary.getNearestBusHalt(new GeoLocationPoint(100., -100.))); assertSame(this.halt2, this.itinerary.getNearestBusHalt(new GeoLocationPoint(-100., 100.))); }
@Test public void testGetNearestBusHaltDoubleDouble() { initTest(); assertSame(this.halt2, this.itinerary.getNearestBusHalt(0., 0.)); assertSame(this.halt1, this.itinerary.getNearestBusHalt(200., 100.)); assertSame(this.halt1, this.itinerary.getNearestBusHalt(100., 100.)); assertSame(this.halt2, this.itinerary.getNearestBusHalt(-100., -100.)); assertSame(this.halt1, this.itinerary.getNearestBusHalt(100., -100.)); assertSame(this.halt2, this.itinerary.getNearestBusHalt(-100., 100.)); }