Representation of workpiece saved as a flag.
- By Kevlin Henney
- July 17, 2000
Patterns in JavaCollections for States
Kevlin Henney
Listing 1. Representation of workpiece saved as a flag.
public abstract class Workpiece
{
public void save()
{
saveState();
changed = false;
}
public boolean saved()
{
return !changed;
}
...
protected abstract void saveState();
private boolean changed;
}
About the Author
Kevlin Henney is a Principal Technologist with QA Training in the UK.