Class TypedIFComparator

java.lang.Object
net.ontopia.topicmaps.utils.TypedIFComparator
All Implemented Interfaces:
Comparator<TypedIF>

public class TypedIFComparator extends Object implements Comparator<TypedIF>
INTERNAL: Comparator that grabs the type of the comparable objects using TypedIF.getType() , and passes those two topics to it's subcomparator. Note that this comparator may only be used with objects that implement TypedIF.
  • Field Details

    • subcomparator

      protected Comparator<TopicIF> subcomparator
      INTERNAL: The comparator used to compare the types
  • Constructor Details

    • TypedIFComparator

      public TypedIFComparator(Comparator<TopicIF> subcomparator)
      INTERNAL: Creates a TypedIfComparator which uses the given comparator
      Parameters:
      subcomparator - the given comparator
  • Method Details

    • compare

      public int compare(TypedIF obj1, TypedIF obj2)
      INTERNAL: Compares the given typedIF objects using the comparator given to the constructor
      Specified by:
      compare in interface Comparator<TypedIF>
      Parameters:
      obj1 - an object; typecast to TypedIF by the grabber
      obj2 - an object; typecast to TypedIF by the grabber
      Returns:
      int; result from the comparator given to the constructor, when it compares the types of the given objects