moapi
Class ModSliderOption

java.lang.Object
  extended by moapi.ModOption<java.lang.Float>
      extended by moapi.ModSliderOption

public class ModSliderOption
extends ModOption<java.lang.Float>

Provides an interface to create a simple bounded slider

Since:
0.1

Field Summary
 
Fields inherited from class moapi.ModOption
callback, global, localValue, name, value
 
Constructor Summary
ModSliderOption(java.lang.String name)
          Create a slider with given name
ModSliderOption(java.lang.String name, int low, int high)
          Create a bounded slider
ModSliderOption(java.lang.String id, java.lang.String name)
          Create a slider option with a given id and name
ModSliderOption(java.lang.String id, java.lang.String name, int low, int high)
          Create a bounded slider with a given ID
 
Method Summary
 int getHighVal()
          Get the highest value of the slider
 int getLowVal()
          Get the lowest value of the slider
 void setGlobalValue(java.lang.Float value)
          Set the global value
 void setGlobalValue(int value)
          Set the global value using an int
 void setLocalValue(java.lang.Float value)
          Set the float value
 void setLocalValue(int value)
          Set the local value using an int
 void setValue(java.lang.Float value)
          Set the float value
 void setValue(int value)
          Set the integer value
 float transformValue(float value, int lower, int upper)
          Transforms the given value from it's current upper and lower bounds to the corresponding place in the ones provided
 float untransformValue(float value, int lower, int upper)
          Transforms a value back from a given range into the local range
 
Methods inherited from class moapi.ModOption
getCallback, getGlobalValue, getID, getLocalValue, getName, getValue, getValue, hasCallback, setCallback, setGlobal, setName, setValue, useGlobalValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModSliderOption

public ModSliderOption(java.lang.String name)
Create a slider with given name

Parameters:
name - Name of this slider

ModSliderOption

public ModSliderOption(java.lang.String name,
                       int low,
                       int high)
Create a bounded slider

Parameters:
name - Name of slider
low - Lowest value of slider
high - Highest value of slider

ModSliderOption

public ModSliderOption(java.lang.String id,
                       java.lang.String name,
                       int low,
                       int high)
Create a bounded slider with a given ID

Parameters:
id - ID of this option
name - Name of slider
low - Lowest value of slider
high - Highest value of slider
Since:
0.8

ModSliderOption

public ModSliderOption(java.lang.String id,
                       java.lang.String name)
Create a slider option with a given id and name

Parameters:
id - ID value for this slider
name - Name of this slider
Since:
0.8
Method Detail

getHighVal

public int getHighVal()
Get the highest value of the slider

Returns:
Highest value of the slider

getLowVal

public int getLowVal()
Get the lowest value of the slider

Returns:
Lowest value of the slider

setValue

public void setValue(java.lang.Float value)
Set the float value

Overrides:
setValue in class ModOption<java.lang.Float>
Parameters:
value - Value being set

setValue

public void setValue(int value)
Set the integer value

Parameters:
value - Value being set

setLocalValue

public void setLocalValue(java.lang.Float value)
Set the float value

Overrides:
setLocalValue in class ModOption<java.lang.Float>
Parameters:
value - Value being set

setLocalValue

public void setLocalValue(int value)
Set the local value using an int

Parameters:
value - Value being set
Since:
0.6.1

setGlobalValue

public void setGlobalValue(java.lang.Float value)
Set the global value

Overrides:
setGlobalValue in class ModOption<java.lang.Float>
Parameters:
value - Value being set

setGlobalValue

public void setGlobalValue(int value)
Set the global value using an int

Parameters:
value - Value being set
Since:
0.6.1

transformValue

public float transformValue(float value,
                            int lower,
                            int upper)
Transforms the given value from it's current upper and lower bounds to the corresponding place in the ones provided

Parameters:
value - The value to transform
lower - Lower bound to transform to
upper - Upper bound to transform to
Returns:
Value transformed from between low to high to between lower to upper
Since:
0.6.1

untransformValue

public float untransformValue(float value,
                              int lower,
                              int upper)
Transforms a value back from a given range into the local range

Parameters:
value - Transformed value
lower - Lower bound to transform from
upper - Upper bound to transform from
Returns:
Value in the range of this slider
Since:
0.6.1