    001package org.cpsolver.ifs.model;
    002
    003import org.cpsolver.ifs.assignment.Assignment;
    004
    005/**
    006 * IFS variable listener.
    007 *
    008 * @see Variable
    009 *
    010 * @version IFS 1.3 (Iterative Forward Search)<br>
    011 *          Copyright (C) 2006 - 2014 Tomáš Müller<br>
    012 *          <a href="mailto:muller@unitime.org">muller@unitime.org</a><br>
    013 *          <a href="http://muller.unitime.org">http://muller.unitime.org</a><br>
    014 * <br>
    015 *          This library is free software; you can redistribute it and/or modify
    016 *          it under the terms of the GNU Lesser General Public License as
    017 *          published by the Free Software Foundation; either version 3 of the
    018 *          License, or (at your option) any later version. <br>
    019 * <br>
    020 *          This library is distributed in the hope that it will be useful, but
    021 *          WITHOUT ANY WARRANTY; without even the implied warranty of
    022 *          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    023 *          Lesser General Public License for more details. <br>
    024 * <br>
    025 *          You should have received a copy of the GNU Lesser General Public
    026 *          License along with this library; if not see
    027 *          <a href='http://www.gnu.org/licenses/'>http://www.gnu.org/licenses/</a>.
    028 *
    029 * @param <T> Value
    030 */
    031public interface VariableListener<T extends Value<?, T>> {
    032    /**
    033     * Called by the variable when a value is assigned to it
    034     *
    035     * @param assignment current assignment
    036     * @param iteration
    037     *            current iteration
    038     * @param value
    039     *            assigned to the variable
    040     */
    041    public void variableAssigned(Assignment<?, T> assignment, long iteration, T value);
    042
    043    /**
    044     * Called by the variable when a value is unassigned from it
    045     *
    046     * @param assignment current assignment
    047     * @param iteration
    048     *            current iteration
    049     * @param value
    050     *            unassigned from the variable
    051     */
    052    public void variableUnassigned(Assignment<?, T> assignment, long iteration, T value);
    053
    054    /**
    055     * Called by the variable when a value is permanently removed from its
    056     * domain
    057     *
    058     * @param iteration
    059     *            current iteration
    060     * @param value
    061     *            removed from the variable's domain
    062     */
    063    public void valueRemoved(long iteration, T value);
    064}