001package org.cpsolver.ifs.assignment.context;
002
003import org.cpsolver.ifs.assignment.Assignment;
004import org.cpsolver.ifs.model.Value;
005import org.cpsolver.ifs.model.Variable;
006
007/**
008 * An extension of the simple {@link AssignmentContext} which is used by the
009 * {@link ConstraintWithContext} class. The notification methods assigned and unassigned 
010 * are automatically called by the constraint whenever a variable of the constraint
011 * is assigned or unassigned respectively.
012 * 
013 * @see ConstraintWithContext
014 * 
015 * @version IFS 1.3 (Iterative Forward Search)<br>
016 *          Copyright (C) 2014 Tomáš Müller<br>
017 *          <a href="mailto:muller@unitime.org">muller@unitime.org</a><br>
018 *          <a href="http://muller.unitime.org">http://muller.unitime.org</a><br>
019 * <br>
020 *          This library is free software; you can redistribute it and/or modify
021 *          it under the terms of the GNU Lesser General Public License as
022 *          published by the Free Software Foundation; either version 3 of the
023 *          License, or (at your option) any later version. <br>
024 * <br>
025 *          This library is distributed in the hope that it will be useful, but
026 *          WITHOUT ANY WARRANTY; without even the implied warranty of
027 *          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
028 *          Lesser General Public License for more details. <br>
029 * <br>
030 *          You should have received a copy of the GNU Lesser General Public
031 *          License along with this library; if not see <a href='http://www.gnu.org/licenses'>http://www.gnu.org/licenses</a>.
032 * @param <V> Variable
033 * @param <T> Value
034 **/
035public interface AssignmentConstraintContext<V extends Variable<V, T>, T extends Value<V, T>> extends AssignmentContext {
036    
037    /**
038     * Called when {@link ConstraintWithContext#assigned(Assignment, long, Value)} is called to update
039     * the content of the context.
040     * @param assignment current assignment (with which this context is associated)
041     * @param value assigned value
042     */
043    public void assigned(Assignment<V,T> assignment, T value);
044    
045    /**
046     * Called when {@link ConstraintWithContext#unassigned(Assignment, long, Value)} is called to update
047     * the content of the context.
048     * @param assignment current assignment (with which this context is associated)
049     * @param value unassigned value
050     */
051    public void unassigned(Assignment<V,T> assignment, T value);
052
053}