001    package ifs.model;
002    
003    /**
004     * IFS model listener.
005     *
006     * @see Model
007     *
008     * @author <a href="mailto:muller@ktiml.mff.cuni.cz">Tomáš Müller</a>
009     * @version 1.0
010     */
011    public interface ModelListener {
012        /** Variable is added to the model
013         * @param variable added variable
014         */
015        public void variableAdded(Variable variable);
016        
017        /** Variable is removed from the model
018         * @param variable removed variable
019         */
020        public void variableRemoved(Variable variable);
021        
022        /** Constraint is added to the model
023         * @param constraint added constraint
024         */
025        public void constraintAdded(Constraint constraint);
026        
027        /** Constraint is removed from the model
028         * @param constraint removed constraint
029         */
030        public void constraintRemoved(Constraint constraint);
031        
032        /** Called before a value is assigned to its variable ({@link Value#variable()}). 
033         * @param iteration current iteration
034         * @param value value to be assigned
035         */
036        public void beforeAssigned(long iteration, Value value);
037    
038        /** Called before a value is unassigned from its variable ({@link Value#variable()}). 
039         * @param iteration current iteration
040         * @param value value to be unassigned
041         */
042        public void beforeUnassigned(long iteration, Value value);
043        
044        /** Called after a value is assigned to its variable ({@link Value#variable()}). 
045         * @param iteration current iteration
046         * @param value value to be assigned
047         */
048        public void afterAssigned(long iteration, Value value);
049    
050        /** Called after a value is unassigned from its variable ({@link Value#variable()}). 
051         * @param iteration current iteration
052         * @param value value to be unassigned
053         */
054        public void afterUnassigned(long iteration, Value value);
055        
056        /** Query for info about the model. A listener can also add some its info.
057         * @param anInfo resultant table with informations (key, value).
058         */
059        public void getInfo(java.util.Hashtable anInfo);
060    
061        /** Notification that the model was initialized by the solver. 
062         * @param solver IFS solver
063         */
064        public boolean init(ifs.solver.Solver solver);
065    }