Package jmri.jmrix.easydcc
Class EasyDccConsist
- java.lang.Object
-
- jmri.implementation.DccConsist
-
- jmri.jmrix.easydcc.EasyDccConsist
-
- All Implemented Interfaces:
java.util.EventListener,Consist,ProgListener
public class EasyDccConsist extends DccConsist
This is the Consist definition for a consist on an EasyDCC system. it uses the EasyDcc specific commands to build a consist.
-
-
Field Summary
-
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 EasyDccConsist(int address, EasyDccSystemConnectionMemo memo)EasyDccConsist(DccLocoAddress address, EasyDccSystemConnectionMemo memo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(DccLocoAddress locoAddress, boolean directionNormal)Add a Locomotive to a Consist.protected voidaddToAdvancedConsist(DccLocoAddress locoAddress, boolean directionNormal)Add a Locomotive to an Advanced Consist.booleancontains(DccLocoAddress address)Does the consist contain the specified address?booleangetLocoDirection(DccLocoAddress address)Get the relative direction setting for a specific locomotive in the consist.booleanisAddressAllowed(DccLocoAddress address)Is this address allowed?voidremove(DccLocoAddress locoAddress)Remove a Locomotive from this Consist.protected voidremoveFromAdvancedConsist(DccLocoAddress locoAddress)Remove a Locomotive from an Advanced ConsistvoidremoveFromCSConsist(DccLocoAddress LocoAddress)Remove a Locomotive from an EasyDCC Standard Consist.voidrestore(DccLocoAddress locoAddress, boolean directionNormal)Restore a Locomotive to an Advanced Consist, but don't write to the command station.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, dispose, getConsistAddress, getConsistID, getConsistList, getConsistType, getPosition, getRosterId, loadDecoderFile, loadDecoderFromLoco, notifyConsistListeners, programmingOpReply, removeConsistListener, resetRosterEntryCVValue, restore, reverse, setConsistID, setPosition, setRosterEntryCVValue, setRosterId, updateRosterCV
-
-
-
-
Constructor Detail
-
EasyDccConsist
public EasyDccConsist(int address, EasyDccSystemConnectionMemo memo)
-
EasyDccConsist
public EasyDccConsist(DccLocoAddress address, EasyDccSystemConnectionMemo memo)
-
-
Method Detail
-
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
-
isAddressAllowed
public boolean isAddressAllowed(DccLocoAddress address)
Is this address allowed? On EasyDCC systems, all addresses but 0 can be used in a consist (either an Advanced Consist or a Standard Consist). Is this address allowed? Since address 00 is an analog locomotive, we can't program CV19 to include it in a consist, but all other addresses are ok.- Specified by:
isAddressAllowedin interfaceConsist- Overrides:
isAddressAllowedin classDccConsist- Parameters:
address- the address- Returns:
- true if allowed; false otherwise
-
sizeLimit
public int sizeLimit()
Is there a size limit for this consist?- Specified by:
sizeLimitin interfaceConsist- Overrides:
sizeLimitin classDccConsist- Returns:
- 8 for EasyDcc Standard Consist, -1 for Decoder Assisted Consists (no limit), 0 for any other consist type -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).
-
contains
public boolean contains(DccLocoAddress address)
Does the consist contain the specified address? Does the consist contain the specified locomotive address?- Specified by:
containsin interfaceConsist- Overrides:
containsin classDccConsist- Parameters:
address- the address to check- Returns:
- true if in consist; false otherwise
-
getLocoDirection
public boolean getLocoDirection(DccLocoAddress address)
Get the relative direction setting for a specific locomotive in the consist. Get the relative direction setting for a specific locomotive in the consist.- Specified by:
getLocoDirectionin interfaceConsist- Overrides:
getLocoDirectionin classDccConsist- Parameters:
address- the address to check- Returns:
- true if locomotive is in consist in its normal direction of travel; false otherwise
-
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 locomotivedirectionNormal- is True if the locomotive is traveling the same direction as the consist, or false otherwise.
-
restore
public void restore(DccLocoAddress locoAddress, boolean directionNormal)
Restore a Locomotive to an Advanced 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.- Specified by:
restorein interfaceConsist- Overrides:
restorein classDccConsist- Parameters:
locoAddress- 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.
-
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 add to the locomotive
-
addToAdvancedConsist
protected void addToAdvancedConsist(DccLocoAddress locoAddress, boolean directionNormal)
Add a Locomotive to an Advanced Consist.- Overrides:
addToAdvancedConsistin classDccConsist- Parameters:
locoAddress- 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.
-
removeFromAdvancedConsist
protected void removeFromAdvancedConsist(DccLocoAddress locoAddress)
Remove a Locomotive from an Advanced Consist- Overrides:
removeFromAdvancedConsistin classDccConsist- Parameters:
locoAddress- is the Locomotive address to add to the locomotive
-
removeFromCSConsist
public void removeFromCSConsist(DccLocoAddress LocoAddress)
Remove a Locomotive from an EasyDCC Standard Consist.- Parameters:
LocoAddress- is the Locomotive address to add to the locomotive
-
-