PenProfile 2.x

com.livescribe.storage
Class StrokeStorage

java.lang.Object
  extended by com.livescribe.storage.StrokeStorage

public class StrokeStorage
extends Object

This class describes the system stroke storage. It gives information about current, previous, and next strokes based on time values.

The current implementation is limited to querying the last 50 strokes obtained by the system. For example, if you have a timestamp from before the last 50 strokes, then this will not be able to find that stroke.


Constructor Summary
StrokeStorage(PageInstance page)
          Creates a new stroke storage instance.
 
Method Summary
 Point getLastCoord()
          Returns the last point.
 long getLastStroke()
          Returns the last stroke time.
 long getNextStroke(long time)
          Returns the next stroke time, in milliseconds.
 long getPreviousStroke(long time)
          Returns the previous stroke time, in milliseconds.
 Stroke getStroke(long time)
          Returns the stroke corresponding to the specified time.
 Rectangle getStrokeBoundingBox(long time)
          Returns the rectangle bounding the stroke.
 boolean isTap(long time)
          Checks if the stroke is a tap
 boolean isTap(long time1, long time2)
          Checks if a stroke is a double tap
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StrokeStorage

public StrokeStorage(PageInstance page)
Creates a new stroke storage instance.

Parameters:
page - the page instance
Method Detail

getStroke

public Stroke getStroke(long time)
Returns the stroke corresponding to the specified time.

Parameters:
time - the time corresponding to the stroke
Returns:
the stroke corresponding to the specified time.
See Also:
Stroke

getStrokeBoundingBox

public Rectangle getStrokeBoundingBox(long time)
Returns the rectangle bounding the stroke.

Parameters:
time - the time corresponding to the stroke
Returns:
the rectangle bounding the stroke.

getPreviousStroke

public long getPreviousStroke(long time)
Returns the previous stroke time, in milliseconds.

Parameters:
time - the time corresponding to the current stroke
Returns:
previous stroke time, in ms.

getNextStroke

public long getNextStroke(long time)
Returns the next stroke time, in milliseconds.

Parameters:
time - the time corresponding to the current stroke
Returns:
next stroke time, in ms.

getLastStroke

public long getLastStroke()
Returns the last stroke time.

Returns:
the time of the last stroke, in ms.
See Also:
getLastCoord()

isTap

public boolean isTap(long time)
Checks if the stroke is a tap

Parameters:
time - the timestamp of the stroke
Returns:
true if it is a tap, false if stroke is not found or it is not a tap

isTap

public boolean isTap(long time1,
                     long time2)
Checks if a stroke is a double tap

Parameters:
time1 - the timestamp of one of the strokes
time2 - the timestamp of the other stroke (order does not matter)
Returns:
if it is a double tap, false if stroke is not found or it is not a double tap

getLastCoord

public Point getLastCoord()
Returns the last point. This will return an instance of Point. This can be used, for example, in a thread that monitors the current pen position.

Returns:
the last coordinate as a Point instance.
See Also:
getLastStroke()

PenProfile 2.x

Copyright © 2010 Livescribe Inc. All Rights Reserved.
Confidential and subject to NDA.