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