b’8818666b435cc4852b2eeea3eb1724c0434953′
blob 718�package programmingexample5;
import java.util.ArrayList;
public class ShapeGroup implements ShapeVisitable {
private ArrayList
public ShapeGroup() {
elems = new ArrayList
}
public void add(ShapeVisitable shape) {
elems.add(shape);
}
public void remove(ShapeVisitable shape) {
elems.remove(shape);
}
@Override
public void accept(ShapeVisitor v) {
/*
* TODO You need to implement this method, to answer the question.
*/
// Go through all shapes and visit
for (ShapeVisitable shape : elems) {
shape.accept(v);
}
v.visit(this);
}
}