com.dlsc.flexgantt.policy.layer

## Class SimpleGranularityGridPolicy

- java.lang.Object
- - com.dlsc.flexgantt.policy.AbstractPolicy
  - - com.dlsc.flexgantt.policy.layer.AbstractGridPolicy<SimpleGranularity>
    - - com.dlsc.flexgantt.policy.layer.SimpleGranularityGridPolicy

- All Implemented Interfaces:
    IPolicy, IGridPolicy<SimpleGranularity>

      public class SimpleGranularityGridPolicy
      extends AbstractGridPolicy<SimpleGranularity>

  A grid policy that uses the `SimpleGranularity` class to adjust start and end times.
  Since:
    1.0
  Version:
    $Revision: 1.6 $
  Author:
    Dirk Lemmermann

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SimpleGranularityGridPolicy()` Constructs a new policy that will support all granularities found in the `SimpleGranularity` enumerator.
    `SimpleGranularityGridPolicy(boolean adjustingStartTimes, boolean adjustingEndTimes, SimpleGranularity... granularities)` Constructs a new policy.
    `SimpleGranularityGridPolicy(SimpleGranularity... granularities)` Constructs a new policy, which will round start and end times.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `long` | `getGridAdjustedEndTime(SimpleGranularity sg, long endTime, IDatelineModel<SimpleGranularity> model, boolean autoGrid)` Returns a grid adjusted time point for the given unadjusted end time.
    `long` | `getGridAdjustedStartTime(SimpleGranularity sg, long startTime, IDatelineModel<SimpleGranularity> model, boolean autoGrid)` Returns a grid adjusted time point for the given unadjusted start time.
    `ITimeSpan` | `getGridAdjustedTimeSpan(SimpleGranularity sg, ITimeSpan timeSpan, IDatelineModel<SimpleGranularity> model, boolean autoGrid)` Returns a grid adjusted time span for the given unadjusted time span.

    - ### Methods inherited from class com.dlsc.flexgantt.policy.layer.AbstractGridPolicy

      `getGridGranularities, isAdjustingEndTimes, isAdjustingStartTimes`

    - ### Methods inherited from class com.dlsc.flexgantt.policy.AbstractPolicy

      `assertClass`

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SimpleGranularityGridPolicy

          public SimpleGranularityGridPolicy(boolean adjustingStartTimes,
                                             boolean adjustingEndTimes,
                                             SimpleGranularity... granularities)

      Constructs a new policy.
      Parameters:
        `adjustingStartTimes` - if TRUE the start times will be rounded based on the given grid granularity
        `adjustingEndTimes` - if TRUE the end times will be rounded based on the given grid granularity
        `granularities` - the supported grid granularities
      Since:
        1.0

    - #### SimpleGranularityGridPolicy

          public SimpleGranularityGridPolicy(SimpleGranularity... granularities)

      Constructs a new policy, which will round start and end times.
      Parameters:
        `granularities` - the supported grid granularities
      Since:
        1.0

    - #### SimpleGranularityGridPolicy

          public SimpleGranularityGridPolicy()

      Constructs a new policy that will support all granularities found in the `SimpleGranularity` enumerator.
      Since:
        1.0

  - ### Method Detail

    - #### getGridAdjustedTimeSpan

          public ITimeSpan getGridAdjustedTimeSpan(SimpleGranularity sg,
                                                   ITimeSpan timeSpan,
                                                   IDatelineModel<SimpleGranularity> model,
                                                   boolean autoGrid)

      Description copied from interface: `IGridPolicy`
      Returns a grid adjusted time span for the given unadjusted time span. How the adjustment happens depends on the policy implementation.
      Parameters:
        `sg` - the granularity for which to return an adjusted time point
        `timeSpan` - the original time span that needs adjustment
        `model` - the model used by the dateline (needed for the auto grid feature)
        `autoGrid` - if TRUE the grid calculations will be based on the minor granularity shown by the dateline
      Returns:
        a grid adjusted time span

    - #### getGridAdjustedStartTime

          public long getGridAdjustedStartTime(SimpleGranularity sg,
                                               long startTime,
                                               IDatelineModel<SimpleGranularity> model,
                                               boolean autoGrid)

      Description copied from interface: `IGridPolicy`
      Returns a grid adjusted time point for the given unadjusted start time. How the adjustment happens depends on the policy implementation.
      Parameters:
        `sg` - the granularity for which to return an adjusted time point
        `startTime` - the original time that needs adjustment
        `model` - the model used by the dateline (needed for the auto grid feature)
        `autoGrid` - if TRUE the grid calculations will be based on the minor granularity shown by the dateline
      Returns:
        a grid adjusted start time

    - #### getGridAdjustedEndTime

          public long getGridAdjustedEndTime(SimpleGranularity sg,
                                             long endTime,
                                             IDatelineModel<SimpleGranularity> model,
                                             boolean autoGrid)

      Description copied from interface: `IGridPolicy`
      Returns a grid adjusted time point for the given unadjusted end time. How the adjustment happens depends on the policy implementation.
      Parameters:
        `sg` - the granularity for which to return an adjusted time point
        `endTime` - the original time that needs adjustment
        `model` - the model used by the dateline (needed for the auto grid feature)
        `autoGrid` - if TRUE the grid calculations will be based on the minor granularity shown by the dateline
      Returns:
        a grid adjusted end time

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