// SlateModel.java
import java.awt.Shape;
/**
* Model interface for managing repository of shapes.
*
* @author Ramnivas Laddad
*/
public interface SlateModel {
// ---------------- Listener management -------------------------
/**
* Add listener interested in changes in the changes model.
* @param l listener to be added.
*/
public void addSlateModelListener(SlateModelListener l);
/**
* Remove a previously added listener.
* @param l listener to be removed.
*/
public void removeSlateModelListener(SlateModelListener l);
// ----- Shape repository management, views need notification ---
/**
* Add shape to the model.
* @param s shape to be added.
*/
public void addShape(Shape s);
/**
* Remove shape from model
* @param s shape to be removed
*/
public void removeShape(Shape s);
/**
* Remove all the shapes from model
*/
public void removeAllShapes();
// ---------- Shape repository read-only operations -------------
/**
* Get the count of shape in the model
* @return number of shapes currently int the model
*/
public int getShapeCount();
/**
* Get the shape at given index
* @param index index of shape sought
* @return shape at given index
*/
public Shape getShapeAtIndex(int index);
}