Generated on Thu Nov 2 14:49:35 2006 for Gecode/J by doxygen 1.5.0

Extent.java

Go to the documentation of this file.
00001 /* -*- indent-tabs-mode: nil -*- */
00002 /*
00003  *  Main authors:
00004  *     Marco Kuhlmann <kuhlmann@ps.uni-sb.de>
00005  *     Guido Tack <tack@gecode.org>
00006  *
00007  *  Copyright:
00008  *     Marco Kuhlmann, 2005
00009  *     Guido Tack, 2006
00010  *
00011  *  Last modified:
00012  *     $Date: 2006-10-26 11:31:58 +0200 (Thu, 26 Oct 2006) $ by $Author: tack $
00013  *     $Revision: 3796 $
00014  *
00015  *  This file is part of Gecode, the generic constraint
00016  *  development environment:
00017  *     http://www.gecode.org
00018  *
00019  *  See the file "LICENSE" for information on usage and
00020  *  redistribution of this file, and for a
00021  *     DISCLAIMER OF ALL WARRANTIES.
00022  *
00023  */
00024 
00025 package org.gecode.gist;
00026 
00027 public class Extent {
00028 
00029         public int extentL;
00030         public int extentR;
00031         
00032         public Extent(int pExtentL, int pExtentR) {
00033                 extentL = pExtentL;
00034                 extentR = pExtentR;
00035         }
00036         
00037         public Extent(int width) {
00038     int halfWidth = width / 2;
00039                 extentL = 0 - halfWidth;
00040                 extentR = 0 + halfWidth;
00041         }
00042   
00043   public void extend(int deltaL, int deltaR) {
00044     extentL += deltaL;
00045     extentR += deltaR;
00046   }
00047   
00048   public void move(int delta) {
00049     extentL += delta;
00050     extentR += delta;
00051   }
00052   
00053   public String toString() {
00054     return "(" + extentL + "," + extentR + ")";
00055   }
00056   
00057 }