* \brief Boolean view for Boolean variables * * Provides convenient and efficient operations for Boolean views. * \ingroup TaskActorIntView */
| 1378 | * \ingroup TaskActorIntView |
| 1379 | */ |
| 1380 | class BoolView : public VarImpView<BoolVar> { |
| 1381 | protected: |
| 1382 | using VarImpView<BoolVar>::x; |
| 1383 | public: |
| 1384 | /// \name Constructors and initialization |
| 1385 | //@{ |
| 1386 | /// Default constructor |
| 1387 | BoolView(void); |
| 1388 | /// Initialize from Boolean variable \a y |
| 1389 | BoolView(const BoolVar& y); |
| 1390 | /// Initialize from Boolean variable implementation \a y |
| 1391 | BoolView(BoolVarImp* y); |
| 1392 | //@} |
| 1393 | |
| 1394 | /// \name Domain status access |
| 1395 | //@{ |
| 1396 | /// How many bits does the status have |
| 1397 | static const int BITS = BoolVarImp::BITS; |
| 1398 | /// Status of domain assigned to zero |
| 1399 | static const BoolStatus ZERO = BoolVarImp::ZERO; |
| 1400 | /// Status of domain assigned to one |
| 1401 | static const BoolStatus ONE = BoolVarImp::ONE; |
| 1402 | /// Status of domain not yet assigned |
| 1403 | static const BoolStatus NONE = BoolVarImp::NONE; |
| 1404 | /// Return current domain status |
| 1405 | BoolStatus status(void) const; |
| 1406 | //@} |
| 1407 | |
| 1408 | /// \name Value access |
| 1409 | //@{ |
| 1410 | /// Return minimum of domain |
| 1411 | int min(void) const; |
| 1412 | /// Return maximum of domain |
| 1413 | int max(void) const; |
| 1414 | /// Return median of domain (greatest element not greater than the median) |
| 1415 | int med(void) const; |
| 1416 | /// Return assigned value (only if assigned) |
| 1417 | int val(void) const; |
| 1418 | #ifdef GECODE_HAS_CBS |
| 1419 | /// Return reverse transformation of value according to view |
| 1420 | int baseval(int val) const; |
| 1421 | #endif |
| 1422 | |
| 1423 | /// Return size (cardinality) of domain |
| 1424 | unsigned int size(void) const; |
| 1425 | /// Return width of domain (distance between maximum and minimum) |
| 1426 | unsigned int width(void) const; |
| 1427 | /// Return regret of domain minimum (distance to next larger value) |
| 1428 | unsigned int regret_min(void) const; |
| 1429 | /// Return regret of domain maximum (distance to next smaller value) |
| 1430 | unsigned int regret_max(void) const; |
| 1431 | //@} |
| 1432 | |
| 1433 | /// \name Domain tests |
| 1434 | //@{ |
| 1435 | /// Test whether domain is a range |
| 1436 | bool range(void) const; |
| 1437 | /// Test whether \a n is contained in domain |