edu.stanford.hci.r3.pen
Class PenSample

java.lang.Object
  extended by edu.stanford.hci.r3.pen.PenSample
All Implemented Interfaces:
java.io.Serializable

public class PenSample
extends java.lang.Object
implements java.io.Serializable

Stores a pen sample or ink samples.

This software is distributed under the BSD License.

See Also:
Serialized Form

Field Summary
 int force
          measure of force from pen tip
 boolean penUp
          whether pen is up
 long timestamp
          timestamp of server when received
 double x
          x location of the point, in physical Anoto coordinates TODO: Make these private later...
 double y
          y location of the point, in physical Anoto coordinates
 
Constructor Summary
PenSample(double xVal, double yVal, int f, long ts)
           
PenSample(double theX, double theY, int theForce, long theTimestamp, boolean isPenUp)
           
 
Method Summary
 double getDistanceFrom(PenSample otherSample)
           
 int getForce()
           
 java.util.Date getTime()
           
 long getTimestamp()
           
 double getX()
           
 double getY()
           
 boolean isPenUp()
           
 void setForce(int f)
           
 void setPenUp(boolean b)
          Does this sample represent a Pen Up? Perhaps we should subclass PenSample, instead of storing another field in here? It seems a little wasteful if most samples are not pen up samples.
 void setTimestamp(long t)
           
 void setX(double xVal)
           
 void setY(double yVal)
           
 java.lang.String toCommaSeparatedString()
           
 java.lang.String toString()
           
 java.lang.String toXMLString()
          So far, this is used when communicating with Flash in real time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

force

public int force
measure of force from pen tip


penUp

public boolean penUp
whether pen is up


timestamp

public long timestamp
timestamp of server when received


x

public double x
x location of the point, in physical Anoto coordinates TODO: Make these private later...


y

public double y
y location of the point, in physical Anoto coordinates

Constructor Detail

PenSample

public PenSample(double xVal,
                 double yVal,
                 int f,
                 long ts)
Parameters:
xVal -
yVal -
f -
ts -

PenSample

public PenSample(double theX,
                 double theY,
                 int theForce,
                 long theTimestamp,
                 boolean isPenUp)
Parameters:
theX -
theY -
theForce - hehehe.
theTimestamp -
isPenUp -
Method Detail

getDistanceFrom

public double getDistanceFrom(PenSample otherSample)

getForce

public int getForce()
Returns:

getTime

public java.util.Date getTime()
Returns:

getTimestamp

public long getTimestamp()
Returns:

getX

public double getX()
Returns:

getY

public double getY()
Returns:

isPenUp

public boolean isPenUp()
Returns:

setForce

public void setForce(int f)
Parameters:
f -

setPenUp

public void setPenUp(boolean b)
Does this sample represent a Pen Up? Perhaps we should subclass PenSample, instead of storing another field in here? It seems a little wasteful if most samples are not pen up samples. =\

Parameters:
b -

setTimestamp

public void setTimestamp(long t)
Parameters:
t -

setX

public void setX(double xVal)
Parameters:
xVal -

setY

public void setY(double yVal)
Parameters:
yVal -

toCommaSeparatedString

public java.lang.String toCommaSeparatedString()
Returns:

toString

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

toXMLString

public java.lang.String toXMLString()
So far, this is used when communicating with Flash in real time.

Returns:

Copyright 2006 Stanford University