Class ResourceComparator

  • All Implemented Interfaces:
    java.util.Comparator

    public class ResourceComparator
    extends java.lang.Object
    implements java.util.Comparator
    Sorts resources according to the order of their repositories
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Application app  
    • Constructor Summary

      Constructors 
      Constructor Description
      ResourceComparator​(Application app)
      Constructcs a ResourceComparator sorting according to the top-level repositories of the given application
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compare​(java.lang.Object obj1, java.lang.Object obj2)
      Compares two Repositories, Resources or RepositoryTrackers
      boolean equals​(java.lang.Object obj)
      Checks if the comparator is equal to the given comparator A ResourceComparator is equal to another ResourceComparator if the applications they belong to are equal
      Application getApplication()
      Return the application we're comparing resources for
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Comparator

        reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
    • Constructor Detail

      • ResourceComparator

        public ResourceComparator​(Application app)
        Constructcs a ResourceComparator sorting according to the top-level repositories of the given application
        Parameters:
        app - application that provides the top-level repositories
    • Method Detail

      • compare

        public int compare​(java.lang.Object obj1,
                           java.lang.Object obj2)
        Compares two Repositories, Resources or RepositoryTrackers
        Specified by:
        compare in interface java.util.Comparator
        Parameters:
        obj1 - Repository, Resource or RepositoryTrackers
        obj2 - Repository, Resource or RepositoryTrackers
        Returns:
        a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
        Throws:
        java.lang.ClassCastException - if the arguments' types prevent them from being compared by this Comparator.
      • equals

        public boolean equals​(java.lang.Object obj)
        Checks if the comparator is equal to the given comparator A ResourceComparator is equal to another ResourceComparator if the applications they belong to are equal
        Specified by:
        equals in interface java.util.Comparator
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - comparator
        Returns:
        true if the given comparator equals
      • getApplication

        public Application getApplication()
        Return the application we're comparing resources for
        Returns:
        the application instance