Package jmri
Class BeanSetting
- All Implemented Interfaces:
BeanInterface,PropertyChangeFirer,PropertyChangeProvider,ExpectedState<NamedBean,Integer>
Represent a NamedBean (such as a Turnout) and specific desired setting for
it. These can be used to represent the setting a NamedBean has as part of a
particular path through a layout, or a condition that has to be true as part
of something.
Objects of this class are immutable, in that once created the selected bean
and required setting cannot be changed. However, the value of the
check() method does change, because it's a function of the current
bean setting(s).
-
Field Summary
Fields inherited from class jmri.beans.Bean
propertyChangeSupportFields inherited from interface jmri.ExpectedState
EXPECTED_STATE -
Constructor Summary
ConstructorsConstructorDescriptionBeanSetting(NamedBean t, int setting) BeanSetting(NamedBean t, String pName, int setting) -
Method Summary
Modifier and TypeMethodDescriptionbooleancheck()Convenience method; check if the Bean currently has the desired setting.booleangetBean()intinthashCode()voidsetExpectedState(Integer state) Set the expected state.Methods inherited from class jmri.util.NamedBeanExpectedValue
getExpectedState, getName, getObjectMethods inherited from class jmri.beans.Bean
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, isNotifyOnEDT, removePropertyChangeListener, removePropertyChangeListenerMethods inherited from class jmri.beans.UnboundBean
getIndexedProperty, getProperty, getPropertyNames, hasIndexedProperty, hasProperty, setIndexedProperty, setProperty
-
Constructor Details
-
BeanSetting
-
BeanSetting
-
-
Method Details
-
check
Convenience method; check if the Bean currently has the desired setting.- Returns:
- true if bean has expected setting; false otherwise
-
getBean
-
getBeanName
-
getSetting
-
setExpectedState
Set the expected state.If UnsupportedOperationException is not thrown, this must fire a
PropertyChangeEventwith the name "expectedState"This implementation requires a non-null parameter.
This implementation always throws an UnsupportedOperationException since a BeanSetting is immutable.
- Specified by:
setExpectedStatein interfaceExpectedState<NamedBean,Integer> - Overrides:
setExpectedStatein classNamedBeanExpectedState<NamedBean>- Parameters:
state- the new expected state- Throws:
UnsupportedOperationException- if called
-
equals
-
hashCode
-