Class Utils.DocComparator<T extends Doc>

  • Type Parameters:
    T - a Doc entity
    All Implemented Interfaces:
    java.util.Comparator<Doc>
    Enclosing class:
    Utils

    abstract static class Utils.DocComparator<T extends Doc>
    extends java.lang.Object
    implements java.util.Comparator<Doc>
    A general purpose comparator to sort Doc entities, basically provides the building blocks for creating specific comparators for an use-case.
    • Constructor Summary

      Constructors 
      Constructor Description
      DocComparator()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected int compareDocKinds​(Doc d1, Doc d2)
      Compares two Doc entities' kinds, and these are ordered as defined in the DocKind enumeration.
      protected int compareFullyQualifiedNames​(Doc d1, Doc d2)
      Compares the fully qualified names of the entities
      protected int compareNames​(Doc d1, Doc d2)
      Compares two Doc entities typically the simple name of a method, field, constructor etc.
      protected int compareParameters​(boolean caseSensitive, Parameter[] params1, Parameter[] params2)
      Compares arrays of parameters as a string representation of their types.
      (package private) Utils.DocComparator.DocKind getDocKind​(Doc d)  
      protected java.lang.String getParametersAsString​(Parameter[] params)  
      (package private) boolean hasParameters​(Doc d)  
      • Methods inherited from class java.lang.Object

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

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

      • DocComparator

        DocComparator()
    • Method Detail

      • hasParameters

        boolean hasParameters​(Doc d)
      • compareDocKinds

        protected int compareDocKinds​(Doc d1,
                                      Doc d2)
        Compares two Doc entities' kinds, and these are ordered as defined in the DocKind enumeration.
        Parameters:
        d1 - the first Doc object
        d2 - the second Doc object
        Returns:
        a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
      • compareParameters

        protected int compareParameters​(boolean caseSensitive,
                                        Parameter[] params1,
                                        Parameter[] params2)
        Compares arrays of parameters as a string representation of their types.
        Parameters:
        ignoreCase - specifies case sensitive or insensitive comparison.
        params1 - the first parameter array.
        params2 - the first parameter array.
        Returns:
        a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
      • getParametersAsString

        protected java.lang.String getParametersAsString​(Parameter[] params)
      • compareNames

        protected int compareNames​(Doc d1,
                                   Doc d2)
        Compares two Doc entities typically the simple name of a method, field, constructor etc.
        Parameters:
        d1 - the first Doc.
        d2 - the second Doc.
        Returns:
        a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
      • compareFullyQualifiedNames

        protected int compareFullyQualifiedNames​(Doc d1,
                                                 Doc d2)
        Compares the fully qualified names of the entities
        Parameters:
        d1 - the first entity
        d2 - the second entity
        Returns:
        a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.