com.dlsc.flexgantt.model

## Class TimeSpanComparator

- java.lang.Object
- - com.dlsc.flexgantt.model.TimeSpanComparator

- All Implemented Interfaces:
    Comparator<ITimeSpan>

      public class TimeSpanComparator
      extends Object
      implements Comparator<ITimeSpan>

  A specialized `Comparator` that is capable of comparing two time spans with each other. This class comes in handy when tryin to sort collections of time spans.
  Since:
    1.0
  Version:
    $Revision: 1.5 $
  Author:
    Dirk Lemmermann
  See Also:
    `Collections.sort(java.util.List, Comparator)`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TimeSpanComparator()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compare(ITimeSpan span1, ITimeSpan span2)` Compares two time spans with each other.

    - ### 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

      `comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong`

- - ### Constructor Detail

    - #### TimeSpanComparator

          public TimeSpanComparator()

  - ### Method Detail

    - #### compare

          public int compare(ITimeSpan span1,
                             ITimeSpan span2)

      Compares two time spans with each other. This method will simply call `Comparable.compareTo(Object)` on the first time span passing in the second span as an argument.
      Specified by:
        `compare` in interface `Comparator<ITimeSpan>`
      Parameters:
        `span1` - the first span to compare
        `span2` - the second span to compare
      Returns:
        -1, 0, +1 depending on whether the first span starts before, at the same time, or after the second span
      Since:
        1.0
      See Also:
        `Comparator.compare(java.lang.Object, java.lang.Object)`

Copyright © 2006–2020 Dirk Lemmermann Software & Consulting. All rights reserved.