@Override State carryOver(GuiContainer newContainer) { if (newContainer.equals(lane.getContainer())) { return this; } final Lane model = lane.getModel(); final Junction newJunction = newContainer.getModel().getJunction(model.getOutgoingJunction().getNode()); for (Road.End e : newJunction.getRoadEnds()) { if (e.isToEnd() && e.getWay().equals(model.getOutgoingRoadEnd().getWay())) { for (Lane l : e.getLanes()) { // e.getLane(...) can fail on lane removal if (l.getKind() == model.getKind() && l.getIndex() == model.getIndex()) { return new OutgoingActive(newContainer.getGui(l)); } } break; } } return new Default(); }
@Override State carryOver(GuiContainer newContainer) { if (newContainer.getModel().equals(roadEnd.getRoad().getContainer())) { return this; } final Junction newJunction = newContainer.getModel().getJunction(roadEnd.getJunction().getNode()); for (Road.End e : newJunction.getRoadEnds()) { if (e.isToEnd() && e.getWay().equals(roadEnd.getWay())) { return new IncomingActive(e); } } return new Default(); }