net.ctdp.rfdynhud.properties
Class FactoredIntProperty

java.lang.Object
  extended by net.ctdp.rfdynhud.properties.Property
      extended by net.ctdp.rfdynhud.properties.IntProperty
          extended by net.ctdp.rfdynhud.properties.FactoredIntProperty

public class FactoredIntProperty
extends IntProperty

The FactoredIntProperty serves for customizing a primitive int value multiplied or divided by a factor.

Author:
Marvin Froehlich (CTDP)

Constructor Summary
FactoredIntProperty(java.lang.String name, int factor, int divisor, int defaultValue, int minValue, int maxValue)
           
FactoredIntProperty(java.lang.String name, int factor, int divisor, int defaultValue, int minValue, int maxValue, boolean readonly)
           
FactoredIntProperty(java.lang.String name, java.lang.String nameForDisplay, int factor, int divisor, int defaultValue, int minValue, int maxValue)
           
FactoredIntProperty(java.lang.String name, java.lang.String nameForDisplay, int factor, int divisor, int defaultValue, int minValue, int maxValue, boolean readonly)
           
 
Method Summary
protected  long deriveValue(int value, int factor, int divisor)
          This method is utilized to derive the factored value from the property value.
 int getDivisor()
          Gets the divisor.
 int getFactor()
          Gets the factor.
 double getFactoredDoubleValue()
          Gets the value multiplied by the factor or divided by the divisor.
 long getFactoredValue()
          Gets the value multiplied by the factor or divided by the divisor.
 
Methods inherited from class net.ctdp.rfdynhud.properties.IntProperty
fixValue, getFloatValue, getIntValue, getMaxValue, getMinValue, getValue, loadValue, onKeeperSet, onValueChanged, setIntValue, setIntValue, setValue
 
Methods inherited from class net.ctdp.rfdynhud.properties.Property
getButtonText, getButtonTooltip, getDocumentationSource, getEditorType, getKeeper, getName, getNameForDisplay, getValueForConfigurationFile, isMatchingKey, isReadOnly, onButtonClicked, quoteValueInConfigurationFile, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FactoredIntProperty

public FactoredIntProperty(java.lang.String name,
                           java.lang.String nameForDisplay,
                           int factor,
                           int divisor,
                           int defaultValue,
                           int minValue,
                           int maxValue,
                           boolean readonly)
Parameters:
name - the technical name used internally. See Property.getName().
nameForDisplay - the name displayed in the editor. See Property.getNameForDisplay(). If null is passed, the value of the name parameter is used.
factor - the factor (0 for divisor usage)
divisor - the divisor (0 for factor usage)
defaultValue - the default value
minValue - the minimum value
maxValue - the maximum value
readonly - read only property?

FactoredIntProperty

public FactoredIntProperty(java.lang.String name,
                           java.lang.String nameForDisplay,
                           int factor,
                           int divisor,
                           int defaultValue,
                           int minValue,
                           int maxValue)
Parameters:
name - the technical name used internally. See Property.getName().
nameForDisplay - the name displayed in the editor. See Property.getNameForDisplay(). If null is passed, the value of the name parameter is used.
factor - the factor (0 for divisor usage)
divisor - the divisor (0 for factor usage)
defaultValue - the default value
minValue - the minimum value
maxValue - the maximum value

FactoredIntProperty

public FactoredIntProperty(java.lang.String name,
                           int factor,
                           int divisor,
                           int defaultValue,
                           int minValue,
                           int maxValue,
                           boolean readonly)
Parameters:
name - the technical name used internally. See Property.getName(). 'nameForDisplay' is set to the same value.
factor - the factor (0 for divisor usage)
divisor - the divisor (0 for factor usage)
defaultValue - the default value
minValue - the minimum value
maxValue - the maximum value
readonly - read only property?

FactoredIntProperty

public FactoredIntProperty(java.lang.String name,
                           int factor,
                           int divisor,
                           int defaultValue,
                           int minValue,
                           int maxValue)
Parameters:
name - the technical name used internally. See Property.getName(). 'nameForDisplay' is set to the same value.
factor - the factor (0 for divisor usage)
divisor - the divisor (0 for factor usage)
defaultValue - the default value
minValue - the minimum value
maxValue - the maximum value
Method Detail

getFactor

public final int getFactor()
Gets the factor. This is zero, if divisor is used.

Returns:
the factor.
See Also:
getDivisor()

getDivisor

public final int getDivisor()
Gets the divisor. This is zero, if factor is used.

Returns:
the divisor.
See Also:
getFactor()

deriveValue

protected long deriveValue(int value,
                           int factor,
                           int divisor)
This method is utilized to derive the factored value from the property value.

Parameters:
value - the property value
factor - the factor (zero, if divisor is used)
divisor - the divisor (zero, if factor is used)
Returns:
the derived value.

getFactoredValue

public final long getFactoredValue()
Gets the value multiplied by the factor or divided by the divisor.

Returns:
the value multiplied by the factor or divided by the divisor.

getFactoredDoubleValue

public final double getFactoredDoubleValue()
Gets the value multiplied by the factor or divided by the divisor.

Returns:
the value multiplied by the factor or divided by the divisor.