class TouchState
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
(package private) static class |
TouchState.Point
Describes a single touch point
|
Modifier and Type | Field and Description |
---|---|
private int |
pointCount |
private static java.util.Comparator<TouchState.Point> |
pointIdComparator |
private TouchState.Point[] |
points |
private int |
primaryID |
private MonocleWindow |
window |
Constructor and Description |
---|
TouchState() |
Modifier and Type | Method and Description |
---|---|
(package private) TouchState.Point |
addPoint(TouchState.Point p)
Adds a Point to this state object.
|
(package private) void |
assignPrimaryID()
Updates the primary point ID
|
(package private) boolean |
canBeFoldedWith(TouchState ts,
boolean ignoreIDs)
Finds out whether two non-null states are identical in everything but
their touch point coordinates
|
(package private) void |
clear()
Removes all touch points from this state.
|
(package private) void |
clearWindow()
Clears the cached window.
|
(package private) void |
copyTo(TouchState target)
Copies the contents of this state object to another.
|
(package private) boolean |
equalsSorted(TouchState ts)
Compare two non-null states whose points are sorted by ID
|
(package private) TouchState.Point |
getPoint(int index)
Returns the nth point in the toich point list, for index n
|
(package private) int |
getPointCount()
Returns the number of touch points pressed.
|
(package private) TouchState.Point |
getPointForID(int id)
Gets the Point matching the given ID.
|
(package private) int |
getPrimaryID()
Returns the touch point ID of the primary point.
|
(package private) MonocleWindow |
getWindow(boolean recalculateCache,
MonocleWindow fallback)
Returns the Glass window on which this event state is located.
|
(package private) void |
removePointForID(int id)
Removes the point with the given ID
|
(package private) void |
setPoint(int index,
TouchState.Point p)
Replaces the touch point data at the given index with the given touch
point data
|
(package private) void |
sortPointsByID()
Modifies the ordering touch points in this state object so that the
points are sorted in increasing order of ID.
|
java.lang.String |
toString() |
private static java.util.Comparator<TouchState.Point> pointIdComparator
private TouchState.Point[] points
private int pointCount
private int primaryID
private MonocleWindow window
MonocleWindow getWindow(boolean recalculateCache, MonocleWindow fallback)
recalculateCache
- true if the cached value should be discarded and
recomputedfallback
- the window to use if no primary ID is availableTouchState.Point getPoint(int index)
index
- The index of the point point to return. index should be less
than the value returned by getPointCount().TouchState.Point getPointForID(int id)
id
- The Point ID to match. A value of -1 matches any Point.int getPrimaryID()
void assignPrimaryID()
int getPointCount()
void clear()
void clearWindow()
TouchState.Point addPoint(TouchState.Point p)
p
- the Point describing the data to add, or null if no data is
available yet for this point. p is not modified,
but its contents are copied to the object describing the new
Point.void removePointForID(int id)
id
- The ID of the touch point which is to be removed.void setPoint(int index, TouchState.Point p)
index
- the index at which to change the touch point datap
- the data to copy to the given index.void copyTo(TouchState target)
target
- The TouchState to which to copy this state's data.public java.lang.String toString()
toString
in class java.lang.Object
void sortPointsByID()
boolean equalsSorted(TouchState ts)
boolean canBeFoldedWith(TouchState ts, boolean ignoreIDs)
ts
- the TouchState to compare toignoreIDs
- if true, ignore IDs when comparing points