Package com.thecoderscorner.menu.domain
Class AnalogMenuItem
java.lang.Object
com.thecoderscorner.menu.domain.MenuItem
com.thecoderscorner.menu.domain.AnalogMenuItem
Represents an analog (numeric) menu item, it is always a zero based integer when retrieved from storage, but it can
have an offset and divisor, so therefore is able to represent decimal values. The offset can also be negative. Step
allows the rate of change to be greater than 1 unit, but must be an exact divisor of the maximum value.
Rather than directly constructing an item of this type, you can use the AnalogMenuItemBuilder.
-
Field Summary
Fields inherited from class com.thecoderscorner.menu.domain.MenuItem
eepromAddress, functionName, id, localOnly, name, readOnly, staticDataInRAM, variableName, visible -
Constructor Summary
ConstructorsConstructorDescriptionAnalogMenuItem(String name, String variableName, int id, int eepromAddress, String functionName, int maxValue, int offset, int divisor, int step, String unitName, boolean readOnly, boolean localOnly, boolean visible, boolean staticInRAM) -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(MenuItemVisitor visitor) See the MenuItemVisitor for more info.booleanintThe divisor used when displaying the item, for example value 50 with a divisor of 10 is 5.0intThe maximum value (0 based integer) that this item can representintThe offset from 0 that is used when displaying the item, can be negativeintgetStep()The step is the amount by which each increment should increase the value, it must be exactly divisible by the maximum value.The unit name to appear directly after the value, for example a temperature item may be "oC" where as a volume control could be "dB"inthashCode()Methods inherited from class com.thecoderscorner.menu.domain.MenuItem
getEepromAddress, getFunctionName, getId, getName, getVariableName, hasChildren, isLocalOnly, isReadOnly, isStaticDataInRAM, isVisible, toString
-
Constructor Details
-
AnalogMenuItem
public AnalogMenuItem() -
AnalogMenuItem
-
-
Method Details
-
getMaxValue
public int getMaxValue()The maximum value (0 based integer) that this item can represent- Returns:
- max value
-
getOffset
public int getOffset()The offset from 0 that is used when displaying the item, can be negative- Returns:
- the offset
-
getDivisor
public int getDivisor()The divisor used when displaying the item, for example value 50 with a divisor of 10 is 5.0- Returns:
- the divisor used
-
getStep
public int getStep()The step is the amount by which each increment should increase the value, it must be exactly divisible by the maximum value. Default is 1 and the value can never be lower than 1.- Returns:
- the current step
-
getUnitName
The unit name to appear directly after the value, for example a temperature item may be "oC" where as a volume control could be "dB"- Returns:
- the name of the unit (if any)
-
equals
-
hashCode
public int hashCode()
-