UC Berkeley Group for User Interface Research
Updated November 17, 2000

edu.berkeley.guir.lib.gesture
Class Gesture

java.lang.Object
  |
  +--java.util.Observable
        |
        +--edu.berkeley.guir.lib.gesture.DefaultGestureObject
              |
              +--edu.berkeley.guir.lib.gesture.Gesture
All Implemented Interfaces:
Cloneable, GestureObject, Serializable

public class Gesture
extends DefaultGestureObject
implements Serializable, Cloneable

See Also:
Serialized Form

Field Summary
static String CREATION_DATE_PROP
          Throw out pixels closer together than the square root of this distance (in pixels).
protected  Date creationDate
           
protected  boolean enabled
           
protected  int lastx
          Init lastx, lasty so the first point will be sure to be far enough away from them not to be filtered out.
protected  int lasty
          Init lastx, lasty so the first point will be sure to be far enough away from them not to be filtered out.
protected  boolean normalized
           
protected  TimedPolygon points
           
static String POINTS_PROP
           
 
Fields inherited from class edu.berkeley.guir.lib.gesture.DefaultGestureObject
author, parent, propChangeSupport, properties
 
Fields inherited from interface edu.berkeley.guir.lib.gesture.GestureObject
AUTHOR_PROP, ENABLED_PROP, PARENT_PROP
 
Constructor Summary
Gesture()
           
Gesture(Gesture g)
           
 
Method Summary
 void addPoint(int x, int y)
          Filters out points that are too close together
 void clearPoints()
           
 Object clone()
          Deep-copies properties.
 void dump(PrintStream out)
          For debugging.
 Rectangle getBounds()
           
 Date getCreationDate()
           
 TimedPolygon getPoints()
          Return a copy of the points of the polygon (copy instead of ref so points can't be changed).
 Object getProperty(String name)
          Get the value of the named property (or null if it is not set).
 boolean hasProperty(String name)
          Returns whether the object has the current property set
 boolean isEnabled()
           
 void normalize()
          Move the corner of the gesture to the origin
 void printTiming(PrintStream out)
           
static Gesture read(Reader reader)
           
static Gesture read(TokenReader r)
           
 void setCreationDate(Date d)
          Creation date is set automatically, so normally this should not need to be called from other classes.
 void setEnabled(boolean e)
          emits property change for property ENABLED_PROP
 void setEnabled(Boolean e)
           
 void setPoints(TimedPolygon p)
          This does not change the creation date.
 void setProperty(String name, Object value)
          Set the named property to a value.
 int size()
           
 String toString()
           
 void write(Writer writer)
           
 
Methods inherited from class edu.berkeley.guir.lib.gesture.DefaultGestureObject
addPropertyChangeListener, addPropertyChangeListener, getAuthor, getParent, readProperties, removePropertyChangeListener, removePropertyChangeListener, setAuthor, setParent, unsetProperty, writeProperties
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CREATION_DATE_PROP

public static final String CREATION_DATE_PROP
Throw out pixels closer together than the square root of this distance (in pixels).

POINTS_PROP

public static final String POINTS_PROP

lastx

protected int lastx
Init lastx, lasty so the first point will be sure to be far enough away from them not to be filtered out.

lasty

protected int lasty
Init lastx, lasty so the first point will be sure to be far enough away from them not to be filtered out.

points

protected TimedPolygon points

normalized

protected boolean normalized

enabled

protected boolean enabled

creationDate

protected Date creationDate
Constructor Detail

Gesture

public Gesture()

Gesture

public Gesture(Gesture g)
Method Detail

addPoint

public void addPoint(int x,
                     int y)
Filters out points that are too close together

getPoints

public TimedPolygon getPoints()
Return a copy of the points of the polygon (copy instead of ref so points can't be changed). To change the points, use setPoints (or addPoint).

setPoints

public void setPoints(TimedPolygon p)
This does not change the creation date.

clearPoints

public void clearPoints()

getBounds

public Rectangle getBounds()

isEnabled

public boolean isEnabled()
Overrides:
isEnabled in class DefaultGestureObject

setEnabled

public void setEnabled(Boolean e)

setEnabled

public void setEnabled(boolean e)
Description copied from interface: GestureObject
emits property change for property ENABLED_PROP
Overrides:
setEnabled in class DefaultGestureObject

normalize

public void normalize()
Move the corner of the gesture to the origin

size

public int size()

hasProperty

public boolean hasProperty(String name)
Description copied from interface: GestureObject
Returns whether the object has the current property set
Overrides:
hasProperty in class DefaultGestureObject

setProperty

public void setProperty(String name,
                        Object value)
Description copied from interface: GestureObject
Set the named property to a value. Null is not allowed as a key or value.
Overrides:
setProperty in class DefaultGestureObject

getProperty

public Object getProperty(String name)
Description copied from interface: GestureObject
Get the value of the named property (or null if it is not set).
Overrides:
getProperty in class DefaultGestureObject

clone

public Object clone()
Description copied from class: DefaultGestureObject
Deep-copies properties. Note that a clone does not have a parent (since the parent doesn't have the clone as a child).
Overrides:
clone in class DefaultGestureObject

dump

public void dump(PrintStream out)
For debugging. Print out all points of the Gesture.

printTiming

public void printTiming(PrintStream out)

setCreationDate

public void setCreationDate(Date d)
Creation date is set automatically, so normally this should not need to be called from other classes.

getCreationDate

public Date getCreationDate()

write

public void write(Writer writer)
           throws IOException

read

public static Gesture read(Reader reader)
                    throws IOException,
                           ParseException

read

public static Gesture read(TokenReader r)
                    throws IOException,
                           ParseException

toString

public String toString()
Overrides:
toString in class Object

Copyright Information