com.dlsc.flexgantt.model.scheduling

## Class SimpleGranularityConstraint<T>

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

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

      public class SimpleGranularityConstraint<T>
      extends AbstractConstraint<T,SimpleGranularity>

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

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SimpleGranularityConstraint(TimelineObjectPath<T> sourcePath, TimelineObjectPath<T> targetPath)` Constructs a new constraint.
    `SimpleGranularityConstraint(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 time1, long time2, SimpleGranularity 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

    - #### SimpleGranularityConstraint

          public SimpleGranularityConstraint(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

    - #### SimpleGranularityConstraint

          public SimpleGranularityConstraint(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 time1,
                                    long time2,
                                    SimpleGranularity granularity)

      Calculates the delta between the two given time points. If the given granularity is HUNDREDS, then the delta will be returned in HUNDREDS as well.
      Specified by:
        `getDelta` in class `AbstractConstraint<T,SimpleGranularity>`
      Parameters:
        `time1` - the relevant time point of the first timeline object (might be start or end time)
        `time2` - 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.