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

OffsetView.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-09-11 17:06:50 +0200 (Mon, 11 Sep 2006) $ by $Author: zayenz $
00012  *     $Revision: 3650 $
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 
00037 public class OffsetView<IV extends IntView> implements IntView {
00038     private IV v;
00039     private int c;
00040 
00043     public OffsetView() {}
00046     public OffsetView(JavaSpace s, int c0, IV x) {
00047         v = x;
00048         c = c0;
00049     }
00050 
00051     @SuppressWarnings("unchecked") 
00052     public OffsetView<IV> copy(JavaSpace newHome, boolean share) {
00053         OffsetView<IV> nv = new OffsetView<IV>();
00054         nv.v = (IV)v.copy(newHome, share);
00055         nv.c = c;
00056         return nv;
00057     }
00058     public void subscribe(JavaSpace s, JavaPropagator p, PropCond pc) {
00059         v.subscribe(s, p, pc);
00060     }
00061     public void cancel(JavaSpace s, JavaPropagator p, PropCond pc) {
00062         v.cancel(s, p, pc);
00063     }
00064 
00065     public boolean assigned() { return v.assigned(); }
00066     public int val() { return v.val()+c; }
00067     public int min() { return v.min()+c; }
00068     public int max() { return v.max()+c; }
00069     public boolean in(int val) { return v.in(val-c); }
00070 
00071     public IntModEvent lq(JavaSpace s, int i) {
00072         return v.lq(s, i-c);
00073     }
00074     public IntModEvent eq(JavaSpace s, int i) {
00075         return v.eq(s, i-c);
00076     }
00077     public IntModEvent gq(JavaSpace s, int i) {
00078         return v.gq(s, i-c);
00079     }
00080     public IntModEvent nq(JavaSpace s, int i) {
00081         return v.nq(s, i-c);
00082     }
00083 
00084     public IntModEvent inter(JavaSpace s, RangeIterator iter) {
00085         throw (new UnsupportedOperationException("Not implemented"));
00086     }
00087 }