Package jmri
Class DccLocoAddress
- java.lang.Object
-
- jmri.DccLocoAddress
-
- All Implemented Interfaces:
LocoAddress
- Direct Known Subclasses:
OpenLcbLocoAddress
@Immutable public class DccLocoAddress extends java.lang.Object implements LocoAddress
Encapsulate information for a DCC Locomotive Decoder Address. In particular, this handles the "short" (standard) vs "extended" (long) address selection. An address must be one of these, hence short vs long is encoded as a boolean. Once created, the number and long/short status cannot be changed.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jmri.LocoAddress
LocoAddress.Protocol
-
-
Field Summary
Fields Modifier and Type Field Description protected longnumberprotected LocoAddress.Protocolprotocol
-
Constructor Summary
Constructors Constructor Description DccLocoAddress(int number, boolean isLong)DccLocoAddress(int number, LocoAddress.Protocol protocol)DccLocoAddress(DccLocoAddress l)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object a)intgetNumber()LocoAddress.ProtocolgetProtocol()inthashCode()booleanisLongAddress()java.lang.StringtoString()
-
-
-
Field Detail
-
number
protected final long number
-
protocol
protected final LocoAddress.Protocol protocol
-
-
Constructor Detail
-
DccLocoAddress
public DccLocoAddress(int number, boolean isLong)
-
DccLocoAddress
public DccLocoAddress(int number, LocoAddress.Protocol protocol)
-
DccLocoAddress
public DccLocoAddress(DccLocoAddress l)
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object a)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
isLongAddress
public boolean isLongAddress()
-
getProtocol
public LocoAddress.Protocol getProtocol()
- Specified by:
getProtocolin interfaceLocoAddress
-
getNumber
public int getNumber()
- Specified by:
getNumberin interfaceLocoAddress
-
-