Generated on Tue May 22 09:39:45 2018 for Gecode by doxygen 1.6.3

val-commit.hpp

Go to the documentation of this file.
00001 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
00002 /*
00003  *  Main authors:
00004  *     Christian Schulte <schulte@gecode.org>
00005  *
00006  *  Contributing authors:
00007  *     Gabor Szokoli <szokoli@gecode.org>
00008  *     Guido Tack <tack@gecode.org>
00009  *
00010  *  Copyright:
00011  *     Christian Schulte, 2012
00012  *     Gabor Szokoli, 2004
00013  *     Guido Tack, 2004
00014  *
00015  *  This file is part of Gecode, the generic constraint
00016  *  development environment:
00017  *     http://www.gecode.org
00018  *
00019  *  Permission is hereby granted, free of charge, to any person obtaining
00020  *  a copy of this software and associated documentation files (the
00021  *  "Software"), to deal in the Software without restriction, including
00022  *  without limitation the rights to use, copy, modify, merge, publish,
00023  *  distribute, sublicense, and/or sell copies of the Software, and to
00024  *  permit persons to whom the Software is furnished to do so, subject to
00025  *  the following conditions:
00026  *
00027  *  The above copyright notice and this permission notice shall be
00028  *  included in all copies or substantial portions of the Software.
00029  *
00030  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00031  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00032  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00033  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00034  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00035  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00036  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00037  *
00038  */
00039 
00040 namespace Gecode { namespace Set { namespace Branch {
00041 
00042   forceinline
00043   ValCommitInc::ValCommitInc(Space& home, const ValBranch<Var>& vb)
00044     : ValCommit<SetView,int>(home,vb) {}
00045   forceinline
00046   ValCommitInc::ValCommitInc(Space& home, ValCommitInc& vc)
00047     : ValCommit<SetView,int>(home,vc) {}
00048   forceinline ModEvent
00049   ValCommitInc::commit(Space& home, unsigned int a, SetView x, int, int n) {
00050     return (a == 0) ? x.include(home,n) : x.exclude(home,n);
00051   }
00052   forceinline NGL*
00053   ValCommitInc::ngl(Space& home, unsigned int a, SetView x, int n) const {
00054     if (a == 0)
00055       return new (home) IncNGL(home,x,n);
00056     else
00057       return NULL;
00058   }
00059   forceinline void
00060   ValCommitInc::print(const Space&, unsigned int a, SetView, int i, int n,
00061                       std::ostream& o) const {
00062     o << "var[" << i << "]."
00063       << ((a == 0) ? "include" : "exclude") << "(" << n << ")";
00064   }
00065 
00066   forceinline
00067   ValCommitExc::ValCommitExc(Space& home, const ValBranch<Var>& vb)
00068     : ValCommit<SetView,int>(home,vb) {}
00069   forceinline
00070   ValCommitExc::ValCommitExc(Space& home, ValCommitExc& vc)
00071     : ValCommit<SetView,int>(home,vc) {}
00072   forceinline ModEvent
00073   ValCommitExc::commit(Space& home, unsigned int a, SetView x, int, int n) {
00074     return (a == 0) ? x.exclude(home,n) : x.include(home,n);
00075   }
00076   forceinline NGL*
00077   ValCommitExc::ngl(Space& home, unsigned int a, SetView x, int n) const {
00078     if (a == 0)
00079       return new (home) ExcNGL(home,x,n);
00080     else
00081       return NULL;
00082   }
00083   forceinline void
00084   ValCommitExc::print(const Space&, unsigned int a, SetView, int i, int n,
00085                       std::ostream& o) const {
00086     o << "var[" << i << "]."
00087       << ((a == 0) ? "exclude" : "include") << "(" << n << ")";
00088   }
00089 
00090 }}}
00091 
00092 // STATISTICS: set-branch
00093