com.dlsc.flexgantt.model.scheduling

## Class TimeGranularityConstraint<T>

- java.lang.Object
- - com.dlsc.flexgantt.model.gantt.DefaultRelationship<T>
  - - com.dlsc.flexgantt.model.scheduling.AbstractConstraint<T,TimeGranularity>
    - - com.dlsc.flexgantt.model.scheduling.TimeGranularityConstraint<T>

- Type Parameters:
    `T` - the type of the timeline objects
  All Implemented Interfaces:
    IRelationship<T>, IConstraint<T,TimeGranularity>

      public class TimeGranularityConstraint<T>
      extends AbstractConstraint<T,TimeGranularity>

  A constraint that can be used when the `TimeGranularity` type is used in the dateline of the Gantt chart.
  Since:
    2.1
  Author:
    Dirk Lemmermann

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TimeGranularityConstraint(TimelineObjectPath<T> sourcePath, TimelineObjectPath<T> targetPath)` Constructs a new constraint.
    `TimeGranularityConstraint(TimelineObjectPath<T> sourcePath, TimelineObjectPath<T> targetPath, RelationshipType type)` Constructs a new constraint.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected double` | `getDelta(long s, long e, TimeGranularity granularity)` Calculates the delta between the two given time points.

    - ### Methods inherited from class com.dlsc.flexgantt.model.scheduling.AbstractConstraint

      `getBufferDuration, getBufferGranularity, getBufferType, getConstraintType, getViolation, setBufferDuration, setBufferGranularity, setBufferType, setConstraintType, toString`

    - ### Methods inherited from class com.dlsc.flexgantt.model.gantt.DefaultRelationship

      `getLabel, getPopupObject, getPopupTitleObject, getSourcePath, getTargetPath, getType, isDeletable, isSelectable, setDeletable, setLabel, setPopupObject, setPopupTitleObject, setSelectable, setSourcePath, setTargetPath, setType`

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

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

    - ### Methods inherited from interface com.dlsc.flexgantt.model.gantt.IRelationship

      `getLabel, getPopupObject, getPopupTitleObject, getSourcePath, getTargetPath, getType, isDeletable, isSelectable, setSourcePath, setTargetPath, setType`

- - ### Constructor Detail

    - #### TimeGranularityConstraint

          public TimeGranularityConstraint(TimelineObjectPath<T> sourcePath,
                                           TimelineObjectPath<T> targetPath)

      Constructs a new constraint.
      Parameters:
        `sourcePath` - the path to the source timeline object (timeline object 1)
        `targetPath` - the path to the target timeline object (timeline object 2)
      Since:
        2.1

    - #### TimeGranularityConstraint

          public TimeGranularityConstraint(TimelineObjectPath<T> sourcePath,
                                           TimelineObjectPath<T> targetPath,
                                           RelationshipType type)

      Constructs a new constraint.
      Parameters:
        `sourcePath` - the path to the source timeline object (timeline object 1)
        `targetPath` - the path to the target timeline object (timeline object 2)
        `type` - the relationship type (S-S, S-E, E-S, E-E)
      Since:
        2.1

  - ### Method Detail

    - #### getDelta

          protected double getDelta(long s,
                                    long e,
                                    TimeGranularity granularity)

      Calculates the delta between the two given time points. If the given granularity is HOURS, then the delta will be returned in HOURS as well.
      Specified by:
        `getDelta` in class `AbstractConstraint<T,TimeGranularity>`
      Parameters:
        `s` - the relevant time point of the first timeline object (might be start or end time)
        `e` - the relevant time point of the second timeline object (might be start or end time)
        `granularity` - the time granularity (e.g. HOURS, DAYS, ...)
      Returns:
        the difference between s and e
      Since:
        2.1

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