package visitor;
public class CompositeEquipment extends Equipment {
private List<Equipment> innerParts = new ArrayList<Equipment>();
public CompositeEquipment
(String name
) { super(name);
}
public void Accept(EquipmentVisitor v) {
}
public int getDisountPrice() {
int price = 0;
for (Equipment eq : innerParts) {
price += eq.getDisountPrice();
}
return price;
}
public int getNetPrice() {
int price = 0;
for (Equipment eq : innerParts) {
price += eq.getNetPrice();
}
return price;
}
public int getPower() {
int power = 0;
for (Equipment eq : innerParts) {
power += eq.getPower();
}
return power;
}
public void Add(Equipment eq) {
innerParts.add(eq);
}
public Iterator<Equipment> getIterator() {
return innerParts.iterator();
}
public void Remove(Equipment eq) {
innerParts.remove(eq);
}
}