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