Пример #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 addAlpineBeerToConsume(Alpine alpine, int index) {
   alpine.setBeerConsumer(this);
   ((Vector) alpineBeersToConsume).insertElementAt(alpine, index);
 }
Пример #3
0
 public void addAlpineBeerToConsume(Alpine alpine) {
   alpine.setBeerConsumer(this);
   ((Vector) alpineBeersToConsume).add(alpine);
 }
Пример #4
0
 public Alpine removeAlpineBeerToConsume(int index) {
   Alpine alpine = ((Vector<Alpine>) alpineBeersToConsume).elementAt(index);
   alpine.setBeerConsumer(null);
   ((Vector) alpineBeersToConsume).removeElementAt(index);
   return alpine;
 }