at.wisch.joystick.ffeffect
Class ConditionEffect

java.lang.Object
  extended by at.wisch.joystick.ffeffect.Effect
      extended by at.wisch.joystick.ffeffect.ConditionEffect
Direct Known Subclasses:
DamperEffect, FrictionEffect, InertiaEffect, SpringEffect

public abstract class ConditionEffect
extends Effect

The Class ConditionEffect. For ConditionEffect the direction is handled by condition internals instead of a direction member.

Array indices for rightSat, leftSat, rightCoef, leftCoef, deadband and center give the index of the FF-axis (Array size is always 3):
- [0] is the X-axis
- [1] is the Y-axis
- [2] is the Z-axis
The term 'right' refers to the positive side of an axis and 'left' refers to the negative side of an axis.

Author:
Martin Wischenbart

Field Summary
 
Fields inherited from class at.wisch.joystick.ffeffect.Effect
EFFECT_CONSTANT, EFFECT_CUSTOM, EFFECT_DAMPER, EFFECT_FRICTION, EFFECT_INERTIA, EFFECT_RAMP, EFFECT_SAWTOOHDOWN, EFFECT_SAWTOOTHUP, EFFECT_SINE, EFFECT_SPRING, EFFECT_SQUARE, EFFECT_TRIANGLE, INFINITE_LENGTH, MAX_DELAY, MAX_LENGTH, MAX_LEVEL, MIN_LEVEL, NO_BUTTON
 
Method Summary
 float[] getCenter()
          Gets the center for condition effects.
 float[] getDeadband()
          Gets the deadband.
 int[] getLeftCoef()
          Gets the leftCoef array: How fast to increase the force towards the negative side.
 int[] getLeftSat()
          Gets the leftSat array: Level when joystick is to the negative side.
 int[] getRightCoef()
          Gets the rightCoef array: How fast to increase the force towards the positive side.
 int[] getRightSat()
          Gets the rightSat array: Level when joystick is to the positive side.
 int getStrength()
          Gets the strength.
 void setCenter(float[] center)
          Sets the center for condition effects.
 void setDeadband(float[] deadband)
          Sets the deadband. 3 dead zone values, 1 for each axis.
 void setLeftCoef(int[] leftCoef)
          Sets the leftCoef array: How fast to increase the force towards the negative side.
 void setLeftSat(int[] leftSat)
          Sets the leftSat array: Level when joystick is to the negative side.
 void setRightCoef(int[] rightCoef)
          Sets the rightCoef array: How fast to increase the force towards the positive side.
 void setRightSat(int[] rightSat)
          Sets the rightSat array: Level when joystick is to the positive side.
 void setStrength(int strength)
          Sets the strength for an effect.
 
Methods inherited from class at.wisch.joystick.ffeffect.Effect
getButtonIndex, getButtonInterval, getDefaultDirection, getEffectDelay, getEffectLength, getEffectType, getName, setButtonIndex, setButtonInterval, setDefaultDirection, setEffectDelay, setEffectLength
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getRightSat

public int[] getRightSat()
Gets the rightSat array: Level when joystick is to the positive side.

Returns:
the rightSat (array of size 3)
See Also:
setRightSat(int[])

setRightSat

public void setRightSat(int[] rightSat)
Sets the rightSat array: Level when joystick is to the positive side.

Parameters:
rightSat - the new rightSat (array of size 3, values from 0 to MAX_LEVEL (32767))
See Also:
getRightSat()

getLeftSat

public int[] getLeftSat()
Gets the leftSat array: Level when joystick is to the negative side.

Returns:
the leftSat (array of size 3)
See Also:
setLeftSat(int[])

setLeftSat

public void setLeftSat(int[] leftSat)
Sets the leftSat array: Level when joystick is to the negative side.

Parameters:
leftSat - the new leftSat (array of size 3, values from 0 to MAX_LEVEL (32767))
See Also:
getLeftSat()

getRightCoef

public int[] getRightCoef()
Gets the rightCoef array: How fast to increase the force towards the positive side.

Returns:
the rightCoef (array of size 3)
See Also:
setRightCoef(int[])

setRightCoef

public void setRightCoef(int[] rightCoef)
Sets the rightCoef array: How fast to increase the force towards the positive side.

Parameters:
rightCoef - the new rightCoef (array of size 3, values from MIN_LEVEL (-32768) to MAX_LEVEL (32767))
See Also:
getRightCoef()

getLeftCoef

public int[] getLeftCoef()
Gets the leftCoef array: How fast to increase the force towards the negative side.

Returns:
the leftCoef (array of size 3)
See Also:
setLeftCoef(int[])

setLeftCoef

public void setLeftCoef(int[] leftCoef)
Sets the leftCoef array: How fast to increase the force towards the negative side.

Parameters:
leftCoef - the new leftCoef (array of size 3, values from MIN_LEVEL (-32768) to MAX_LEVEL (32767))
See Also:
getLeftCoef()

getDeadband

public float[] getDeadband()
Gets the deadband. Deadband is a zone around the center where no effect is played, similar to Joystick.getDeadZone(int) .

Returns:
the array of deadband values for condition effects
See Also:
setDeadband(float[]), getCenter()

setDeadband

public void setDeadband(float[] deadband)
Sets the deadband. 3 dead zone values, 1 for each axis. Deadband is a zone around the center where no effect is played, similar to Joystick.setDeadZone(int, float).

Parameters:
deadband - the new deadband values array (array of size 3, values from 0 to AXIS_MAXIMUM (1f))
See Also:
getDeadband(), setCenter(float[])

getCenter

public float[] getCenter()
Gets the center for condition effects. Default is {0, 0, 0}. Condition effects point towards/away from that center and the deadband is around that center.

Returns:
the array of center values for condition effects (array of size 3 (X-, Y- and Z-axis))
See Also:
setCenter(float[]), getDeadband()

setCenter

public void setCenter(float[] center)
Sets the center for condition effects. Default is {0, 0, 0}. Condition effects point towards/away from that center and the deadband is around that center.

Parameters:
center - the new center (array of size 3 (X-, Y- and Z-axis), values from AXIS_MINIMUM (-1f) to AXIS_MAXIMUM(1f))
See Also:
getCenter(), setDeadband(float[])

getStrength

public int getStrength()
Gets the strength. The strength tells us about the intensity of an effect. Depending on the type of effect the strength is computed differently. If you know the type of effect, use the effect specific methods instead. Strength for a ConditionEffect refers to the rightSat and leftSat values.

Specified by:
getStrength in class Effect
Returns:
the strength
See Also:
setRightSat(int[]), setLeftSat(int[])

setStrength

public void setStrength(int strength)
Sets the strength for an effect. Every kind of effect has some way to set its strength or intensity. This is for convenience only, so we can use FFJoystick.getSimpleEffect() and later set strength without knowing what type of effect we actually have. If you know the type of effect, use the effect specific methods instead. Strength for a ConditionEffect refers to the rightSat and leftSat values. Be aware that applying setStrength can alter the behaviour of the effect, because all rightSat and leftSat values will be set to the same.

Specified by:
setStrength in class Effect
Parameters:
strength - the new strength (an int from 0 to MAX_LEVEL (32767))
See Also:
setRightSat(int[]), setLeftSat(int[])