com.dlsc.flexgantt.model.scheduling

## Interface IConstraint<T,S extends IGranularity>

- Type Parameters:
    `T` - the object type of the timeline objects
    `S` - the granularity type (e.g. TimeGranularity.HOURS)
  All Superinterfaces:
    IRelationship<T>
  All Known Implementing Classes:
    AbstractConstraint, SimpleGranularityConstraint, TimeGranularityConstraint

      public interface IConstraint<T,S extends IGranularity>
      extends IRelationship<T>

  A constraint is a specialization of a generic relationship between two timeline objects. It adds scheduling-specific information to the relationship such as constraint type (hard, soft) and buffer duration.
  Since:
    2.1
  Author:
    Dirk Lemmermann

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getBufferDuration()` Returns the duration of the buffer.
    `S` | `getBufferGranularity()` Returns the buffer granularity (days, hours, weeks).
    `BufferType` | `getBufferType()` Returns the buffer type (=, <=, <, >, >=).
    `ConstraintType` | `getConstraintType()` Returns the `ConstraintType` which determines if the constraint is a hard or a soft constraint.
    `Violation` | `getViolation(long time1, long time2)` Checks whether a violation of the constraint exists for the given two time points.
    `void` | `setBufferDuration(int duration)` Sets the duration of the buffer.
    `void` | `setBufferGranularity(S granularity)` Sets the buffer granularity (days, hours, weeks).
    `void` | `setBufferType(BufferType type)` Sets the buffer type (=, <=, <, >, >=).
    `void` | `setConstraintType(ConstraintType type)` Sets the `ConstraintType` which determines if the constraint is a hard or a soft constraint.

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

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

- - ### Method Detail

    - #### getViolation

          Violation getViolation(long time1,
                                 long time2)

      Checks whether a violation of the constraint exists for the given two time points.
      - If the constraint is of type `RelationshipType.END_TO_START` then `time1`will be the end time of the first timeline object and `time2` will be the start time of the second timeline object.
      - If the constraint is of type `RelationshipType.END_TO_END` then `time1`will be the end time of the first timeline object and `time2` will be the end time of the second timeline object.
      - If the constraint is of type `RelationshipType.START_TO_START` then `time1`will be the start time of the first timeline object and `time2` will be the start time of the second timeline object.
      - If the constraint is of type `RelationshipType.START_TO_END` then `time1`will be the start time of the first timeline object and `time2` will be the end time of the second timeline object.
      Parameters:
        `time1` -
        `time2` -
      Returns:
        a violation message
      Since:
        2.1

    - #### getConstraintType

          ConstraintType getConstraintType()

      Returns the `ConstraintType` which determines if the constraint is a hard or a soft constraint.
      Returns:
        the type of the constraint (hard, soft)
      Since:
        2.1

    - #### setConstraintType

          void setConstraintType(ConstraintType type)

      Sets the `ConstraintType` which determines if the constraint is a hard or a soft constraint.
      Parameters:
        `type` - the constraint type
      Since:
        2.1

    - #### getBufferType

          BufferType getBufferType()

      Returns the buffer type (=, <=, <, >, >=).
      Returns:
        the buffer type
      Since:
        2.1

    - #### setBufferType

          void setBufferType(BufferType type)

      Sets the buffer type (=, <=, <, >, >=).
      Parameters:
        `type` - the buffer type
      Since:
        2.1

    - #### getBufferGranularity

          S getBufferGranularity()

      Returns the buffer granularity (days, hours, weeks).
      Returns:
        the buffer granularity
      Since:
        2.1

    - #### setBufferGranularity

          void setBufferGranularity(S granularity)

      Sets the buffer granularity (days, hours, weeks).
      Parameters:
        `granularity` - the buffer granularity
      Since:
        2.1

    - #### getBufferDuration

          int getBufferDuration()

      Returns the duration of the buffer.
      Returns:
        the buffer duration
      Since:
        2.1

    - #### setBufferDuration

          void setBufferDuration(int duration)

      Sets the duration of the buffer.
      Parameters:
        `duration` - the buffer duration
      Since:
        2.1

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