wiiremotej
Class AnalogStick

java.lang.Object
  extended by wiiremotej.AnalogStick

public class AnalogStick
extends java.lang.Object

Represents a simple XY analog stick. AnalogSticks are immutable.


Constructor Summary
AnalogStick(double x, double y)
          Creates a new AnalogStick with the given X and Y values.
 
Method Summary
 boolean equals(java.lang.Object object)
          Returns true if the given object is the same as this AnalogStick; otherwise false.
 double getX()
          Returns the X position of the analog stick, from -1 to 1.
 double getY()
          Returns the Y position of the analog stick, from -1 to 1.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnalogStick

public AnalogStick(double x,
                   double y)
            throws java.lang.IllegalArgumentException
Creates a new AnalogStick with the given X and Y values.

Parameters:
x - the X position of the analog stick. Must be between -1 and 1.
y - the Y position of the analog stick. Must be between -1 and 1.
Throws:
java.lang.IllegalArgumentException - if x and y are not between -1 and 1.
Method Detail

getX

public double getX()
Returns the X position of the analog stick, from -1 to 1.

Returns:
the X position of the analog stick, from -1 to 1.

getY

public double getY()
Returns the Y position of the analog stick, from -1 to 1.

Returns:
the Y position of the analog stick, from -1 to 1.

equals

public boolean equals(java.lang.Object object)
Returns true if the given object is the same as this AnalogStick; otherwise false. Both X and Y must match.

Overrides:
equals in class java.lang.Object
Parameters:
object - the object to compare to for equality.
Returns:
true if the given object is the same as this AnalogStick; otherwise false.