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 classNceConsist.NceReadConsist
-
Field Summary
Fields Modifier and Type Field Description static intCONSIST_MAXstatic intCONSIST_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 voidadd(DccLocoAddress locoAddress, boolean directionNormal)Add a Locomotive to a ConsistvoidcheckConsist()voiddispose()A method for cleaning up the consistDccLocoAddressgetLocoAddressByPosition(int position)booleanisValid()Used to determine if consist has been initialized properly.(package private) voidkillConsist(int address, boolean isLong)Kills consist using lead loco addressvoidmessage(NceMessage m)voidremove(DccLocoAddress locoAddress)Remove a locomotive from this consistvoidreply(NceReply r)voidrestore(DccLocoAddress locoAddress, boolean directionNormal, int position)voidsetConsistType(int consist_type)Set the Consist Type.intsizeLimit()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:ConsistA method for cleaning up the consist- Specified by:
disposein interfaceConsist- Overrides:
disposein classDccConsist
-
setConsistType
public void setConsistType(int consist_type)
Description copied from interface:ConsistSet the Consist Type.- Specified by:
setConsistTypein interfaceConsist- Overrides:
setConsistTypein classDccConsist- Parameters:
consist_type- the consist type
-
sizeLimit
public int sizeLimit()
Description copied from class:DccConsistIs there a size limit for this consist? For Decoder Assisted Consists, returns -1 (no limit) return 0 for any other consist type.- Specified by:
sizeLimitin interfaceConsist- Overrides:
sizeLimitin 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:
addin interfaceConsist- Overrides:
addin 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:
removein interfaceConsist- Overrides:
removein 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:
messagein interfaceNceListener
-
reply
public void reply(NceReply r)
- Specified by:
replyin interfaceNceListener
-
-