edu.mit.sketch.toolkit
Class DataCollector

java.lang.Object
  |
  +--edu.mit.sketch.toolkit.DataCollector
All Implemented Interfaces:
StrokeDataListener

public class DataCollector
extends Object
implements StrokeDataListener

Collect strokes as they are produced and store them. To do this simply add the DataCollector as a StrokeDataListener to a source of stroke data events. The strokes can then be serialized into a file. That file can then be laoded by a DataSimulator to send the strokes to other StrokeDataListeners.

Created: Wed Sep 5 17:38:43 2001
Copyright: Copyright (C) 2001 by MIT. All Rights Reserved.


Constructor Summary
DataCollector()
          After creation be sure to add this object as a StrokeDataListener.
 
Method Summary
 void handleStroke(StrokeData stroke)
          This method is called by classes that collect StrokeData objects.
static List loadData(String filename)
          This is a convenience method that loads the strokes out of the given file and returns them as a List.
 void reset()
          Delete all the data we have stored up til now.
 void saveData(String filename)
          Serialize the strokes into a file specified by filename.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataCollector

public DataCollector()
After creation be sure to add this object as a StrokeDataListener.
Method Detail

handleStroke

public void handleStroke(StrokeData stroke)
Description copied from interface: StrokeDataListener
This method is called by classes that collect StrokeData objects.
Specified by:
handleStroke in interface StrokeDataListener

saveData

public void saveData(String filename)
Serialize the strokes into a file specified by filename.

reset

public void reset()
Delete all the data we have stored up til now.

loadData

public static List loadData(String filename)
This is a convenience method that loads the strokes out of the given file and returns them as a List.