Generated on Fri Oct 6 16:26:43 2006 for Gecode/J by doxygen 1.4.7

BinaryPropagator.java

Go to the documentation of this file.
00001 /*
00002  *  Main authors:
00003  *     Mikael Lagerkvist <lagerkvist@gecode.org>
00004  *
00005  *  Copyright:
00006  *     Mikael Lagerkvist, 2006
00007  *
00008  *  Last modified:
00009  *     $Date: 2006-09-11 17:06:50 +0200 (Mon, 11 Sep 2006) $ by $Author: zayenz $
00010  *     $Revision: 3650 $
00011  *
00012  *  This file is part of Gecode, the generic constraint
00013  *  development environment:
00014  *     http://www.gecode.org
00015  *
00016  *  See the file "LICENSE" for information on usage and
00017  *  redistribution of this file, and for a
00018  *     DISCLAIMER OF ALL WARRANTIES.
00019  *
00020  */
00021 
00022 package org.gecode;
00023 
00028 public abstract class BinaryPropagator<GV extends GecodeView> extends Propagator {
00029     protected GV x,y;
00030     private PropCond pc;
00031 
00035     public BinaryPropagator(Space s, GV x0, GV y0, PropCond pc0) {
00036         x = x0;
00037         y = y0;
00038         pc = pc0;
00039     }
00042     @SuppressWarnings("unchecked") 
00043     public BinaryPropagator(Space s, boolean share, BinaryPropagator p) {
00044         x = (GV)p.x.copy(s, share);
00045         y = (GV)p.y.copy(s, share);
00046         pc = p.pc;
00047     }
00048     public void dispose(Space home) {
00049         x.cancel(home, this,pc);
00050         y.cancel(home, this,pc);
00051     }
00052     public ExecStatus setup(Space home) { 
00053         x.subscribe(home,this,pc);
00054         y.subscribe(home,this,pc);
00055         return ExecStatus.ES_OK;
00056     }
00057 }
00058