jmri.managers
Class DefaultConditionalManager

java.lang.Object
  extended by jmri.managers.AbstractManager
      extended by jmri.managers.DefaultConditionalManager
All Implemented Interfaces:
PropertyChangeListener, EventListener, ConditionalManager, Manager

public class DefaultConditionalManager
extends AbstractManager
implements ConditionalManager, PropertyChangeListener

Basic Implementation of a ConditionalManager.

Note that Conditionals always have an associated parent Logix.

Logix system names must begin with IX, and be followed by a string, usually, but not always, a number. The system names of Conditionals always begin with the parent Logix's system name, then there is a capital C and a number.

Conditional system names are set automatically when the Conditional is created. All alphabetic characters in a Conditional system name must be upper case. This is enforced when a new Conditional is created via LogixTableAction.java.

Author:
Dave Duchamp Copyright (C) 2007, Pete Cresman Copyright (C) 2009

Field Summary
 
Fields inherited from class jmri.managers.AbstractManager
_tsys, _tuser
 
Fields inherited from interface jmri.Manager
AUDIO, BLOCKBOSS, BLOCKS, CONDITIONALS, IDTAGS, LAYOUTBLOCKS, LIGHTS, LOGIXS, MEMORIES, OBLOCKS, PANELFILES, REPORTERS, ROUTES, SECTIONS, SENSORGROUPS, SENSORS, SIGNALGROUPS, SIGNALHEADS, SIGNALMASTLOGICS, SIGNALMASTS, TIMEBASE, TRANSITS, TURNOUTS, WARRANTS
 
Constructor Summary
DefaultConditionalManager()
           
 
Method Summary
 Conditional createNewConditional(String systemName, String userName)
          Method to create a new Conditional if the Conditional does not exist If the parent Logix cannot be found, the userName cannot be checked, but the Conditional is still created.
 void deleteConditional(Conditional c)
          Remove an existing Conditional.
 Conditional getBySystemName(String name)
           
 Conditional getByUserName(Logix x, String key)
           
 Conditional getByUserName(String key)
           
 Conditional getConditional(Logix x, String name)
          Method to get an existing Conditional.
 Conditional getConditional(String name)
           
 Logix getParentLogix(String name)
          Parses the Conditional system name to get the parent Logix system name, then gets the parent Logix, and returns it.
 List<String> getSystemNameListForLogix(Logix x)
          Get a list of all Conditional system names with the specified Logix parent
 String getSystemPrefix()
          Provides access to the system prefix string.
 int getXMLOrder()
           
static DefaultConditionalManager instance()
           
 char typeLetter()
           
 
Methods inherited from class jmri.managers.AbstractManager
addPropertyChangeListener, deregister, dispose, firePropertyChange, getBeanBySystemName, getInstanceBySystemName, getInstanceByUserName, getSystemNameArray, getSystemNameList, makeSystemName, propertyChange, register, registerSelf, removePropertyChangeListener, systemLetter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jmri.ConditionalManager
dispose
 
Methods inherited from interface jmri.Manager
addPropertyChangeListener, deregister, getBeanBySystemName, getSystemNameArray, getSystemNameList, makeSystemName, register, removePropertyChangeListener, systemLetter
 
Methods inherited from interface java.beans.PropertyChangeListener
propertyChange
 

Constructor Detail

DefaultConditionalManager

public DefaultConditionalManager()
Method Detail

getXMLOrder

public int getXMLOrder()
Specified by:
getXMLOrder in interface Manager
Specified by:
getXMLOrder in class AbstractManager

getSystemPrefix

public String getSystemPrefix()
Description copied from interface: Manager
Provides access to the system prefix string. This was previously called the "System letter"

Specified by:
getSystemPrefix in interface Manager

typeLetter

public char typeLetter()
Specified by:
typeLetter in interface Manager
Returns:
The type letter for a specific implementation

createNewConditional

public Conditional createNewConditional(String systemName,
                                        String userName)
Method to create a new Conditional if the Conditional does not exist If the parent Logix cannot be found, the userName cannot be checked, but the Conditional is still created. The scenario can happen when a Logix is loaded from a file after its Conditionals.

Specified by:
createNewConditional in interface ConditionalManager
Returns:
null if a Conditional with the same systemName or userName already exists, or if there is trouble creating a new Conditional

getParentLogix

public Logix getParentLogix(String name)
Parses the Conditional system name to get the parent Logix system name, then gets the parent Logix, and returns it.

Specified by:
getParentLogix in interface ConditionalManager
Parameters:
name - - system name of Conditional (must be trimmed and upper case)

deleteConditional

public void deleteConditional(Conditional c)
Remove an existing Conditional. Parent Logix must have been deactivated before invoking this.

Specified by:
deleteConditional in interface ConditionalManager

getConditional

public Conditional getConditional(Logix x,
                                  String name)
Method to get an existing Conditional. First looks up assuming that name is a User Name. Note: the parent Logix must be passed in x for user name lookup. If this fails, or if x == null, looks up assuming that name is a System Name. If both fail, returns null.

Specified by:
getConditional in interface ConditionalManager
Parameters:
x - - parent Logix (may be null)
name - - name to look up
Returns:
null if no match found

getConditional

public Conditional getConditional(String name)
Specified by:
getConditional in interface ConditionalManager

getByUserName

public Conditional getByUserName(String key)
Specified by:
getByUserName in interface ConditionalManager

getByUserName

public Conditional getByUserName(Logix x,
                                 String key)
Specified by:
getByUserName in interface ConditionalManager

getBySystemName

public Conditional getBySystemName(String name)
Specified by:
getBySystemName in interface ConditionalManager

getSystemNameListForLogix

public List<String> getSystemNameListForLogix(Logix x)
Get a list of all Conditional system names with the specified Logix parent

Specified by:
getSystemNameListForLogix in interface ConditionalManager

instance

public static DefaultConditionalManager instance()


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