@Override public int compare(IgniteUuid u1, IgniteUuid u2) { if (u1 == u2) return 0; if (u1 == null) return -1; return u1.compareTo(u2); } };
/** {@inheritDoc} */ @Override public int compareTo(@NotNull IgfsBlockKey o) { int res = fileId.compareTo(o.fileId); if (res != 0) return res; long v1 = blockId; long v2 = o.blockId; if (v1 != v2) return v1 > v2 ? 1 : -1; if (affKey == null && o.affKey == null) return 0; if (affKey != null && o.affKey != null) return affKey.compareTo(o.affKey); return affKey != null ? -1 : 1; }
/** {@inheritDoc} */ @Override public int compareTo(Event o) { return o == null ? 1 : id.compareTo(o.id()); }
/** * Checks whether pending messages queue contains unprocessed {@link TcpDiscoveryNodeAddedMessage} for * the node with {@code nodeId}. * * @param nodeId Node ID. * @return {@code true} if contains, {@code false} otherwise. */ private boolean hasPendingAddMessage(UUID nodeId) { if (pendingMsgs.msgs.isEmpty()) return false; for (PendingMessage pendingMsg : pendingMsgs.msgs) { if (pendingMsg.msg instanceof TcpDiscoveryNodeAddedMessage) { TcpDiscoveryNodeAddedMessage addMsg = (TcpDiscoveryNodeAddedMessage)pendingMsg.msg; if (addMsg.node().id().equals(nodeId) && addMsg.id().compareTo(pendingMsgs.discardId) > 0) return true; } } return false; }
/** {@inheritDoc} */ @Override public int compare(GridTimeoutObject o1, GridTimeoutObject o2) { int res = Long.compare(o1.endTime(), o2.endTime()); if (res != 0) return res; return o1.timeoutId().compareTo(o2.timeoutId()); } });
/** * JUnit. */ @Test public void testGridUuid() { IgniteUuid id1 = IgniteUuid.randomUuid(); IgniteUuid id2 = IgniteUuid.randomUuid(); assert id1.compareTo(id2) == -1; assert id2.compareTo(id1) == 1; assert id1.compareTo(id1) == 0; assert id2.compareTo(id2) == 0; assert id1.hashCode() != id2.hashCode(); assert !id1.equals(id2); assert id1.iterator().hasNext(); assert id1.iterator().next().equals(id1); assert id2.iterator().hasNext(); assert id2.iterator().next().equals(id2); }
@Override public int compare(IgniteUuid u1, IgniteUuid u2) { if (u1 == u2) return 0; if (u1 == null) return -1; return u1.compareTo(u2); } };
/** {@inheritDoc} */ @Override public int compareTo(@NotNull IgfsBlockKey o) { int res = fileId.compareTo(o.fileId); if (res != 0) return res; long v1 = blockId; long v2 = o.blockId; if (v1 != v2) return v1 > v2 ? 1 : -1; if (affKey == null && o.affKey == null) return 0; if (affKey != null && o.affKey != null) return affKey.compareTo(o.affKey); return affKey != null ? -1 : 1; }
/** {@inheritDoc} */ @Override public int compareTo(Event o) { return o == null ? 1 : id.compareTo(o.id()); }
/** * Checks whether pending messages queue contains unprocessed {@link TcpDiscoveryNodeAddedMessage} for * the node with {@code nodeId}. * * @param nodeId Node ID. * @return {@code true} if contains, {@code false} otherwise. */ private boolean hasPendingAddMessage(UUID nodeId) { if (pendingMsgs.msgs.isEmpty()) return false; for (PendingMessage pendingMsg : pendingMsgs.msgs) { if (pendingMsg.msg instanceof TcpDiscoveryNodeAddedMessage) { TcpDiscoveryNodeAddedMessage addMsg = (TcpDiscoveryNodeAddedMessage)pendingMsg.msg; if (addMsg.node().id().equals(nodeId) && addMsg.id().compareTo(pendingMsgs.discardId) > 0) return true; } } return false; }
/** {@inheritDoc} */ @Override public int compare(GridTimeoutObject o1, GridTimeoutObject o2) { int res = Long.compare(o1.endTime(), o2.endTime()); if (res != 0) return res; return o1.timeoutId().compareTo(o2.timeoutId()); } });