com.aleax.gui.gesture
Class Gesture

java.lang.Object
  extended bycom.aleax.gui.gesture.Gesture
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public final class Gesture
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

Provides storage for multiple strokes and an associated action.

Version:
1.0 28 Apr 2001
Author:
Yiannis Paschalidis
See Also:
Serialized Form

Field Summary
 java.lang.String description
          This gesture's (human-readable) description.
 int id
          This gesture's id.
 
Constructor Summary
Gesture(int id, java.lang.String description)
           
Gesture(int id, java.lang.String description, Stroke[] strokes)
           
 
Method Summary
 boolean add(Stroke s)
          Adds a stroke to the gesture if the stroke doesn't match one that is already defined
 java.lang.Object clone()
           
 Stroke getStroke(int index)
           
 boolean hasStroke(Stroke s)
          Is there a stroke in the gesture that matches?
 int numStrokes()
           
 void remove(int index)
          Removes the stroke with the given index.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

public final int id
This gesture's id.


description

public final java.lang.String description
This gesture's (human-readable) description.

Constructor Detail

Gesture

public Gesture(int id,
               java.lang.String description)

Gesture

public Gesture(int id,
               java.lang.String description,
               Stroke[] strokes)
Method Detail

clone

public java.lang.Object clone()

hasStroke

public boolean hasStroke(Stroke s)
Is there a stroke in the gesture that matches?

Returns:
index of matching stroke (1=1st,2=2nd...) or -1 for no match

add

public boolean add(Stroke s)
Adds a stroke to the gesture if the stroke doesn't match one that is already defined


remove

public void remove(int index)
Removes the stroke with the given index.


numStrokes

public int numStrokes()
Returns:
the number of defined strokes for this gesture

getStroke

public Stroke getStroke(int index)
Returns:
the stroke at the specified index