VaultEvent.java 661 B

123456789101112131415161718192021
  1. package org.cryptomator.event;
  2. import org.cryptomator.common.vaults.Vault;
  3. import org.cryptomator.cryptofs.event.FilesystemEvent;
  4. public record VaultEvent(Vault v, FilesystemEvent actualEvent, int count) implements Comparable<VaultEvent> {
  5. @Override
  6. public int compareTo(VaultEvent other) {
  7. var timeResult = actualEvent.getTimestamp().compareTo(other.actualEvent().getTimestamp());
  8. if (timeResult != 0) {
  9. return timeResult;
  10. }
  11. var vaultIdResult = v.getId().compareTo(other.v.getId());
  12. if (vaultIdResult != 0) {
  13. return vaultIdResult;
  14. }
  15. return this.actualEvent.getClass().getName().compareTo(other.actualEvent.getClass().getName());
  16. }
  17. }