jmri.implementation
Class AbstractAudio

java.lang.Object
  extended by jmri.implementation.AbstractNamedBean
      extended by jmri.implementation.AbstractAudio
All Implemented Interfaces:
Serializable, Audio, NamedBean
Direct Known Subclasses:
AbstractAudioBuffer, AbstractAudioListener, AbstractAudioSource

public abstract class AbstractAudio
extends AbstractNamedBean
implements Audio

Base implementation of the Audio class.

Specific implementations will extend this base class.

Audio bean system names are always upper case.


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:
Matthew Harris copyright (c) 2009
See Also:
Serialized Form

Field Summary
 
Fields inherited from class jmri.implementation.AbstractNamedBean
mSystemName, mUserName
 
Fields inherited from interface jmri.Audio
AT, BUFFER, CMD_BIND_BUFFER, CMD_FADE_IN, CMD_FADE_OUT, CMD_INIT_FACTORY, CMD_LOAD_SOUND, CMD_PAUSE, CMD_PAUSE_TOGGLE, CMD_PLAY, CMD_PLAY_TOGGLE, CMD_RESET_POSITION, CMD_RESUME, CMD_REWIND, CMD_STOP, DECIMAL_PLACES, FADE_IN, FADE_NONE, FADE_OUT, LISTENER, MAX_DISTANCE, SOURCE, STATE_EMPTY, STATE_INITIAL, STATE_LOADED, STATE_MOVING, STATE_PLAYING, STATE_POSITIONED, STATE_STOPPED, UP
 
Fields inherited from interface jmri.NamedBean
INCONSISTENT, UNKNOWN
 
Constructor Summary
AbstractAudio(String systemName)
          Abstract constructor for new Audio with system name
AbstractAudio(String systemName, String userName)
          Abstract constructor for new Audio with system name and user name
 
Method Summary
protected abstract  void cleanUp()
          Abstract method that concrete classes will implement to perform necessary cleanup routines.
 int getState()
          Provide generic access to internal state.
static float roundDecimal(float value)
          Static method to round a float value to the number of decimal places defined by DECIMAL_PLACES.
static float roundDecimal(float value, double places)
          Static method to round a float value to the specified number of decimal places
 void setState(int newState)
          Provide generic access to internal state.
 String toString()
           
 
Methods inherited from class jmri.implementation.AbstractNamedBean
addPropertyChangeListener, addPropertyChangeListener, dispose, firePropertyChange, getComment, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyKeys, getSystemName, getUserName, removePropertyChangeListener, setComment, setProperty, setUserName, updateListenerRef
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jmri.Audio
getSubType, stateChanged
 
Methods inherited from interface jmri.NamedBean
addPropertyChangeListener, addPropertyChangeListener, dispose, getComment, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getPropertyKeys, getSystemName, getUserName, removePropertyChangeListener, setComment, setProperty, setUserName, updateListenerRef
 

Constructor Detail

AbstractAudio

public AbstractAudio(String systemName)
Abstract constructor for new Audio with system name

Parameters:
systemName - Audio object system name (e.g. IAS1, IAB4)

AbstractAudio

public AbstractAudio(String systemName,
                     String userName)
Abstract constructor for new Audio with system name and user name

Parameters:
systemName - Audio object system name (e.g. IAS1, IAB4)
userName - Audio object user name
Method Detail

getState

public int getState()
Description copied from interface: NamedBean
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.

Specified by:
getState in interface NamedBean

setState

public void setState(int newState)
Description copied from interface: NamedBean
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.

Specified by:
setState in interface NamedBean

toString

public String toString()
Overrides:
toString in class Object

cleanUp

protected abstract void cleanUp()
Abstract method that concrete classes will implement to perform necessary cleanup routines.


roundDecimal

public static float roundDecimal(float value,
                                 double places)
Static method to round a float value to the specified number of decimal places

Parameters:
value - float value to round
places - number of decimal places to round to
Returns:
float value rounded to specified number of decimal places

roundDecimal

public static float roundDecimal(float value)
Static method to round a float value to the number of decimal places defined by DECIMAL_PLACES.

Parameters:
value - float value to round
Returns:
float value rounded to DECIMAL_PLACES decimal places


Copyright © 1997 - 2011 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