1 /* 2 * Stateful.java 3 * This file is part of JaCoP. 4 * <p> 5 * JaCoP is a Java Constraint Programming solver. 6 * <p> 7 * Copyright (C) 2000-2008 Krzysztof Kuchcinski and Radoslaw Szymanek 8 * <p> 9 * This program is free software: you can redistribute it and/or modify 10 * it under the terms of the GNU Affero General Public License as published by 11 * the Free Software Foundation, either version 3 of the License, or 12 * (at your option) any later version. 13 * <p> 14 * This program is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU Affero General Public License for more details. 18 * <p> 19 * Notwithstanding any other provision of this License, the copyright 20 * owners of this work supplement the terms of this License with terms 21 * prohibiting misrepresentation of the origin of this work and requiring 22 * that modified versions of this work be marked in reasonable ways as 23 * different from the original version. This supplement of the license 24 * terms is in accordance with Section 7 of GNU Affero General Public 25 * License version 3. 26 * <p> 27 * You should have received a copy of the GNU Affero General Public License 28 * along with this program. If not, see <http://www.gnu.org/licenses/>. 29 */ 30 31 package org.jacop.api; 32 33 /** 34 * Interface to mark the need of an entity to receive information about level being removed. 35 * 36 * @author Radoslaw Szymanek and Krzysztof Kuchcinski 37 * @version 4.8 38 */ 39 public interface Stateful { 40 41 /** 42 * This function is called in case of the backtrack, so a constraint can 43 * clear the queue of changed variables which is no longer valid. This 44 * function is called *before* all timestamps, variables, mutablevariables 45 * have reverted to their previous value. 46 * 47 * @param level the level which is being removed. 48 */ removeLevel(int level)49 void removeLevel(int level); 50 51 /** 52 * This function can be overriden by any constraint to specify dynamic conditions (based on 53 * the domain of variables at imposition level to decide if it is a stateful constraint. 54 * 55 * @return true if constraint is stateful. 56 */ isStateful()57 default boolean isStateful() { 58 return true; 59 } 60 61 } 62