Пример #1
0
 public void addRoad(Road r, int pos) throws InfraException {
   if (r == null) throw new InfraException("Parameter r is null");
   if (pos > 3 || pos < 0) throw new InfraException("Position out of range");
   if (allRoads[pos] != null)
     throw new InfraException("Road already connected to position " + pos);
   allRoads[pos] = r;
   Node other = r.getOtherNode(this);
   if (other == null || !other.isAlphaRoad(r))
     alphaRoads = (Road[]) Arrayutils.addElement(alphaRoads, r);
   updateLanes();
   calculateWidth();
 }
Пример #2
0
 public void reset() {
   Road road = edgenode.getRoad();
   if (road != null) {
     roadLink.setText(road.getName());
     roadLink.setEnabled(true);
     nodeLink.setText(road.getOtherNode(edgenode).getName());
     nodeLink.setEnabled(true);
   } else {
     roadLink.setText("null");
     roadLink.setEnabled(false);
     nodeLink.setText("null");
     nodeLink.setEnabled(false);
   }
 }