Beispiel #1
0
  /**
   * Remove a station from the graph if it exists.
   *
   * @param station Station to remove.
   */
  public void remove(Station station) {
    world.removeActor(station.getId());

    for (int i = 0; i < stations.length; ++i) {
      if (station == stations[i]) {
        stations[i] = null;
        break;
      }
    }
  }
  @Override
  protected void saveLazyResources(BPMemoryOutputStream lazy) throws IOException {
    ensureLoaded();
    // lazy junction resources
    lazy.writeString(getName());

    lazy.writeInt(stations.size());
    for (Station s : stations) {
      lazy.writeObjectId(s.getId());
    }
  }
 public Station getStationByID(String id) {
   if (id == null) throw new NullPointerException();
   for (Station station : stations) {
     if (station.getId().equals(id)) {
       System.out.println("Bahnhof mit der ID " + id + ": " + station.getName());
       return station;
     }
   }
   System.out.println(id + " seems to be NO station!");
   return null;
 }