BinaryIntConstraint.java

  1. /* Copyright 2015 Laurent COCAULT
  2.  * Licensed to Laurent COCAULT under one or more contributor license agreements.
  3.  * See the NOTICE file distributed with this work for additional information
  4.  * regarding copyright ownership. Laurent COCAULT licenses this file to You
  5.  * under the Apache License, Version 2.0 (the "License"); you may not use this
  6.  * file except in compliance with the License.  You may obtain a copy of the
  7.  * License at
  8.  *
  9.  *   http://www.apache.org/licenses/LICENSE-2.0
  10.  *
  11.  * Unless required by applicable law or agreed to in writing, software
  12.  * distributed under the License is distributed on an "AS IS" BASIS,
  13.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.  * See the License for the specific language governing permissions and
  15.  * limitations under the License.
  16.  */
  17. package org.csp.constraint.model.integer;

  18. import org.csp.constraint.model.BinaryConstraint;

  19. /**
  20.  * Binary constraint between two variables implying a delta between their
  21.  * values.
  22.  */
  23. public abstract class BinaryIntConstraint extends BinaryConstraint<IntValue> {

  24.     /**
  25.      * Delta between the variables.
  26.      */
  27.     private IntValue delta_;

  28.     /**
  29.      * Constructor of the constraint.
  30.      * @param name
  31.      *            Name of the constraint
  32.      * @param first
  33.      *            First variable
  34.      * @param second
  35.      *            Second variable
  36.      * @param delta
  37.      *            Delta between the variables
  38.      */
  39.     public BinaryIntConstraint(final String name, final IntVar first,
  40.             final IntVar second, final IntValue delta) {
  41.         super(name, first, second);
  42.         delta_ = delta;
  43.     }

  44.     /**
  45.      * Get the delta between the variables.
  46.      * @return Delta between the variables
  47.      */
  48.     public IntValue getDelta() {
  49.         return delta_;
  50.     }

  51. }