Parkinson Disease Database

tablet
Class TabletPoint

java.lang.Object
  extended by tablet.TabletPoint

public class TabletPoint
extends java.lang.Object

Class stores information about tablet packet/point.

Copyright: Copyright (c) 2005 Miroslav Skrbek, Jan Dolezel

Company: ČVUT FEL, Prague


Field Summary
static int BUTTON_1
          1st button is pressed
static int BUTTON_2
          2nd button is pressed
static int BUTTON_3
          3rd button is pressed
static int BUTTON_TOUCH
          pen is touching a surface
private  int[] packet
           
static int paket_length
          packet with information about point
static int PK_ALTITUDE
          altitude of pen above surface
static int PK_AZIMUTH
          pen's slope
static int PK_BUTTONS
          pressed buttons
static int PK_NORMAL_PRESSURE
          pen's pressure
static int PK_SERIAL_NUMBER
          packet's serial number
static int PK_TIME
          packet's creation time
static int PK_X
          x coordinate of point
static int PK_Y
          y coordinate of point
 
Constructor Summary
TabletPoint(byte[] array)
          creates new point from byte array when loading from file Format of byte array:
3 bytes - x coordinate
3 bytes - y coordinate
4 bytes - time
2 bytes - azimuth
2 bytes - altitude
2 bytes - pressure
1 byte - buttons
3 bytes - serial number
TabletPoint(int[] packet)
          creates new point from tablet packet Format of packet:
0 - x coordinate
1 - y coordinate
2 - buttons
3 - azimuth
4 - altitude
5 - pressure
6 - time
7 - serial number
 
Method Summary
 int getAltitude()
          returns altitude of pen above surface
 int getAzimuth()
          returns slope of pen
 int getButtons()
          returns pressed buttons
 int getNormalPressure()
          returns pen's pressure
 int getSerialNumber()
          returns serial number of packet
 long getTime()
          returns time of packet's creation
 int getX()
          returns x coordinate of point
 int getY()
          returns y coordinate of point
static java.lang.String header()
          Header with information about text format of TabletPoint
 boolean isButtonPressed(int button)
          tests whether is specified button pressed
 boolean isTouched()
           
 void print(java.io.OutputStream out)
          writes 20 bytes of information to output stream
 void print(java.io.PrintStream out)
          writes text representation of point to print stream
private  byte[] toByte(int num, int bytes)
          converts int array of bytes
private  int toInt(byte[] array, int bytes, int position)
          converts part of byte array to positive integer
 java.lang.String toString()
          text representation of TabletPoint
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BUTTON_TOUCH

public static final int BUTTON_TOUCH
pen is touching a surface

See Also:
Constant Field Values

BUTTON_1

public static final int BUTTON_1
1st button is pressed

See Also:
Constant Field Values

BUTTON_2

public static final int BUTTON_2
2nd button is pressed

See Also:
Constant Field Values

BUTTON_3

public static final int BUTTON_3
3rd button is pressed

See Also:
Constant Field Values

PK_X

public static final int PK_X
x coordinate of point

See Also:
Constant Field Values

PK_Y

public static final int PK_Y
y coordinate of point

See Also:
Constant Field Values

PK_BUTTONS

public static final int PK_BUTTONS
pressed buttons

See Also:
Constant Field Values

PK_AZIMUTH

public static final int PK_AZIMUTH
pen's slope

See Also:
Constant Field Values

PK_ALTITUDE

public static final int PK_ALTITUDE
altitude of pen above surface

See Also:
Constant Field Values

PK_NORMAL_PRESSURE

public static final int PK_NORMAL_PRESSURE
pen's pressure

See Also:
Constant Field Values

PK_TIME

public static final int PK_TIME
packet's creation time

See Also:
Constant Field Values

PK_SERIAL_NUMBER

public static final int PK_SERIAL_NUMBER
packet's serial number

See Also:
Constant Field Values

paket_length

public static final int paket_length
packet with information about point

See Also:
Constant Field Values

packet

private int[] packet
Constructor Detail

TabletPoint

public TabletPoint(int[] packet)
creates new point from tablet packet

Format of packet:
0 - x coordinate
1 - y coordinate
2 - buttons
3 - azimuth
4 - altitude
5 - pressure
6 - time
7 - serial number


TabletPoint

public TabletPoint(byte[] array)
creates new point from byte array when loading from file

Format of byte array:
3 bytes - x coordinate
3 bytes - y coordinate
4 bytes - time
2 bytes - azimuth
2 bytes - altitude
2 bytes - pressure
1 byte - buttons
3 bytes - serial number

Parameters:
array - 20 bytes of information
Method Detail

getX

public int getX()
returns x coordinate of point


getY

public int getY()
returns y coordinate of point


getButtons

public int getButtons()
returns pressed buttons


getAzimuth

public int getAzimuth()
returns slope of pen


getAltitude

public int getAltitude()
returns altitude of pen above surface


getNormalPressure

public int getNormalPressure()
returns pen's pressure


getTime

public long getTime()
returns time of packet's creation


getSerialNumber

public int getSerialNumber()
returns serial number of packet


isButtonPressed

public boolean isButtonPressed(int button)
tests whether is specified button pressed


isTouched

public boolean isTouched()
Returns:
boolean vrací true, pokud se pero dotýká tabletu

header

public static java.lang.String header()
Header with information about text format of TabletPoint


toString

public java.lang.String toString()
text representation of TabletPoint

Overrides:
toString in class java.lang.Object
Returns:
88 characters

print

public void print(java.io.OutputStream out)
           throws java.io.IOException
writes 20 bytes of information to output stream

Throws:
java.io.IOException

print

public void print(java.io.PrintStream out)
           throws java.io.IOException
writes text representation of point to print stream

Throws:
java.io.IOException

toByte

private byte[] toByte(int num,
                      int bytes)
converts int array of bytes

Parameters:
num - positive integer to convert
bytes - array length
Returns:
byte[] coverted byte array

toInt

private int toInt(byte[] array,
                  int bytes,
                  int position)
converts part of byte array to positive integer

Parameters:
array - byte array to convert
bytes - number of bytes to convert
position - start position
Returns:
int converted integer

Parkinson Disease Database