jmri
Interface ReporterManager

All Superinterfaces:
Manager
All Known Implementing Classes:
AbstractReporterManager, InternalReporterManager, JMRIClientReporterManager, LnReporterManager, ProxyReporterManager, RfidReporterManager, RpsReporterManager, SpecificReporterManager, SpecificReporterManager

public interface ReporterManager
extends Manager

Locate a Reporter object representing some specific device on the layout.

Reporter objects are obtained from a ReporterManager, which in turn is generally located from the InstanceManager. A typical call sequence might be:

 Reporter device = InstanceManager.reporterManagerInstance().newReporter(null,"23");

Each Reporter 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.

Much of the book-keeping is implemented in the AbstractReporterManager class, which can form the basis for a system-specific implementation.


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
See Also:
Reporter, InstanceManager

Field Summary
 
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
 
Method Summary
 boolean allowMultipleAdditions(String systemName)
          A method that determines if it is possible to add a range of turnouts in numerical order eg 10 to 30 will return true.
 Reporter getBySystemName(String systemName)
          Locate an instance based on a system name.
 Reporter getByUserName(String userName)
          Locate an instance based on a user name.
 String getNextValidAddress(String curAddress, String prefix)
          Determine if the address supplied is valid and free, if not then it shall return the next free valid address up to a maximum of 10 address away from the initial address.
 Reporter getReporter(String name)
          Locate via user name, then system name if needed.
 List<String> getSystemNameList()
          Get a list of all Reporter's system names.
 Reporter newReporter(String systemName, String userName)
          Return an instance with the specified system and user names.
 Reporter provideReporter(String name)
          Locate via user name, then system name if needed.
 
Methods inherited from interface jmri.Manager
addPropertyChangeListener, deregister, dispose, getBeanBySystemName, getSystemNameArray, getSystemPrefix, getXMLOrder, makeSystemName, register, removePropertyChangeListener, systemLetter, typeLetter
 

Method Detail

provideReporter

Reporter provideReporter(String name)
Locate via user name, then system name if needed. If that fails, create a new Reporter. If the name is a valid system name, it will be used for the new Reporter. Otherwise, the makeSystemName method will attempt to turn it into a valid system name.

Parameters:
name - User name, system name, or address which can be promoted to system name
Returns:
Never null
Throws:
IllegalArgumentException - if Reporter doesn't already exist and the manager cannot create the Reporter due to e.g. an illegal name or name that can't be parsed.

getReporter

Reporter getReporter(String name)
Locate via user name, then system name if needed. If that fails, return null

Parameters:
name -
Returns:
null if no match found

getBySystemName

Reporter getBySystemName(String systemName)
Locate an instance based on a system name. Returns null if no instance already exists.

Returns:
requested Reporter object or null if none exists

getByUserName

Reporter getByUserName(String userName)
Locate an instance based on a user name. Returns null if no instance already exists.

Returns:
requested Reporter object or null if none exists

newReporter

Reporter newReporter(String systemName,
                     String userName)
Return an instance with the specified system and user names. Note that two calls with the same arguments will get the same instance; there is only one Reporter object representing a given physical Reporter and therefore only one with a specific system or user name.

This will always return a valid object reference; a new object will be created if necessary. In that case:

Note that it is possible to make an inconsistent request if both addresses are provided, but the given values are associated with different objects. This is a problem, and we don't have a good solution except to issue warnings. This will mostly happen if you're creating Reporters when you should be looking them up.

Returns:
requested Reporter object (never null)
Throws:
IllegalArgumentException - if cannot create the Reporter due to e.g. an illegal name or name that can't be parsed.

getSystemNameList

List<String> getSystemNameList()
Get a list of all Reporter's system names.

Specified by:
getSystemNameList in interface Manager

allowMultipleAdditions

boolean allowMultipleAdditions(String systemName)
A method that determines if it is possible to add a range of turnouts in numerical order eg 10 to 30 will return true. where as if the address format is 1b23 this will return false.


getNextValidAddress

String getNextValidAddress(String curAddress,
                           String prefix)
Determine if the address supplied is valid and free, if not then it shall return the next free valid address up to a maximum of 10 address away from the initial address.

Parameters:
prefix - - The System Prefix used to make up the systemName
curAddress - - The hardware address of the turnout we which to check.


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