org.cpsolver.ifs.example.tt

## Class Dependence

- java.lang.Object
- - org.cpsolver.ifs.model.Constraint<V,T>
  - - org.cpsolver.ifs.model.BinaryConstraint<Activity,Location>
    - - org.cpsolver.ifs.example.tt.Dependence

- All Implemented Interfaces:
    Comparable<Constraint<Activity,Location>>

      public class Dependence
      extends BinaryConstraint<Activity,Location>

  Binary dependence between two activities.
  Version:
    IFS 1.3 (Iterative Forward Search)
    Copyright (C) 2006 - 2014 Tomáš Müller
    muller@unitime.org
    http://muller.unitime.org
    This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
    This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
    You should have received a copy of the GNU Lesser General Public License along with this library; if not see http://www.gnu.org/licenses/.
  Author:
    Tomáš Müller

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `TYPE_AFTER`
    `static int` | `TYPE_BEFORE`
    `static int` | `TYPE_CLOSELY_AFTER`
    `static int` | `TYPE_CLOSELY_BEFORE`
    `static int` | `TYPE_CONCURRENCY`
    `static int` | `TYPE_NO_DEPENDENCE`

    - ### Fields inherited from class org.cpsolver.ifs.model.Constraint

      `iConstraintListeners, iId`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Dependence(String id, int type)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `computeConflicts(Assignment<Activity,Location> assignment, Location location, Set<Location> conflicts)` The only method which has to be implemented by any constraint.
    `String` | `getName()` Constraint's name -- for printing purposes
    `String` | `getResourceId()`
    `int` | `getType()`
    `boolean` | `inConflict(Assignment<Activity,Location> assignment, Location location)` Returns true if the given assignment is inconsistent with the existing assignments respecting this constraint.
    `boolean` | `isConsistent(int s1, int l1, int s2, int l2)`
    `boolean` | `isConsistent(Location l1, Location l2)` Returns true if the given assignments are consistent respecting this constraint.

    - ### Methods inherited from class org.cpsolver.ifs.model.BinaryConstraint

      `addVariable, another, first, isFirst, second`

    - ### Methods inherited from class org.cpsolver.ifs.model.Constraint

      `addConstraintListener, assigned, assignedVariables, compareTo, computeConflictsNoForwardCheck, constraintListeners, countAssignedVariables, countVariables, equals, getDescription, getId, getModel, hashCode, isHard, removeConstraintListener, removeVariable, setModel, unassigned, variables`

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

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

- - ### Field Detail

    - #### TYPE_NO_DEPENDENCE

          public static final int TYPE_NO_DEPENDENCE

      See Also:
        Constant Field Values

    - #### TYPE_BEFORE

          public static final int TYPE_BEFORE

      See Also:
        Constant Field Values

    - #### TYPE_CLOSELY_BEFORE

          public static final int TYPE_CLOSELY_BEFORE

      See Also:
        Constant Field Values

    - #### TYPE_AFTER

          public static final int TYPE_AFTER

      See Also:
        Constant Field Values

    - #### TYPE_CLOSELY_AFTER

          public static final int TYPE_CLOSELY_AFTER

      See Also:
        Constant Field Values

    - #### TYPE_CONCURRENCY

          public static final int TYPE_CONCURRENCY

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### Dependence

          public Dependence(String id,
                            int type)

  - ### Method Detail

    - #### getType

          public int getType()

    - #### getResourceId

          public String getResourceId()

    - #### computeConflicts

          public void computeConflicts(Assignment<Activity,Location> assignment,
                                       Location location,
                                       Set<Location> conflicts)

      Description copied from class: `Constraint`
      The only method which has to be implemented by any constraint. It returns the values which needs to be unassigned in order to make this constraint consistent with the given value if it is assigned to its variable. The computed list of conflicting values is added to the given set of conflicts.
      Specified by:
        `computeConflicts` in class `Constraint<Activity,Location>`
      Parameters:
        `assignment` - current assignment
        `location` - value to be assigned to its variable
        `conflicts` - resultant set of conflicting values

    - #### isConsistent

          public boolean isConsistent(int s1,
                                      int l1,
                                      int s2,
                                      int l2)

    - #### inConflict

          public boolean inConflict(Assignment<Activity,Location> assignment,
                                    Location location)

      Description copied from class: `Constraint`
      Returns true if the given assignment is inconsistent with the existing assignments respecting this constraint. This method is used by MAC (see `MacPropagation`).
      Overrides:
        `inConflict` in class `Constraint<Activity,Location>`
      Parameters:
        `assignment` - current assignment
        `location` - given value
      Returns:
        true if there is a conflict with other assigned variables of the constraint

    - #### isConsistent

          public boolean isConsistent(Location l1,
                                      Location l2)

      Description copied from class: `Constraint`
      Returns true if the given assignments are consistent respecting this constraint. This method is used by MAC (see `MacPropagation`).
      Overrides:
        `isConsistent` in class `Constraint<Activity,Location>`
      Parameters:
        `l1` - a value
        `l2` - a value
      Returns:
        true if the constraint is ok with the assignment

    - #### getName

          public String getName()

      Description copied from class: `Constraint`
      Constraint's name -- for printing purposes
      Overrides:
        `getName` in class `Constraint<Activity,Location>`
      Returns:
        constraint name