/** * {@inheritDoc} * * @see java.lang.Comparable#compareTo(java.lang.Object) */ @Override public int compareTo(final ArchivePath path) { // If a null argument, we're greater if (path == null) { return 1; } /* * Check for parent relationship */ final ArchivePath parentOfSpecified = PathUtil.getParent(path); final ArchivePath parentOfThis = PathUtil.getParent(this); // If we're the parent of the specified, we're less if (this.equals(parentOfSpecified)) { return -1; } // If the specified if the parent of us, we're more if (path.equals(parentOfThis)) { return 1; } // Just delegate to underlying contexts final int comparedContexts = path.get().compareTo(this.get()); // Return the inverted value of the contents (in this ordering, less is more) final int adjusted = 0 - comparedContexts; return adjusted; }
/** * {@inheritDoc} * * @see java.lang.Comparable#compareTo(java.lang.Object) */ @Override public int compareTo(final ArchivePath path) { // If a null argument, we're greater if (path == null) { return 1; } /* * Check for parent relationship */ final ArchivePath parentOfSpecified = PathUtil.getParent(path); final ArchivePath parentOfThis = PathUtil.getParent(this); // If we're the parent of the specified, we're less if (this.equals(parentOfSpecified)) { return -1; } // If the specified if the parent of us, we're more if (path.equals(parentOfThis)) { return 1; } // Just delegate to underlying contexts final int comparedContexts = path.get().compareTo(this.get()); // Return the inverted value of the contents (in this ordering, less is more) final int adjusted = 0 - comparedContexts; return adjusted; }