CSP_Variable

CSP_Variable - domain.domain_values = values Replaces old...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
package CSP; /** * Title: CSP_Variable * Description: Define subclass to represent a specific kind of CSP variable. * Copyright: Copyright (c) 2005 * Company: MIT * @author Andreas Hofmann * @version 1.0 */ import java.util.*; public class CSP_Variable { CSP_Domain domain = null; List from_arcs = new ArrayList(); List to_arcs = new ArrayList(); public CSP_Variable() { } public CSP_Domain get_domain() { return domain; } public List get_domain_values() { return domain.domain_values; } public void assign(Object domain_value) { List values = new ArrayList(); values.add(domain_value); domain.domain_values = values; // Replaces old domain } public void restore_domain(List values)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { domain.domain_values = values; // Replaces old domain } public boolean consistent() { // Iterate over to_arcs, checking if consistent. ListIterator to_arc_iterator = to_arcs.listIterator(); while (to_arc_iterator.hasNext()) { CSP_Constraint to_arc = (CSP_Constraint)to_arc_iterator.next(); if (!(to_arc.consistent())) return false; } // Iterate over from_arcs, checking if consistent. ListIterator from_arc_iterator = from_arcs.listIterator(); while (from_arc_iterator.hasNext()) { CSP_Constraint from_arc = (CSP_Constraint)from_arc_iterator.next(); if (!(from_arc.consistent())) return false; } return true; } }...
View Full Document

This note was uploaded on 11/07/2011 for the course AERO 16.410 taught by Professor Brianwilliams during the Fall '05 term at MIT.

Page1 / 2

CSP_Variable - domain.domain_values = values Replaces old...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online