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

Info icon This 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)
Image of page 1

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

View Full Document Right Arrow Icon
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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern