コード例 #1
0
  public Object clone() throws CloneNotSupportedException {
    BeerConsumer consumer = (BeerConsumer) super.clone();
    consumer.setAlpineBeersToConsume(new Vector());
    Iterator<Alpine> alpineIterator = this.getAlpineBeersToConsume().iterator();
    while (alpineIterator.hasNext()) {
      Alpine alpine = alpineIterator.next();
      consumer.addAlpineBeerToConsume(alpine.clone());
    }

    consumer.setBlueLightBeersToConsume(new Vector());
    Iterator<BlueLight> blueLightIterator = this.getBlueLightBeersToConsume().iterator();
    while (blueLightIterator.hasNext()) {
      Blue blue = blueLightIterator.next();
      consumer.addBlueLightBeerToConsume((BlueLight) blue.clone());
    }
    return consumer;
  }
コード例 #2
0
 public void addBlueBeerToConsume(Blue blue) {
   blue.setBeerConsumer(this);
   blueBeersToConsume.put(blue.getUniqueKey(), blue);
 }