2 * (c) 2015 Cable Television Laboratories, Inc. All rights reserved.
5 package org.pcmm.gates.impl;
7 import org.pcmm.base.impl.PCMMBaseObject;
8 import org.pcmm.gates.IGateID;
9 import org.umu.cops.stack.COPSMsgParser;
12 * Implementation of the IGateID interface
14 public class GateID extends PCMMBaseObject implements IGateID {
23 * @param gateId - the ID value
25 public GateID(final int gateId) {
26 super(SNum.GATE_ID, STYPE);
31 public int getGateID() {
36 protected byte[] getBytes() {
37 return COPSMsgParser.intToBytes(gateId);
41 public boolean equals(final Object o) {
45 if (!(o instanceof GateID)) {
48 if (!super.equals(o)) {
51 final GateID gateID = (GateID) o;
52 return gateId == gateID.gateId;
56 public int hashCode() {
57 int result = super.hashCode();
58 result = 31 * result + gateId;
63 * Returns a GateID object from a byte array
64 * @param data - the data to parse
65 * @return - the object
66 * TODO - make me more robust as RuntimeExceptions can be thrown here.
68 public static GateID parse(final byte[] data) {
69 return new GateID(COPSMsgParser.bytesToInt(data[0], data[1], data[2], data[3]));