Class DefaultMeter
- java.lang.Object
- 
- jmri.implementation.AbstractNamedBean
- 
- jmri.implementation.AbstractAnalogIO
- 
- jmri.implementation.DefaultMeter
 
 
 
- 
- All Implemented Interfaces:
- java.lang.Comparable<NamedBean>,- AnalogIO,- PropertyChangeProvider,- Meter,- NamedBean
 - Direct Known Subclasses:
- DefaultMeter.DefaultCurrentMeter,- DefaultMeter.DefaultVoltageMeter
 
 public class DefaultMeter extends AbstractAnalogIO implements Meter Abstract base class for current meter objects.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classDefaultMeter.DefaultCurrentMeterDefault implementation of a current meter.static classDefaultMeter.DefaultVoltageMeterDefault implementation of a voltage meter.- 
Nested classes/interfaces inherited from interface jmri.AnalogIOAnalogIO.AbsoluteOrRelative
 - 
Nested classes/interfaces inherited from interface jmri.MeterMeter.Unit
 - 
Nested classes/interfaces inherited from interface jmri.NamedBeanNamedBean.BadNameException, NamedBean.BadSystemNameException, NamedBean.BadUserNameException, NamedBean.DisplayOptions, NamedBean.DuplicateSystemNameException
 
- 
 - 
Field Summary- 
Fields inherited from class jmri.implementation.AbstractNamedBeanlistenerRefs, mSystemName, register
 - 
Fields inherited from interface jmri.NamedBeanDISPLAY_NAME_FORMAT, INCONSISTENT, PROPERTY_COMMENT, PROPERTY_ENABLED, PROPERTY_KNOWN_STATE, PROPERTY_STATE, PROPERTY_USERNAME, QUOTED_NAME_FORMAT, UNKNOWN
 
- 
 - 
Constructor SummaryConstructors Constructor Description DefaultMeter(java.lang.String sys, Meter.Unit unit, double min, double max, double resolution, MeterUpdateTask updateTask)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancutOutOfBoundsValues()Cut 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 meterAnalogIO.AbsoluteOrRelativegetAbsoluteOrRelative()Is this AnalogIO absolute or relative?java.lang.StringgetBeanType()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.doublegetMax()Get the maximum value of this AnalogIO.doublegetMin()Get the minimum value of this AnalogIO.doublegetResolution()Get the resolution of this AnalogIO.intgetState()Provide generic access to internal state.Meter.UnitgetUnit()voidrequestUpdateFromLayout()Request an update from the layout.protected voidsendValueToLayout(double value)Sends the string to the layout.voidsetState(int s)Provide generic access to internal state.- 
Methods inherited from class jmri.implementation.AbstractAnalogIOcompareSystemNameSuffix, getCommandedAnalogValue, getKnownAnalogValue, getState, setCommandedAnalogValue, setState, setValue
 - 
Methods inherited from class jmri.implementation.AbstractNamedBeanaddPropertyChangeListener, 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, vetoableChange
 - 
Methods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface jmri.AnalogIOgetCommandedAnalogValue, getKnownAnalogValue, getState, isConsistentValue, setCommandedAnalogValue, setState
 - 
Methods inherited from interface jmri.NamedBeanaddPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, compareTo, describeState, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListenersByReference, getPropertyKeys, getRecommendedToolTip, getSystemName, getUsageReport, getUserName, removeProperty, setComment, setProperty, setUserName, toString, updateListenerRef, vetoableChange
 - 
Methods inherited from interface jmri.beans.PropertyChangeProvideraddPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
 
- 
 
- 
- 
- 
Constructor Detail- 
DefaultMeterpublic DefaultMeter(@Nonnull java.lang.String sys, @Nonnull Meter.Unit unit, double min, double max, double resolution, MeterUpdateTask updateTask) 
 
- 
 - 
Method Detail- 
sendValueToLayoutprotected void sendValueToLayout(double value) throws JmriException 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 class- AbstractAnalogIO
- Parameters:
- value- the desired string value
- Throws:
- JmriException- general error when setting the value fails
 
 - 
cutOutOfBoundsValuesprotected boolean 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 class- AbstractAnalogIO
- Returns:
- true if long strings should be cut
 
 - 
setStatepublic void setState(int s) throws JmriException 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 interface- NamedBean
- Parameters:
- s- the state
- Throws:
- JmriException- general error when setting the state fails
 
 - 
getStatepublic int 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. 
 - 
getBeanTypepublic java.lang.String 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 interface- NamedBean
- Overrides:
- getBeanTypein class- AbstractAnalogIO
- Returns:
- a string of the bean type, eg Turnout, Sensor etc
 
 - 
getUnitpublic Meter.Unit getUnit() 
 - 
getMinpublic double getMin() Get the minimum value of this AnalogIO.
 - 
getMaxpublic double getMax() Get the maximum value of this AnalogIO.
 - 
getResolutionpublic double getResolution() Get the resolution of this AnalogIO.- Specified by:
- getResolutionin interface- AnalogIO
- Returns:
- analog resolution.
 
 - 
getAbsoluteOrRelativepublic AnalogIO.AbsoluteOrRelative getAbsoluteOrRelative() Is this AnalogIO absolute or relative?- Specified by:
- getAbsoluteOrRelativein interface- AnalogIO
- Returns:
- if absolute or relative.
 
 - 
disposepublic void 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. 
 - 
requestUpdateFromLayoutpublic void requestUpdateFromLayout() Request an update from the layout.- Specified by:
- requestUpdateFromLayoutin interface- AnalogIO
 
 
- 
 
-