    001package org.cpsolver.ifs.assignment.context;
    002
    003import org.cpsolver.ifs.assignment.Assignment;
    004import org.cpsolver.ifs.assignment.InheritedAssignment;
    005import org.cpsolver.ifs.model.Value;
    006import org.cpsolver.ifs.model.Variable;
    007
    008/**
    009 * An additional interface that can be implemented by the {@link HasAssignmentContext} class.
    010 * The inherited assignment context holder (see {@link InheritedAssignmentContextHolder}) can
    011 * than use this interface to inherit an assignment context from the parent assignment context.
    012 * If a {@link HasAssignmentContext} class implements this interface, {@link InheritedAssignment}
    013 * will use the {@link CanInheritContext#inheritAssignmentContext(Assignment, AssignmentContext)} method
    014 * instead of the {@link HasAssignmentContext#createAssignmentContext(Assignment)} method to create
    015 * a new context.
    016 *
    017 * @see HasAssignmentContext
    018 * @see InheritedAssignment
    019 * @see InheritedAssignmentContextHolder
    020 *
    021 * @version IFS 1.3 (Iterative Forward Search)<br>
    022 *          Copyright (C) 2014 Tomáš Müller<br>
    023 *          <a href="mailto:muller@unitime.org">muller@unitime.org</a><br>
    024 *          <a href="http://muller.unitime.org">http://muller.unitime.org</a><br>
    025 * <br>
    026 *          This library is free software; you can redistribute it and/or modify
    027 *          it under the terms of the GNU Lesser General Public License as
    028 *          published by the Free Software Foundation; either version 3 of the
    029 *          License, or (at your option) any later version. <br>
    030 * <br>
    031 *          This library is distributed in the hope that it will be useful, but
    032 *          WITHOUT ANY WARRANTY; without even the implied warranty of
    033 *          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    034 *          Lesser General Public License for more details. <br>
    035 * <br>
    036 *          You should have received a copy of the GNU Lesser General Public
    037 *          License along with this library; if not see <a href='http://www.gnu.org/licenses'>http://www.gnu.org/licenses</a>.
    038 * @param <V> Variable
    039 * @param <T> Value
    040 * @param <C> Assignment Context
    041 **/
    042public interface CanInheritContext <V extends Variable<V, T>, T extends Value<V, T>, C extends AssignmentContext> {
    043
    044    /**
    045     * Create a new assignment context for the given assignment. This method can be used to
    046     * clone the parent context if desired.
    047     * @param assignment an assignment for which there needs to be an assignment context
    048     * @param parentContext context of the parent assignment
    049     * @return a new instance of the assignment context, filled according to the given assignment
    050     */
    051    public C inheritAssignmentContext(Assignment<V,T> assignment, C parentContext);
    052
    053}