com.dlsc.flexgantt.model.dateline

## Enum SimpleGranularity

- java.lang.Object
- - java.lang.Enum<SimpleGranularity>
  - - com.dlsc.flexgantt.model.dateline.SimpleGranularity

- All Implemented Interfaces:
    IGranularity<SimpleGranularity>, Serializable, Comparable<SimpleGranularity>

      public enum SimpleGranularity
      extends Enum<SimpleGranularity>
      implements IGranularity<SimpleGranularity>

  An enumeration of possible simple granularities. The values in this enumerator are called simple because of their lack of complexity compared to the `TimeGranularity` enumerator. A simple enumerator value represents an order of 10 (1, 10, 100, 1000, 10000, 100000, ....). The documentation within this class uses the term milliseconds but the numbers could as well be called units or steps. If an application performs scheduling tasks that are based on units and steps instead of real time then it could easily use this enumerator.
  Since:
    1.0
  Version:
    $Revision: 1.10 $
  Author:
    Dirk Lemmermann
  See Also:
    `SimpleGranularityDatelineModel`, `SimpleGranularityDatelineRenderer`, `SimpleGranularityGridPolicy`

- - ### Enum Constant Summary

    Enum Constants
    Enum Constant and Description
    `BILLION` A granularity representing one billion milliseconds.
    `BILLION_HUNDRED` A granularity representing one hundred billion milliseconds.
    `BILLION_TEN` A granularity representing ten billion milliseconds.
    `HUNDRED` A granularity representing one hundred milliseconds.
    `MILLION` A granularity representing one million milliseconds.
    `MILLION_HUNDRED` A granularity representing one hundred million milliseconds.
    `MILLION_TEN` A granularity representing ten million milliseconds.
    `ONE` A granularity representing one millisecond.
    `TEN` A granularity representing ten milliseconds.
    `THOUSAND` A granularity representing one thousand milliseconds.
    `THOUSAND_HUNDRED` A granularity representing one hundred thousand milliseconds.
    `THOUSAND_TEN` A granularity representing ten thousand milliseconds.
    `TRILLION` A granularity representing one trillion milliseconds.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `long` | `adjust(long time)` Adjusts the given time point by rounding it down to the nearest multitude of the milliseconds represented by the granularity value.
    `long` | `decrement(long time)` Decrements the given number of milliseconds with the milliseconds represented by the enumerator value.
    `double` | `getDelta(ITimeSpan span)` Calculates how often the number of milliseconds represented by the time granularity fits into the difference between the given start and end times: `(endTime - startTime) / millis`.
    `long` | `getMillis()` Returns the number of milliseconds represented by the granularity.
    `String` | `getName()` Returns the name of the granularity (e.g.
    `String` | `getSingularName()` Returns the singular name of the granularity (e.g.
    `long` | `getStandardDuration()` Returns the standard duration in milliseconds of the granularity, e.g.
    `long` | `increment(long time)` Increments the given number of milliseconds with the milliseconds represented by the enumerator value.
    `boolean` | `isDisplayingMarkerType(MarkerType type)` Determines whether markers of the given type will be shown in the timeline.
    `boolean` | `isLarger(SimpleGranularity sg)` Checks whether this granularity is considered to be larger than the given one.
    `boolean` | `isSmaller(SimpleGranularity sg)` Checks whether this granularity is considered to be smaller than the given one.
    `SimpleGranularity` | `next()` Returns the next larger granularity (example: ONE -> TEN -> HUNDRED).
    `SimpleGranularity` | `previous()` Returns the previous smaller granularity (example: HUNDRED -> TEN -> ONE).
    `static SimpleGranularity` | `valueOf(String name)` Returns the enum constant of this type with the specified name.
    `static SimpleGranularity[]` | `values()` Returns an array containing the constants of this enum type, in the order they are declared.

    - ### Methods inherited from class java.lang.Enum

      `clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Enum Constant Detail

    - #### ONE

          public static final SimpleGranularity ONE

      A granularity representing one millisecond.
      Since:
        1.0

    - #### TEN

          public static final SimpleGranularity TEN

      A granularity representing ten milliseconds.
      Since:
        1.0

    - #### HUNDRED

          public static final SimpleGranularity HUNDRED

      A granularity representing one hundred milliseconds.
      Since:
        1.0

    - #### THOUSAND

          public static final SimpleGranularity THOUSAND

      A granularity representing one thousand milliseconds.
      Since:
        1.0

    - #### THOUSAND_TEN

          public static final SimpleGranularity THOUSAND_TEN

      A granularity representing ten thousand milliseconds.
      Since:
        1.0

    - #### THOUSAND_HUNDRED

          public static final SimpleGranularity THOUSAND_HUNDRED

      A granularity representing one hundred thousand milliseconds.
      Since:
        1.0

    - #### MILLION

          public static final SimpleGranularity MILLION

      A granularity representing one million milliseconds.
      Since:
        1.0

    - #### MILLION_TEN

          public static final SimpleGranularity MILLION_TEN

      A granularity representing ten million milliseconds.
      Since:
        1.0

    - #### MILLION_HUNDRED

          public static final SimpleGranularity MILLION_HUNDRED

      A granularity representing one hundred million milliseconds.
      Since:
        1.0

    - #### BILLION

          public static final SimpleGranularity BILLION

      A granularity representing one billion milliseconds.
      Since:
        1.0

    - #### BILLION_TEN

          public static final SimpleGranularity BILLION_TEN

      A granularity representing ten billion milliseconds.
      Since:
        1.0

    - #### BILLION_HUNDRED

          public static final SimpleGranularity BILLION_HUNDRED

      A granularity representing one hundred billion milliseconds.
      Since:
        1.0

    - #### TRILLION

          public static final SimpleGranularity TRILLION

      A granularity representing one trillion milliseconds.
      Since:
        1.0

  - ### Method Detail

    - #### values

          public static SimpleGranularity[] values()

      Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

          for (SimpleGranularity c : SimpleGranularity.values())
              System.out.println(c);

      Returns:
        an array containing the constants of this enum type, in the order they are declared

    - #### valueOf

          public static SimpleGranularity valueOf(String name)

      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
        `name` - the name of the enum constant to be returned.
      Returns:
        the enum constant with the specified name
      Throws:
        `IllegalArgumentException` - if this enum type has no constant with the specified name
        `NullPointerException` - if the argument is null

    - #### getName

          public String getName()

      Description copied from interface: `IGranularity`
      Returns the name of the granularity (e.g. "days", "months", ...).
      Specified by:
        `getName` in interface `IGranularity<SimpleGranularity>`
      Returns:
        the name of the granularity

    - #### getSingularName

          public String getSingularName()

      Description copied from interface: `IGranularity`
      Returns the singular name of the granularity (e.g. "day" instead of "days").
      Specified by:
        `getSingularName` in interface `IGranularity<SimpleGranularity>`
      Returns:
        the name of the granularity

    - #### increment

          public long increment(long time)

      Increments the given number of milliseconds with the milliseconds represented by the enumerator value.
      Parameters:
        `time` - the time to increment
      Returns:
        the given time plus the milliseconds represented by the value
      Since:
        1.0

    - #### decrement

          public long decrement(long time)

      Decrements the given number of milliseconds with the milliseconds represented by the enumerator value.
      Parameters:
        `time` - the time to increment
      Returns:
        the given time minus the milliseconds represented by the value
      Since:
        1.0

    - #### adjust

          public long adjust(long time)

      Adjusts the given time point by rounding it down to the nearest multitude of the milliseconds represented by the granularity value. Example: the granularity `THOUSAND` would adjust the time point 4366 to 4000.
      Parameters:
        `time` - the time that needs adjustment
      Returns:
        a number of milliseconds that is a multitude of the number of milliseconds represented by the enumerator value and that is still smaller than the given time
      Since:
        1.0

    - #### getMillis

          public long getMillis()

      Returns the number of milliseconds represented by the granularity.
      Returns:
        number of milliseconds represented by the granularity
      Since:
        1.0

    - #### getStandardDuration

          public long getStandardDuration()

      Description copied from interface: `IGranularity`
      Returns the standard duration in milliseconds of the granularity, e.g. day = 24 hours * 60 minutes * 60 seconds * 1000;
      Specified by:
        `getStandardDuration` in interface `IGranularity<SimpleGranularity>`
      Returns:
        the standard duration of one unit of this granularity

    - #### getDelta

          public double getDelta(ITimeSpan span)

      Calculates how often the number of milliseconds represented by the time granularity fits into the difference between the given start and end times: `(endTime - startTime) / millis`.
      Parameters:
        `span` - the time span for which to return the delta
      Returns:
        the delta between the start and the end time
      Since:
        1.0

    - #### next

          public SimpleGranularity next()

      Returns the next larger granularity (example: ONE -> TEN -> HUNDRED).
      Returns:
        the next larger simple granularity
      Since:
        1.0

    - #### previous

          public SimpleGranularity previous()

      Returns the previous smaller granularity (example: HUNDRED -> TEN -> ONE).
      Returns:
        the previous smaller simple granularity
      Since:
        1.0

    - #### isSmaller

          public boolean isSmaller(SimpleGranularity sg)

      Checks whether this granularity is considered to be smaller than the given one. Example:

      `SimpleGranularity.THOUSAND.isSmaller(SimpleGranularity.HUNDRED)`

      would return FALSE since one thousand milliseconds is a larger number than one hundred milliseconds.
      Specified by:
        `isSmaller` in interface `IGranularity<SimpleGranularity>`
      Parameters:
        `sg` - the granularity to compare with
      Returns:
        TRUE if this granularity is smaller than the given granularity
      Since:
        1.0

    - #### isLarger

          public boolean isLarger(SimpleGranularity sg)

      Checks whether this granularity is considered to be larger than the given one. Example:

      `SimpleGranularity.THOUSAND.isLarger(SimpleGranularity.HUNDRED)`

      would return TRUE since one thousand milliseconds is a larger number than one hundred milliseconds.
      Specified by:
        `isLarger` in interface `IGranularity<SimpleGranularity>`
      Parameters:
        `sg` - the granularity to compare with
      Returns:
        TRUE if this granularity is larger than the given granularity
      Since:
        1.0

    - #### isDisplayingMarkerType

          public boolean isDisplayingMarkerType(MarkerType type)

      Description copied from interface: `IGranularity`
      Determines whether markers of the given type will be shown in the timeline. It often does not make sense to show markers once a certain granularity (e.g. "decades") gets reached because then douzends of markers will clutter the screen.
      Specified by:
        `isDisplayingMarkerType` in interface `IGranularity<SimpleGranularity>`
      Parameters:
        `type` - the type of marker to check
      Returns:
        TRUE if markers of the given type shall be displayed in the timeline

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