@Test @DisplayName("Packets can be compared") void compareTo() { assume(); for (var i = 0; i < virtuals.length; i++) { val virtual = virtuals[i]; val size = sizes[i]; for (var j = 0; j < size - (Long.BYTES - 1); j++) { val packet = new PacketBufferWrapper(virtual + j); assertThat(packet.compareTo(packet)).isEqualTo(0); val next = new PacketBufferWrapper(virtual + j + 1); assertThat(packet.compareTo(next)).isEqualTo(-1); assertThat(next.compareTo(packet)).isEqualTo(1); } } }
@Override @Contract(pure = true) public int compareTo(final @NotNull PacketBufferWrapper o) { if (DEBUG >= LOG_TRACE) log.trace("Comparing with another packet buffer wrapper."); return Long.compare(virtualAddress, o.virtualAddress); }
PacketBufferWrapper implements Comparable<PacketBufferWrapper> { @Override @Contract(pure = true) public int compareTo(final @NotNull PacketBufferWrapper o) { if (DEBUG >= LOG_TRACE) log.trace("Comparing with another packet buffer wrapper."); return Long.compare(virtualAddress, o.virtualAddress); } }
PacketBufferWrapper implements Comparable<PacketBufferWrapper> { @Override @Contract(pure = true) public int compareTo(final @NotNull PacketBufferWrapper o) { if (DEBUG >= LOG_TRACE) log.trace("Comparing with another packet buffer wrapper."); return Long.compare(virtualAddress, o.virtualAddress); }  }
PacketBufferWrapper implements Comparable<PacketBufferWrapper> { @Override @Contract(pure = true) public int compareTo(final @NotNull PacketBufferWrapper o) { if (DEBUG >= LOG_TRACE) log.trace("Comparing with another packet buffer wrapper."); return Long.compare(virtualAddress, o.virtualAddress); }  @Contract(pure = true) long getPhysicalAddress(); @Contract(pure = true) int getSize(); void setSize(final int size); byte getByte(final int offset); void putByte(final int offset, final byte value); short getShort(final int offset); void putShort(final int offset, final short value); int getInt(final int offset); void putInt(final int offset, final int value); long getLong(final int offset); void putLong(final int offset, final long value); void get(final int offset, int bytes, final @NotNull byte[] buffer); void put(final int offset, int bytes, final @NotNull byte[] buffer); @Override @Contract(pure = true) int compareTo(final @NotNull PacketBufferWrapper o); @Override @Contract(pure = true) @NotNull String toString(); }
PacketBufferWrapper implements Comparable<PacketBufferWrapper> { @Override @Contract(pure = true) public int compareTo(final @NotNull PacketBufferWrapper o) { if (DEBUG >= LOG_TRACE) log.trace("Comparing with another packet buffer wrapper."); return Long.compare(virtualAddress, o.virtualAddress); }  @Contract(pure = true) long getPhysicalAddress(); @Contract(pure = true) int getSize(); void setSize(final int size); byte getByte(final int offset); void putByte(final int offset, final byte value); short getShort(final int offset); void putShort(final int offset, final short value); int getInt(final int offset); void putInt(final int offset, final int value); long getLong(final int offset); void putLong(final int offset, final long value); void get(final int offset, int bytes, final @NotNull byte[] buffer); void put(final int offset, int bytes, final @NotNull byte[] buffer); @Override @Contract(pure = true) int compareTo(final @NotNull PacketBufferWrapper o); @Override @Contract(pure = true) @NotNull String toString();  }