Package jmri.jmrix.nce
Class NceConsist
- java.lang.Object
-
- jmri.implementation.DccConsist
-
- jmri.jmrix.nce.NceConsist
-
- All Implemented Interfaces:
java.util.EventListener
,Consist
,AbstractMRListener
,NceListener
,ProgListener
public class NceConsist extends DccConsist implements NceListener
The Consist definition for a consist on an NCE system. It uses the NCE specific commands to build a consist.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
NceConsist.NceReadConsist
-
Field Summary
Fields Modifier and Type Field Description static int
CONSIST_MAX
static int
CONSIST_MIN
-
Fields inherited from class jmri.implementation.DccConsist
consistAddress, consistDir, consistID, consistList, consistPosition, consistRoster, consistType
-
Fields inherited from interface jmri.Consist
ADVANCED_CONSIST, CS_CONSIST, POSITION_LEAD, POSITION_TRAIL
-
Fields inherited from interface jmri.ProgListener
CommError, ConfirmFailed, FailedTimeout, NoAck, NoLocoDetected, NotImplemented, OK, ProgrammerBusy, ProgrammingShort, SequenceError, UnknownError, UserAborted
-
-
Constructor Summary
Constructors Constructor Description NceConsist(int address, NceSystemConnectionMemo m)
NceConsist(DccLocoAddress locoAddress, NceSystemConnectionMemo m)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(DccLocoAddress locoAddress, boolean directionNormal)
Add a Locomotive to a Consistvoid
checkConsist()
void
dispose()
A method for cleaning up the consistDccLocoAddress
getLocoAddressByPosition(int position)
boolean
isValid()
Used to determine if consist has been initialized properly.(package private) void
killConsist(int address, boolean isLong)
Kills consist using lead loco addressvoid
message(NceMessage m)
void
remove(DccLocoAddress locoAddress)
Remove a locomotive from this consistvoid
reply(NceReply r)
void
restore(DccLocoAddress locoAddress, boolean directionNormal, int position)
void
setConsistType(int consist_type)
Set the Consist Type.int
sizeLimit()
Is there a size limit for this consist?-
Methods inherited from class jmri.implementation.DccConsist
addConsistListener, addToAdvancedConsist, contains, getConsistAddress, getConsistID, getConsistList, getConsistType, getLocoDirection, getPosition, getRosterId, isAddressAllowed, loadDecoderFile, loadDecoderFromLoco, notifyConsistListeners, programmingOpReply, removeConsistListener, removeFromAdvancedConsist, resetRosterEntryCVValue, restore, restore, reverse, setConsistID, setPosition, setRosterEntryCVValue, setRosterId, updateRosterCV
-
-
-
-
Field Detail
-
CONSIST_MIN
public static final int CONSIST_MIN
- See Also:
- Constant Field Values
-
CONSIST_MAX
public static final int CONSIST_MAX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
NceConsist
public NceConsist(int address, NceSystemConnectionMemo m)
-
NceConsist
public NceConsist(DccLocoAddress locoAddress, NceSystemConnectionMemo m)
-
-
Method Detail
-
dispose
public void dispose()
Description copied from interface:Consist
A method for cleaning up the consist- Specified by:
dispose
in interfaceConsist
- Overrides:
dispose
in classDccConsist
-
setConsistType
public void setConsistType(int consist_type)
Description copied from interface:Consist
Set the Consist Type.- Specified by:
setConsistType
in interfaceConsist
- Overrides:
setConsistType
in classDccConsist
- Parameters:
consist_type
- the consist type
-
sizeLimit
public int sizeLimit()
Description copied from class:DccConsist
Is there a size limit for this consist? For Decoder Assisted Consists, returns -1 (no limit) return 0 for any other consist type.- Specified by:
sizeLimit
in interfaceConsist
- Overrides:
sizeLimit
in classDccConsist
- 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).
-
add
public void add(DccLocoAddress locoAddress, boolean directionNormal)
Add a Locomotive to a Consist- Specified by:
add
in interfaceConsist
- Overrides:
add
in classDccConsist
- Parameters:
locoAddress
- 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.
-
restore
public void restore(DccLocoAddress locoAddress, boolean directionNormal, int position)
-
remove
public void remove(DccLocoAddress locoAddress)
Remove a locomotive from this consist- Specified by:
remove
in interfaceConsist
- Overrides:
remove
in classDccConsist
- Parameters:
locoAddress
- is the locomotive address to remove from this consist
-
checkConsist
public void checkConsist()
-
getLocoAddressByPosition
public DccLocoAddress getLocoAddressByPosition(int position)
-
isValid
public boolean isValid()
Used to determine if consist has been initialized properly.- Returns:
- true if command station memory has been read for this consist number.
-
killConsist
void killConsist(int address, boolean isLong)
Kills consist using lead loco address- Parameters:
address
- loco addressisLong
- true if long address
-
message
public void message(NceMessage m)
- Specified by:
message
in interfaceNceListener
-
reply
public void reply(NceReply r)
- Specified by:
reply
in interfaceNceListener
-
-