@Test() public void testSerialNumHashcode() { UUID id = UUID.randomUUID(); short rev = 53; SerialNum sn1 = new SerialNum(id, rev); SerialNum sn2 = new SerialNum(id, rev); assertThat(sn1.hashCode(), is(equalTo(sn2.hashCode()))); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + mode; result = prime * result + rev; result = prime * result + version; return result; }
SerialNum { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + mode; result = prime * result + rev; result = prime * result + version; return result; } }
SerialNum { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + mode; result = prime * result + rev; result = prime * result + version; return result; } SerialNum(UUID id, short rev, byte version, short mode);  SerialNum(UUID id, short rev);  SerialNum(UUID id, int rev);  SerialNum(UUID id, int rev, int version, int mode); }
SerialNum { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + mode; result = prime * result + rev; result = prime * result + version; return result; } SerialNum(UUID id, short rev, byte version, short mode);  SerialNum(UUID id, short rev);  SerialNum(UUID id, int rev);  SerialNum(UUID id, int rev, int version, int mode); UUID getId(); short getRev(); byte getVersion(); boolean isVersion1(); boolean isVersion2(); short getMode(); boolean isAgent(); boolean isTemplate(); SerialNum revision(); byte[] toBytes(); BigInteger toBigInt(); String toString(); @Override int hashCode(); @Override boolean equals(Object obj); static SerialNum fromBytes(byte[] array); static SerialNum fromString(String serialNumHex); static SerialNum fromBigInt(BigInteger bigInt); static SerialNum randomSerialNum(); static SerialNum fromName(String name); static SerialNum randomSerialNum(short mode); static SerialNum fromName(String name, short mode); static SerialNum version2(UUID id, short rev, short mode); static SerialNum version2(UUID id, int rev, int mode); static SerialNum version2(UUID id, short rev); static SerialNum version2(UUID id, int rev); static SerialNum version1(UUID id, short rev); static SerialNum version1(UUID id, int rev); }
SerialNum { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + mode; result = prime * result + rev; result = prime * result + version; return result; } SerialNum(UUID id, short rev, byte version, short mode);  SerialNum(UUID id, short rev);  SerialNum(UUID id, int rev);  SerialNum(UUID id, int rev, int version, int mode); UUID getId(); short getRev(); byte getVersion(); boolean isVersion1(); boolean isVersion2(); short getMode(); boolean isAgent(); boolean isTemplate(); SerialNum revision(); byte[] toBytes(); BigInteger toBigInt(); String toString(); @Override int hashCode(); @Override boolean equals(Object obj); static SerialNum fromBytes(byte[] array); static SerialNum fromString(String serialNumHex); static SerialNum fromBigInt(BigInteger bigInt); static SerialNum randomSerialNum(); static SerialNum fromName(String name); static SerialNum randomSerialNum(short mode); static SerialNum fromName(String name, short mode); static SerialNum version2(UUID id, short rev, short mode); static SerialNum version2(UUID id, int rev, int mode); static SerialNum version2(UUID id, short rev); static SerialNum version2(UUID id, int rev); static SerialNum version1(UUID id, short rev); static SerialNum version1(UUID id, int rev); static final byte VERSION_1; static final byte VERSION_2; static final short MODE_NONE; static final short MODE_AGENT; static final short MODE_TEMPLATE; }