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

NaryOnePropagator.java

Go to the documentation of this file.
00001 /*
00002  *  Main authors:
00003  *     Mikael Lagerkvist <lagerkvist@gecode.org>
00004  *     Guido Tack <tack@gecode.org>
00005  *
00006  *  Copyright:
00007  *     Mikael Lagerkvist, 2006
00008  *     Guido Tack, 2006
00009  *
00010  *  Last modified:
00011  *     $Date: 2006-02-09 12:23:33 +0100 (Thu, 09 Feb 2006) $ by $Author: pekczynski $
00012  *     $Revision: 2938 $
00013  *
00014  *  This file is part of Gecode, the generic constraint
00015  *  development environment:
00016  *     http://www.gecode.org
00017  *
00018  *  See the file "LICENSE" for information on usage and
00019  *  redistribution of this file, and for a
00020  *     DISCLAIMER OF ALL WARRANTIES.
00021  *
00022  */
00023 
00024 package org.gecode;
00025 
00030 public abstract class NaryOnePropagator<GV extends GecodeView> extends Propagator {
00031     protected ViewArray<GV> iv;
00032     protected GV x;
00033     private PropCond pc;
00034 
00038     public NaryOnePropagator(Space s, ViewArray<GV> iv0, GV x0, PropCond pc0) {
00039         iv = iv0;
00040         x  = x0;
00041         pc = pc0;
00042     }
00045     @SuppressWarnings("unchecked") 
00046     public NaryOnePropagator(Space s, boolean share,
00047                     NaryOnePropagator<GV> p) {
00048         iv = new ViewArray<GV>(s, share, p.iv);
00049         x  = (GV)p.x.copy(s, share);
00050         pc = p.pc;
00051     }
00052     public void dispose(Space home) {
00053         iv.cancel(home, this, pc);
00054         x.cancel(home, this, pc);
00055     }
00056     public ExecStatus setup(Space home) { 
00057         iv.subscribe(home, this, pc);
00058         x.subscribe(home, this, pc);
00059         return ExecStatus.ES_OK;
00060     }
00061 }