ch.claudio.pen
Class InkStore

java.lang.Object
  extended by ch.claudio.pen.InkStore

public class InkStore
extends java.lang.Object

Stores every ink seen together with time, velocity and acceleration information.

To remove stored dots that result from menu activation some mark and restore back to mark function might be useful.

Version:
$Id: InkStore.java 290 2008-08-13 13:06:27Z claudio $
Author:
Claudio Nieder

Copyright (C) 2006-2008 Claudio Nieder <private@claudio.ch>, CH-8610 Uster

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA


Constructor Summary
InkStore()
           
 
Method Summary
 void clear()
          Removes all stored ink.
 boolean equals(java.lang.Object obj)
           
 InkDot getLast()
           
 int hashCode()
           
 java.util.Iterator<InkDot> iterateList()
           
 void load(java.io.InputStream in)
          Read ink from an input stream
 void load(java.lang.String path)
          Read ink from a file
static void main(java.lang.String[] args)
          Print license.
 InkDot newDot(int xArg, int yArg, PenState stateArg, long time)
          Create a dot, compute velocity and acceleration and store it.
 void save(java.io.OutputStream out)
          Transfer the stored ink to an output stream
 void save(java.lang.String path)
          Transfer the stored ink to a file
 int size()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InkStore

public InkStore()
Method Detail

size

public int size()
Returns:
Number of dots in the store.
See Also:
List.size()

getLast

public InkDot getLast()
Returns:
the last

newDot

public InkDot newDot(int xArg,
                     int yArg,
                     PenState stateArg,
                     long time)
Create a dot, compute velocity and acceleration and store it.

Parameters:
xArg - position
yArg - position
stateArg - state
time - of event
Returns:
dot

clear

public void clear()
Removes all stored ink.


save

public void save(java.io.OutputStream out)
          throws java.io.IOException
Transfer the stored ink to an output stream

Parameters:
out -
Throws:
java.io.IOException
java.io.IOException

save

public void save(java.lang.String path)
          throws java.io.FileNotFoundException,
                 java.io.IOException
Transfer the stored ink to a file

Parameters:
path - path to the file
Throws:
java.io.IOException
java.io.FileNotFoundException

load

public void load(java.io.InputStream in)
          throws java.io.IOException,
                 java.lang.ClassNotFoundException
Read ink from an input stream

Parameters:
in -
Throws:
java.io.IOException
java.lang.ClassNotFoundException

load

public void load(java.lang.String path)
          throws java.io.FileNotFoundException,
                 java.io.IOException,
                 java.lang.ClassNotFoundException
Read ink from a file

Parameters:
path - path of the file
Throws:
java.lang.ClassNotFoundException
java.io.IOException
java.io.FileNotFoundException

iterateList

public java.util.Iterator<InkDot> iterateList()
Returns:
Iterater for this store.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

main

public static void main(java.lang.String[] args)
Print license.

Parameters:
args - ignored