Package jmri
Class BeanSetting
- java.lang.Object
- 
- jmri.beans.UnboundBean
- 
- jmri.beans.Bean
- 
- jmri.util.NamedBeanExpectedValue<T,java.lang.Integer>
- 
- jmri.util.NamedBeanExpectedState<NamedBean>
- 
- jmri.BeanSetting
 
 
 
 
 
- 
- All Implemented Interfaces:
- BeanInterface,- PropertyChangeFirer,- PropertyChangeProvider,- ExpectedState<NamedBean,java.lang.Integer>
 
 @Immutable public class BeanSetting extends NamedBeanExpectedState<NamedBean> 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.BeanpropertyChangeSupport
 - 
Fields inherited from interface jmri.ExpectedStateEXPECTED_STATE
 
- 
 - 
Constructor SummaryConstructors Constructor Description BeanSetting(NamedBean t, int setting)BeanSetting(NamedBean t, java.lang.String pName, int setting)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheck()Convenience method; check if the Bean currently has the desired setting.booleanequals(java.lang.Object obj)NamedBeangetBean()java.lang.StringgetBeanName()intgetSetting()inthashCode()voidsetExpectedState(java.lang.Integer state)Set the expected state.- 
Methods inherited from class jmri.util.NamedBeanExpectedValuegetExpectedState, getName, getObject
 - 
Methods inherited from class jmri.beans.BeanaddPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, isNotifyOnEDT, removePropertyChangeListener, removePropertyChangeListener
 - 
Methods inherited from class jmri.beans.UnboundBeangetIndexedProperty, getProperty, getPropertyNames, hasIndexedProperty, hasProperty, setIndexedProperty, setProperty
 
- 
 
- 
- 
- 
Constructor Detail- 
BeanSettingpublic BeanSetting(NamedBean t, java.lang.String pName, int setting) 
 - 
BeanSettingpublic BeanSetting(NamedBean t, int setting) 
 
- 
 - 
Method Detail- 
checkpublic boolean check() Convenience method; check if the Bean currently has the desired setting.- Returns:
- true if bean has expected setting; false otherwise
 
 - 
getBeanNamepublic java.lang.String getBeanName() 
 - 
getSettingpublic int getSetting() 
 - 
setExpectedStatepublic void setExpectedState(java.lang.Integer state) 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 interface- ExpectedState<NamedBean,java.lang.Integer>
- Overrides:
- setExpectedStatein class- NamedBeanExpectedState<NamedBean>
- Parameters:
- state- the new expected state
- Throws:
- java.lang.UnsupportedOperationException- if called
 
 - 
equalspublic boolean equals(java.lang.Object obj) - Overrides:
- equalsin class- java.lang.Object
 
 - 
hashCodepublic int hashCode() - Overrides:
- hashCodein class- java.lang.Object
 
 
- 
 
-