Package jmri
Interface Consist
- All Known Implementing Classes:
DccConsist,EasyDccConsist,LocoNetConsist,MqttConsist,NceConsist,NmraConsist,TmccConsist,WiFiConsist,XNetConsist
public interface Consist
Interface for a Consist Object, describing one or more
cooperatively-operating locomotives.
This file is part of JMRI.
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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final int -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(DccLocoAddress address, boolean directionNormal) Add a Locomotive to a ConsistvoidaddConsistListener(ConsistListener listener) Add a listener for consist eventsbooleancontains(DccLocoAddress address) Does the consist contain the specified locomotive address?voiddispose()A method for cleaning up the consistGet the Consist AddressGet the text ID associated with the consistGet a list of the locomotives in the consist.intGet the Consist Type.booleangetLocoDirection(DccLocoAddress address) Get the relative direction setting for a specific locomotive in the consist.intgetPosition(DccLocoAddress address) Get the position of a locomotive within the consistgetRosterId(DccLocoAddress address) Get the rosterId of a locomotive within the consistbooleanisAddressAllowed(DccLocoAddress address) Is the specific address allowed?voidremove(DccLocoAddress address) Remove a Locomotive from this ConsistvoidremoveConsistListener(ConsistListener listener) Remove a listener for consist eventsvoidrestore()Restore the consist to the command station.voidrestore(DccLocoAddress address, boolean directionNormal) Restore a Locomotive to a Consist, but don't write to the command station.voidreverse()Reverse the order of the consist and the direction the locomotives are travelingvoidsetConsistID(String id) Set the text ID associated with the consistvoidsetConsistType(int consistType) Set the Consist Type.voidsetPosition(DccLocoAddress address, int position) Set the position of a locomotive within the consistvoidsetRosterId(DccLocoAddress address, String rosterId) Set the roster entry of a locomotive within the consistintIs there a size limit for this type of consist?
-
Field Details
-
ADVANCED_CONSIST
- See Also:
-
CS_CONSIST
- See Also:
-
POSITION_LEAD
- See Also:
-
POSITION_TRAIL
- See Also:
-
-
Method Details
-
dispose
void dispose()A method for cleaning up the consist -
setConsistType
Set the Consist Type.- Parameters:
consistType- the consist type
-
getConsistType
int getConsistType()Get the Consist Type.- Returns:
- the consist type
-
getConsistAddress
Get the Consist Address- Returns:
- the consist address
-
isAddressAllowed
Is the specific address allowed? (needed for system specific restrictions)- Parameters:
address- the address- Returns:
- true if allowed; false otherwise
-
sizeLimit
int sizeLimit()Is there a size limit for this type of consist?- Returns:
- -1 if no limit; 0 if the Consist Type is not supported; or the total number of usable spaces if the consist has a limit (do not subtract used spaces).
-
getConsistList
Get a list of the locomotives in the consist.- Returns:
- the list of addresses
-
contains
Does the consist contain the specified locomotive address?- Parameters:
address- the address to check- Returns:
- true if in consist; false otherwise
-
getLocoDirection
Get the relative direction setting for a specific locomotive in the consist.- Parameters:
address- the address to check- Returns:
- true if locomotive is in consist in its normal direction of travel; false otherwise
-
add
Add a Locomotive to a Consist- Parameters:
address- is the Locomotive address to add to the locomotivedirectionNormal- is True if the locomotive is traveling the same direction as the consist, or false otherwise.
-
restore
Restore a Locomotive to a Consist, but don't write to the command station. This is used for restoring the consist from a file or adding a consist read from the command station.- Parameters:
address- is the Locomotive address to add to the consistdirectionNormal- is True if the locomotive is traveling the same direction as the consist, or false otherwise.
-
remove
Remove a Locomotive from this Consist- Parameters:
address- is the Locomotive address to add to the locomotive
-
setPosition
Set the position of a locomotive within the consist- Parameters:
address- is the Locomotive addressposition- is a constant representing the position within the consist.
-
getPosition
Get the position of a locomotive within the consist- Parameters:
address- is the Locomotive address of interest- Returns:
- integer equal to jmri.Consist.POSITION_LEAD for the designated lead locomotive. equal to jmri.Consist.POSITION_TRAIL for the designated trailing locomotive. between 1 and 254 for other locomotives in the consist
-
setRosterId
Set the roster entry of a locomotive within the consist- Parameters:
address- is the Locomotive addressrosterId- is the roster Identifier of the associated roster entry.
-
getRosterId
Get the rosterId of a locomotive within the consist- Parameters:
address- is the Locomotive address of interest- Returns:
- string roster Identifier associated with the given address in the consist. Returns null if no roster entry is associated with this entry.
-
addConsistListener
Add a listener for consist events- Parameters:
listener- is a consistListener object
-
removeConsistListener
Remove a listener for consist events- Parameters:
listener- is a consistListener object
-
setConsistID
Set the text ID associated with the consist- Parameters:
id- is a string identifier for the consist
-
getConsistID
Get the text ID associated with the consist- Returns:
- String identifier for the consist default value is the string Identifier for the consist address.
-
reverse
void reverse()Reverse the order of the consist and the direction the locomotives are traveling -
restore
void restore()Restore the consist to the command station.
-