@Test public final void testAddJoin() { final int laneCount = 2; final RoadSegment r1 = new RoadSegment(1000.0, laneCount); final RoadSegment r2 = new RoadSegment(1000.0, laneCount); Link.addJoin(r1, r2); assertEquals(r2, r1.sinkRoadSegment(Lanes.LANE1)); assertEquals(r2, r1.sinkRoadSegment(Lanes.LANE2)); assertEquals(Lanes.LANE1, r1.sinkLane(Lanes.LANE1)); assertEquals(Lanes.LANE2, r1.sinkLane(Lanes.LANE2)); assertEquals(r1, r2.sourceRoadSegment(Lanes.LANE1)); assertEquals(r1, r2.sourceRoadSegment(Lanes.LANE2)); assertEquals(Lanes.LANE1, r2.sourceLane(Lanes.LANE1)); assertEquals(Lanes.LANE2, r2.sourceLane(Lanes.LANE2)); }
public static RoadSegment addJoin(RoadSegment sourceRoad, RoadSegment sinkRoad) { final int limit = Math.min(sourceRoad.trafficLaneMax(), sinkRoad.trafficLaneMax()); for (int lane = 1; lane <= limit; ++lane) { addLanePair(lane, sourceRoad, lane, sinkRoad); } return sinkRoad; }
Link { public static RoadSegment addJoin(RoadSegment sourceRoad, RoadSegment sinkRoad) { final int limit = Math.min(sourceRoad.trafficLaneMax(), sinkRoad.trafficLaneMax()); for (int lane = 1; lane <= limit; ++lane) { addLanePair(lane, sourceRoad, lane, sinkRoad); } return sinkRoad; } }
Link { public static RoadSegment addJoin(RoadSegment sourceRoad, RoadSegment sinkRoad) { final int limit = Math.min(sourceRoad.trafficLaneMax(), sinkRoad.trafficLaneMax()); for (int lane = 1; lane <= limit; ++lane) { addLanePair(lane, sourceRoad, lane, sinkRoad); } return sinkRoad; } private  Link(); }
Link { public static RoadSegment addJoin(RoadSegment sourceRoad, RoadSegment sinkRoad) { final int limit = Math.min(sourceRoad.trafficLaneMax(), sinkRoad.trafficLaneMax()); for (int lane = 1; lane <= limit; ++lane) { addLanePair(lane, sourceRoad, lane, sinkRoad); } return sinkRoad; } private  Link(); static void addLanePair(int fromLane, RoadSegment fromRoadsegment, int toLane, RoadSegment toRoadSegment); static RoadSegment addJoin(RoadSegment sourceRoad, RoadSegment sinkRoad); static void addMerge(RoadSegment fromRoad1, RoadSegment fromRoad2, RoadSegment toRoad); static void addFork(RoadSegment fromRoad, RoadSegment toRoad1, RoadSegment toRoad2); }
Link { public static RoadSegment addJoin(RoadSegment sourceRoad, RoadSegment sinkRoad) { final int limit = Math.min(sourceRoad.trafficLaneMax(), sinkRoad.trafficLaneMax()); for (int lane = 1; lane <= limit; ++lane) { addLanePair(lane, sourceRoad, lane, sinkRoad); } return sinkRoad; } private  Link(); static void addLanePair(int fromLane, RoadSegment fromRoadsegment, int toLane, RoadSegment toRoadSegment); static RoadSegment addJoin(RoadSegment sourceRoad, RoadSegment sinkRoad); static void addMerge(RoadSegment fromRoad1, RoadSegment fromRoad2, RoadSegment toRoad); static void addFork(RoadSegment fromRoad, RoadSegment toRoad1, RoadSegment toRoad2);  }