jmri
Interface NamedBean

All Known Subinterfaces:
Audio, AudioBuffer, AudioListener, AudioSource, CatalogTree, Conditional, Light, Logix, Memory, Reporter, Route, Sensor, SignalHead, SignalMast, Turnout
All Known Implementing Classes:
AbstractAudio, AbstractAudioBuffer, AbstractAudioListener, AbstractAudioSource, AbstractCatalogTree, AbstractLight, AbstractMemory, AbstractNamedBean, AbstractReporter, AbstractSensor, AbstractSignalHead, AbstractTurnout, AbstractVariableLight, AcelaLight, AcelaSensor, AcelaSignalHead, AcelaTurnout, Block, CatalogTreeFS, CatalogTreeIndex, CbusSensor, CbusTurnout, DccSignalHead, DefaultConditional, DefaultLogix, DefaultMemory, DefaultRoute, DefaultSignalHead, DoubleTurnoutSignalHead, EasyDccTurnout, EcosTurnout, EliteXNetTurnout, JavaSoundAudioBuffer, JavaSoundAudioListener, JavaSoundAudioSource, JoalAudioBuffer, JoalAudioListener, JoalAudioSource, LayoutBlock, LnLight, LnReporter, LnSensor, LnTurnout, LsDecSignalHead, MergSD2SignalHead, NceSensor, NceTurnout, NullAudioBuffer, NullAudioListener, NullAudioSource, OBlock, QuadOutputSignalHead, RpsReporter, RpsSensor, SE8cSignalHead, Section, SensorGroupConditional, SerialLight, SerialLight, SerialLight, SerialLight, SerialLight, SerialLight, SerialSensor, SerialSensor, SerialSensor, SerialSensor, SerialSensor, SerialSensor, SerialSignalHead, SerialTurnout, SerialTurnout, SerialTurnout, SerialTurnout, SerialTurnout, SerialTurnout, SerialTurnout, SpecificLight, SpecificLight, SpecificLight, SprogCSTurnout, SprogTurnout, SRCPTurnout, Transit, TripleTurnoutSignalHead, VirtualSignalHead, Warrant, XNetLight, XNetSensor, XNetTurnout, XpaTurnout

public interface NamedBean

Provides common services for classes representing objects on the layout, and allows a common form of access by their Managers.

Each object has a two names. The "user" name is entirely free form, and can be used for any purpose. The "system" name is provided by the system-specific implementations, and provides a unique mapping to the layout control system (e.g. LocoNet, NCE, etc) and address within that system.


This file is part of JMRI.

JMRI is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. See the "COPYING" file for a copy of this license.

JMRI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Author:
Bob Jacobsen Copyright (C) 2001, 2002, 2003, 2004
See Also:
Manager

Field Summary
static int INCONSISTENT
          Constant representing an "inconsistent" state, indicating that some inconsistency has been detected in the hardware readback.
static int UNKNOWN
          Constant representing an "unknown" state, indicating that the object's state is not necessarily that of the actual layout hardware.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener l)
          Request a call-back when a bound property changes.
 void dispose()
          Deactivate this object, so that it releases as many resources as possible and no longer effects others.
 String getComment()
          Get associated comment text.
 String getDisplayName()
           
 int getNumPropertyChangeListeners()
          Number of current listeners.
 int getState()
          Provide generic access to internal state.
 String getSystemName()
          Get a system-specific name.
 String getUserName()
           
 void removePropertyChangeListener(PropertyChangeListener l)
          Remove a request for a call-back when a bound property changes.
 void setComment(String comment)
          Set associated comment text.
 void setState(int s)
          Provide generic access to internal state.
 void setUserName(String s)
           
 

Field Detail

UNKNOWN

static final int UNKNOWN
Constant representing an "unknown" state, indicating that the object's state is not necessarily that of the actual layout hardware. This is the initial state of a newly created object before communication with the layout.

See Also:
Constant Field Values

INCONSISTENT

static final int INCONSISTENT
Constant representing an "inconsistent" state, indicating that some inconsistency has been detected in the hardware readback.

See Also:
Constant Field Values
Method Detail

getUserName

String getUserName()

setUserName

void setUserName(String s)

getSystemName

String getSystemName()
Get a system-specific name. This encodes the hardware addressing information.


getDisplayName

String getDisplayName()

addPropertyChangeListener

void addPropertyChangeListener(PropertyChangeListener l)
Request a call-back when a bound property changes. Bound properties are the known state, commanded state, user and system names.


removePropertyChangeListener

void removePropertyChangeListener(PropertyChangeListener l)
Remove a request for a call-back when a bound property changes.


getNumPropertyChangeListeners

int getNumPropertyChangeListeners()
Number of current listeners. May return -1 if the information is not available for some reason.


dispose

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.


setState

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 provided to make Jython script access easier to read.

Throws:
JmriException - general error when cant do the needed operation

getState

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 provided to make Jython script access easier to read.


getComment

String getComment()
Get associated comment text.


setComment

void setComment(String comment)
Set associated comment text.

Comments can be any valid text.

Parameters:
comment - Null means no comment associated.


Copyright © 1997 - 2009 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads