001package jmri.jmrix.openlcb;
002
003import jmri.DccLocoAddress;
004import org.openlcb.NodeID;
005
006/**
007 * Encapsulate information for an OpenLCB Locomotive Decoder Address.
008 *
009 * The address information is an OpenLCB node ID.
010 *
011 * This should not be a child of DccLocoAddress, but rather of LocoAddress. But
012 * the code isn't up to that right now.
013 *
014 * @author Bob Jacobsen Copyright (C) 2012
015 */
016public class OpenLcbLocoAddress extends DccLocoAddress {
017
018    public OpenLcbLocoAddress(NodeID node) {
019        super(0, false); // crap, just crap
020        this.node = node;
021    }
022
023    @Override
024    public boolean equals(Object a) {
025        if (!(a instanceof OpenLcbLocoAddress)) {
026            return false;
027        }
028        try {
029            OpenLcbLocoAddress other = (OpenLcbLocoAddress) a;
030            return node.equals(other.node);
031        } catch (Exception e) {
032            return false;
033        }
034    }
035
036    @Override
037    public int hashCode() {
038        return node.hashCode();
039    }
040
041    public NodeID getNode() {
042        return node;
043    }
044
045    final NodeID node;
046
047}