rangesearch
Class RangeModel

java.lang.Object
  extended byrangesearch.RangeModel

public class RangeModel
extends java.lang.Object

A representation of the GUI document structure, including a set of points and a range.


Field Summary
protected  javax.swing.event.EventListenerList m_listenerList
           
protected  jdsl.core.api.Sequence m_points
           
protected  jdsl.geomobj.api.Rectangle2D m_range
           
 
Constructor Summary
RangeModel()
           
 
Method Summary
 void addModelChangedListener(ModelChangedListener l)
          Adds a listener for the ModelChangedEvent.
 int addPoint(jdsl.geomobj.api.Point2D p)
          Adds a point to the model.
protected  void fireModelChanged(int changed)
          Notifies all listeners that the current tool has changed.
 void generatePoints(int numPoints, int x1, int y1, int x2, int y2)
           
 int getNumPoints()
           
 jdsl.geomobj.api.Point2D getPoint(int index)
           
 Point2DIterator getPoints()
           
 jdsl.geomobj.api.Rectangle2D getRange()
          Returns the model's range.
 void load(java.io.StreamTokenizer st)
          Reads the model from a text stream.
 void removeModelChangedListener(ModelChangedListener l)
          Removes a listener for the ModelChangedEvent.
 void removePoint(int index)
          Removes a point from the model.
 void save(java.io.Writer s)
          Writes the model to a text stream.
 void setPoint(int index, jdsl.geomobj.api.Point2D p)
          Sets the point at the given index.
 void setPoints(jdsl.core.api.InspectableSequence points)
          Sets the model's set of points.
 void setRange(jdsl.geomobj.api.Rectangle2D range)
          Sets the model's range.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_points

protected jdsl.core.api.Sequence m_points

m_range

protected jdsl.geomobj.api.Rectangle2D m_range

m_listenerList

protected javax.swing.event.EventListenerList m_listenerList
Constructor Detail

RangeModel

public RangeModel()
Method Detail

generatePoints

public void generatePoints(int numPoints,
                           int x1,
                           int y1,
                           int x2,
                           int y2)

setPoints

public void setPoints(jdsl.core.api.InspectableSequence points)
Sets the model's set of points.


addPoint

public int addPoint(jdsl.geomobj.api.Point2D p)
Adds a point to the model.

Returns:
the index of the new point within the sequence of points.

setPoint

public void setPoint(int index,
                     jdsl.geomobj.api.Point2D p)
Sets the point at the given index.


removePoint

public void removePoint(int index)
Removes a point from the model.


getPoint

public jdsl.geomobj.api.Point2D getPoint(int index)
Returns:
the point at the given index.

getPoints

public Point2DIterator getPoints()

getNumPoints

public int getNumPoints()
Returns:
the number of points in the model.

setRange

public void setRange(jdsl.geomobj.api.Rectangle2D range)
Sets the model's range.


getRange

public jdsl.geomobj.api.Rectangle2D getRange()
Returns the model's range.


addModelChangedListener

public void addModelChangedListener(ModelChangedListener l)
Adds a listener for the ModelChangedEvent.


removeModelChangedListener

public void removeModelChangedListener(ModelChangedListener l)
Removes a listener for the ModelChangedEvent.


fireModelChanged

protected void fireModelChanged(int changed)
Notifies all listeners that the current tool has changed.


save

public void save(java.io.Writer s)
          throws java.io.IOException
Writes the model to a text stream.

Throws:
java.io.IOException

load

public void load(java.io.StreamTokenizer st)
          throws java.io.IOException
Reads the model from a text stream.

Throws:
java.io.IOException