this repo has no description
1/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */ 2/* 3 * Main authors: 4 * Christopher Mears <Chris.Mears@monash.edu> 5 * 6 * Contributing authors: 7 * Christian Schulte <schulte@gecode.org> 8 * Guido Tack <tack@gecode.org> 9 * 10 * Copyright: 11 * Christopher Mears, 2011 12 * Christian Schulte, 2011 13 * Guido Tack, 2011 14 * 15 * This file is part of Gecode, the generic constraint 16 * development environment: 17 * http://www.gecode.org 18 * 19 * Permission is hereby granted, free of charge, to any person obtaining 20 * a copy of this software and associated documentation files (the 21 * "Software"), to deal in the Software without restriction, including 22 * without limitation the rights to use, copy, modify, merge, publish, 23 * distribute, sublicense, and/or sell copies of the Software, and to 24 * permit persons to whom the Software is furnished to do so, subject to 25 * the following conditions: 26 * 27 * The above copyright notice and this permission notice shall be 28 * included in all copies or substantial portions of the Software. 29 * 30 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 31 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 32 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 33 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 34 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 35 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 36 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 37 * 38 */ 39 40#include <gecode/set/precede.hh> 41 42namespace Gecode { 43 44 void 45 precede(Home home, const SetVarArgs& x, int s, int t) { 46 using namespace Set; 47 Limits::check(s,"Set::precede"); 48 Limits::check(t,"Set::precede"); 49 GECODE_POST; 50 51 ViewArray<SetView> y(home, x); 52 GECODE_ES_FAIL(Precede::Single<SetView>::post(home, y, s, t)); 53 } 54 55 void 56 precede(Home home, const SetVarArgs& x, const IntArgs& c) { 57 using namespace Set; 58 if (c.size() < 2) 59 return; 60 for (int i=c.size(); i--; ) 61 Limits::check(c[i],"Set::precede"); 62 GECODE_POST; 63 64 for (int i=c.size()-1; i--; ) { 65 ViewArray<SetView> y(home, x); 66 GECODE_ES_FAIL(Precede::Single<SetView>::post(home, y, c[i], c[i+1])); 67 } 68 } 69 70} 71 72// STATISTICS: set-post