Class DefaultAverageMeter
- All Implemented Interfaces:
Comparable<NamedBean>,AnalogIO,AverageMeter,PropertyChangeProvider,Meter,NamedBean
-
Nested Class Summary
Nested classes/interfaces inherited from interface jmri.AnalogIO
AnalogIO.AbsoluteOrRelativeNested classes/interfaces inherited from interface jmri.Meter
Meter.UnitNested classes/interfaces inherited from interface jmri.NamedBean
NamedBean.BadNameException, NamedBean.BadSystemNameException, NamedBean.BadUserNameException, NamedBean.DisplayOptions, NamedBean.DuplicateSystemNameException -
Field Summary
Fields inherited from class jmri.implementation.AbstractNamedBean
listenerRefs, mSystemName, registerFields inherited from interface jmri.NamedBean
DISPLAY_NAME_FORMAT, INCONSISTENT, PROPERTY_COMMENT, PROPERTY_ENABLED, PROPERTY_KNOWN_STATE, PROPERTY_STATE, PROPERTY_USERNAME, QUOTED_NAME_FORMAT, UNKNOWN -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanCut out of bounds values instead of throwing an exception?voiddisable()Disable this metervoiddispose()Deactivate this object, so that it releases as many resources as possible and no longer effects others.voidenable()Enable this meterIs this AnalogIO absolute or relative?For instances in the code where we are dealing with just a bean and a message needs to be passed to the user or in a log.doubleQuery the known analog value.doublegetMax()Get the maximum value of this AnalogIO.getMeter()Get the meter.doublegetMin()Get the minimum value of this AnalogIO.doubleGet the resolution of this AnalogIO.intgetState()Provide generic access to internal state.intgetTime()Get the time in milliseconds to average on.getUnit()voidRequest an update from the layout.protected voidsendValueToLayout(double value) Sends the string to the layout.voidSet the meter.voidsetState(int s) Provide generic access to internal state.voidsetTime(int time) Set the time in milliseconds to average on.Methods inherited from class jmri.implementation.AbstractAnalogIO
compareSystemNameSuffix, getCommandedAnalogValue, getState, setCommandedAnalogValue, setState, setValueMethods inherited from class jmri.implementation.AbstractNamedBean
addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, describeState, equals, firePropertyChange, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeListenersByReference, getPropertyKeys, getSystemName, getUserName, hashCode, removeProperty, removePropertyChangeListener, removePropertyChangeListener, setComment, setProperty, setUserName, toString, toStringSuffix, updateListenerRef, vetoableChangeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface jmri.AnalogIO
getCommandedAnalogValue, getState, isConsistentValue, setCommandedAnalogValue, setStateMethods inherited from interface jmri.NamedBean
addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, compareTo, describeState, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListenersByReference, getPropertyKeys, getRecommendedToolTip, getSystemName, getUsageReport, getUserName, removeProperty, setComment, setProperty, setUserName, toString, updateListenerRef, vetoableChangeMethods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Constructor Details
-
DefaultAverageMeter
-
DefaultAverageMeter
-
-
Method Details
-
enable
Enable this meter -
disable
Disable this meter -
sendValueToLayout
Sends the string to the layout. The string [u]must not[/u] be longer than the value of getMaximumLength() unless that value is zero. Some microcomputers have little memory and it's very important that this method is never called with too long strings.Override this if the meter can send value to the layout.
- Specified by:
sendValueToLayoutin classAbstractAnalogIO- Parameters:
value- the desired string value- Throws:
JmriException- general error when setting the value fails
-
cutOutOfBoundsValues
Cut out of bounds values instead of throwing an exception? For example, if the AnalogIO is a display, it could be desired to accept too long strings. On the other hand, if the AnalogIO is used to send a command, a too long string is an error.- Specified by:
cutOutOfBoundsValuesin classAbstractAnalogIO- Returns:
- true if long strings should be cut
-
setState
Provide generic access to internal state.This generally shouldn't be used by Java code; use the class-specific form instead (e.g. setCommandedState in Turnout). This is provided to make scripts access easier to read.
- Specified by:
setStatein interfaceNamedBean- Parameters:
s- the state- Throws:
JmriException- general error when setting the state fails
-
getState
Provide generic access to internal state.This generally shouldn't be used by Java code; use the class-specific form instead (e.g. getCommandedState in Turnout). This is provided to make scripts easier to read.
-
getBeanType
For instances in the code where we are dealing with just a bean and a message needs to be passed to the user or in a log.- Specified by:
getBeanTypein interfaceNamedBean- Overrides:
getBeanTypein classAbstractAnalogIO- Returns:
- a string of the bean type, eg Turnout, Sensor etc
-
getUnit
-
getMin
Get the minimum value of this AnalogIO. -
getMax
Get the maximum value of this AnalogIO. -
getResolution
Get the resolution of this AnalogIO.- Specified by:
getResolutionin interfaceAnalogIO- Returns:
- analog resolution.
-
getAbsoluteOrRelative
Is this AnalogIO absolute or relative?- Specified by:
getAbsoluteOrRelativein interfaceAnalogIO- Returns:
- if absolute or relative.
-
requestUpdateFromLayout
Request an update from the layout.- Specified by:
requestUpdateFromLayoutin interfaceAnalogIO
-
getTime
Description copied from interface:AverageMeterGet the time in milliseconds to average on.- Specified by:
getTimein interfaceAverageMeter- Returns:
- the time
-
setTime
Description copied from interface:AverageMeterSet the time in milliseconds to average on.- Specified by:
setTimein interfaceAverageMeter- Parameters:
time- the time
-
getMeter
Description copied from interface:AverageMeterGet the meter.- Specified by:
getMeterin interfaceAverageMeter- Returns:
- the meter
-
setMeter
Description copied from interface:AverageMeterSet the meter.- Specified by:
setMeterin interfaceAverageMeter- Parameters:
meter- the meter
-
getKnownAnalogValue
Query the known analog value. This is a bound parameter, so you can also register a listener to be informed of changes. A result is always returned; if no other feedback method is available, the commanded value will be used.The result must be a valid number, not a NaN or infinity number.
- Specified by:
getKnownAnalogValuein interfaceAnalogIO- Overrides:
getKnownAnalogValuein classAbstractAnalogIO- Returns:
- the known analog value
-
dispose
Deactivate this object, so that it releases as many resources as possible and no longer effects others.For example, if this object has listeners, after a call to this method it should no longer notify those listeners. Any native or system-wide resources it maintains should be released, including threads, files, etc.
It is an error to invoke any other methods on this object once dispose() has been called. Note, however, that there is no guarantee about behavior in that case.
Afterwards, references to this object may still exist elsewhere, preventing its garbage collection. But it's formally dead, and shouldn't be keeping any other objects alive. Therefore, this method should null out any references to other objects that this NamedBean contained.
- Specified by:
disposein interfaceAverageMeter- Specified by:
disposein interfaceMeter- Specified by:
disposein interfaceNamedBean- Overrides:
disposein classAbstractNamedBean
-