00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 namespace Gecode { namespace Int {
00039
00040
00041
00042
00043
00044 forceinline
00045 OffsetView::OffsetView(void) {}
00046 forceinline
00047 OffsetView::OffsetView(const IntView& y, int d)
00048 : DerivedView<IntView>(y), c(d) {}
00049
00050
00051
00052
00053
00054
00055 forceinline int
00056 OffsetView::offset(void) const {
00057 return c;
00058 }
00059 forceinline void
00060 OffsetView::offset(int n) {
00061 c = n;
00062 }
00063 forceinline int
00064 OffsetView::min(void) const {
00065 return x.min()+c;
00066 }
00067 forceinline int
00068 OffsetView::max(void) const {
00069 return x.max()+c;
00070 }
00071 forceinline int
00072 OffsetView::med(void) const {
00073 return x.med()+c;
00074 }
00075 forceinline int
00076 OffsetView::val(void) const {
00077 return x.val()+c;
00078 }
00079
00080 forceinline unsigned int
00081 OffsetView::width(void) const {
00082 return x.width();
00083 }
00084 forceinline unsigned int
00085 OffsetView::size(void) const {
00086 return x.size();
00087 }
00088 forceinline unsigned int
00089 OffsetView::regret_min(void) const {
00090 return x.regret_min();
00091 }
00092 forceinline unsigned int
00093 OffsetView::regret_max(void) const {
00094 return x.regret_max();
00095 }
00096
00097
00098
00099
00100
00101 forceinline bool
00102 OffsetView::range(void) const {
00103 return x.range();
00104 }
00105 forceinline bool
00106 OffsetView::in(int n) const {
00107 return x.in(n-c);
00108 }
00109 forceinline bool
00110 OffsetView::in(long long int n) const {
00111 return x.in(n-c);
00112 }
00113
00114
00115
00116
00117
00118
00119
00120 forceinline ModEvent
00121 OffsetView::lq(Space& home, int n) {
00122 return x.lq(home,n-c);
00123 }
00124 forceinline ModEvent
00125 OffsetView::lq(Space& home, long long int n) {
00126 return x.lq(home,n-c);
00127 }
00128
00129 forceinline ModEvent
00130 OffsetView::le(Space& home, int n) {
00131 return x.le(home,n-c);
00132 }
00133 forceinline ModEvent
00134 OffsetView::le(Space& home, long long int n) {
00135 return x.le(home,n-c);
00136 }
00137
00138 forceinline ModEvent
00139 OffsetView::gq(Space& home, int n) {
00140 return x.gq(home,n-c);
00141 }
00142 forceinline ModEvent
00143 OffsetView::gq(Space& home, long long int n) {
00144 return x.gq(home,n-c);
00145 }
00146
00147 forceinline ModEvent
00148 OffsetView::gr(Space& home, int n) {
00149 return x.gr(home,n-c);
00150 }
00151 forceinline ModEvent
00152 OffsetView::gr(Space& home, long long int n) {
00153 return x.gr(home,n-c);
00154 }
00155
00156 forceinline ModEvent
00157 OffsetView::nq(Space& home, int n) {
00158 return x.nq(home,n-c);
00159 }
00160 forceinline ModEvent
00161 OffsetView::nq(Space& home, long long int n) {
00162 return x.nq(home,n-c);
00163 }
00164
00165 forceinline ModEvent
00166 OffsetView::eq(Space& home, int n) {
00167 return x.eq(home,n-c);
00168 }
00169 forceinline ModEvent
00170 OffsetView::eq(Space& home, long long int n) {
00171 return x.eq(home,n-c);
00172 }
00173
00174
00175
00176
00177
00178
00179 template<class I>
00180 forceinline ModEvent
00181 OffsetView::narrow_r(Space& home, I& i, bool depend) {
00182 Iter::Ranges::Offset<I> oi(i,-c);
00183 return x.narrow_r(home,oi,depend);
00184 }
00185 template<class I>
00186 forceinline ModEvent
00187 OffsetView::inter_r(Space& home, I& i, bool depend) {
00188 Iter::Ranges::Offset<I> oi(i,-c);
00189 return x.inter_r(home,oi,depend);
00190 }
00191 template<class I>
00192 forceinline ModEvent
00193 OffsetView::minus_r(Space& home, I& i, bool depend) {
00194 Iter::Ranges::Offset<I> oi(i,-c);
00195 return x.minus_r(home,oi,depend);
00196 }
00197 template<class I>
00198 forceinline ModEvent
00199 OffsetView::narrow_v(Space& home, I& i, bool depend) {
00200 Iter::Values::Offset<I> oi(i,-c);
00201 return x.narrow_v(home,oi,depend);
00202 }
00203 template<class I>
00204 forceinline ModEvent
00205 OffsetView::inter_v(Space& home, I& i, bool depend) {
00206 Iter::Values::Offset<I> oi(i,-c);
00207 return x.inter_v(home,oi,depend);
00208 }
00209 template<class I>
00210 forceinline ModEvent
00211 OffsetView::minus_v(Space& home, I& i, bool depend) {
00212 Iter::Values::Offset<I> oi(i,-c);
00213 return x.minus_v(home,oi,depend);
00214 }
00215
00216
00217
00218
00219
00220
00221
00222 forceinline ModEventDelta
00223 OffsetView::med(ModEvent me) {
00224 return IntView::med(me);
00225 }
00226
00227
00228
00229
00230
00231
00232 forceinline int
00233 OffsetView::min(const Delta& d) const {
00234 return x.min(d)+c;
00235 }
00236 forceinline int
00237 OffsetView::max(const Delta& d) const {
00238 return x.max(d)+c;
00239 }
00240 forceinline bool
00241 OffsetView::any(const Delta& d) const {
00242 return x.any(d);
00243 }
00244
00245
00246
00247
00248
00249
00250
00251 forceinline void
00252 OffsetView::update(Space& home, bool share, OffsetView& y) {
00253 DerivedView<IntView>::update(home,share,y);
00254 c=y.c;
00255 }
00256
00257
00262 template<>
00263 class ViewRanges<OffsetView>
00264 : public Iter::Ranges::Offset<ViewRanges<IntView> > {
00265 public:
00267
00268
00269 ViewRanges(void);
00271 ViewRanges(const OffsetView& x);
00273 void init(const OffsetView& x);
00275 };
00276
00277 forceinline
00278 ViewRanges<OffsetView>::ViewRanges(void) {}
00279
00280 forceinline
00281 ViewRanges<OffsetView>::ViewRanges(const OffsetView& x) {
00282 ViewRanges<IntView> xi(x.base());
00283 Iter::Ranges::Offset<ViewRanges<IntView> >::init(xi,x.offset());
00284 }
00285
00286 forceinline void
00287 ViewRanges<OffsetView>::init(const OffsetView& x) {
00288 ViewRanges<IntView> xi(x.base());
00289 Iter::Ranges::Offset<ViewRanges<IntView> >::init(xi,x.offset());
00290 }
00291
00292
00293
00294
00295
00296 forceinline bool
00297 same(const OffsetView& x, const OffsetView& y) {
00298 return same(x.base(),y.base()) && (x.offset() == y.offset());
00299 }
00300 forceinline bool
00301 before(const OffsetView& x, const OffsetView& y) {
00302 return before(x.base(),y.base())
00303 || (same(x.base(),y.base()) && (x.offset() < y.offset()));
00304 }
00305
00306 }}
00307
00308
00309