* \brief Offset integer view * * An offset integer view \f$o\f$ for an integer view \f$x\f$ and * an integer \f$c\f$ provides operations such that \f$o\f$ * behaves as \f$x+c\f$. * \ingroup TaskActorIntView */
| 441 | * \ingroup TaskActorIntView |
| 442 | */ |
| 443 | class OffsetView : public DerivedView<IntView> { |
| 444 | protected: |
| 445 | /// Offset |
| 446 | int c; |
| 447 | using DerivedView<IntView>::x; |
| 448 | public: |
| 449 | /// \name Constructors and initialization |
| 450 | //@{ |
| 451 | /// Default constructor |
| 452 | OffsetView(void); |
| 453 | /// Initialize with integer view \a y and offset \a c |
| 454 | OffsetView(const IntView& y, int c); |
| 455 | //@} |
| 456 | |
| 457 | /// \name Value access |
| 458 | //@{ |
| 459 | /// Return offset |
| 460 | int offset(void) const; |
| 461 | /// Change offset to \a n |
| 462 | void offset(int n); |
| 463 | /// Return minimum of domain |
| 464 | int min(void) const; |
| 465 | /// Return maximum of domain |
| 466 | int max(void) const; |
| 467 | /// Return median of domain (greatest element not greater than the median) |
| 468 | int med(void) const; |
| 469 | /// Return assigned value (only if assigned) |
| 470 | int val(void) const; |
| 471 | #ifdef GECODE_HAS_CBS |
| 472 | /// Return reverse transformation of value according to view |
| 473 | int baseval(int val) const; |
| 474 | #endif |
| 475 | |
| 476 | /// Return size (cardinality) of domain |
| 477 | unsigned int size(void) const; |
| 478 | /// Return width of domain (distance between maximum and minimum) |
| 479 | unsigned int width(void) const; |
| 480 | /// Return regret of domain minimum (distance to next larger value) |
| 481 | unsigned int regret_min(void) const; |
| 482 | /// Return regret of domain maximum (distance to next smaller value) |
| 483 | unsigned int regret_max(void) const; |
| 484 | //@} |
| 485 | |
| 486 | /// \name Domain tests |
| 487 | //@{ |
| 488 | /// Test whether domain is a range |
| 489 | bool range(void) const; |
| 490 | |
| 491 | /// Test whether \a n is contained in domain |
| 492 | bool in(int n) const; |
| 493 | /// Test whether \a n is contained in domain |
| 494 | bool in(long long int n) const; |
| 495 | //@} |
| 496 | |
| 497 | /// \name Domain update by value |
| 498 | //@{ |
| 499 | /// Restrict domain values to be less or equal than \a n |
| 500 | ModEvent lq(Space& home, int n); |
no outgoing calls
no test coverage detected