//IRectangle.java
public interface IRectangle{
void setWidth(int w);
void setHeight(int w);
int getWidth();
int getHeight();
// different
void setScale(float scale);
float setScale();
}
IBox.java
public interface IBox{
void setWidth(int w);
void setHeight(int w);
int getWidth();
int getHeight();
// different
void setBound(int bounds);
int getBound();
}
ISize.java
public interface ISize{
void setWidth(int w);
void setHeight(int w);
int getWidth();
int getHeight();
}
//RectangleImpl.java
public class RectangleImpl implements IRectangle, ISize{
....
}
//BoxImpl.java
public class BoxImpl implements IBox, ISize{
....
}
//TransactionCommand.java
public class TransactionCommand extends Command{
private ArrayList<Command> command_list = new ArrayList<Command>
void setCommand(Command){
command_list.add(Command);
}
void execute(){
Iterator<Command> iter = command_list.iterator;
while(iter.hasNext()){
Command cmd = iter.next();
if(cmd.canExecute()){
cmd.execute();
}
else{
return;
}
}
}
}