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; }
public void addAlpineBeerToConsume(Alpine alpine, int index) { alpine.setBeerConsumer(this); ((Vector) alpineBeersToConsume).insertElementAt(alpine, index); }
public void addAlpineBeerToConsume(Alpine alpine) { alpine.setBeerConsumer(this); ((Vector) alpineBeersToConsume).add(alpine); }
public Alpine removeAlpineBeerToConsume(int index) { Alpine alpine = ((Vector<Alpine>) alpineBeersToConsume).elementAt(index); alpine.setBeerConsumer(null); ((Vector) alpineBeersToConsume).removeElementAt(index); return alpine; }