Regina Calculation Engine
Public Member Functions | Static Public Attributes | List of all members
regina::NTriBool Class Reference

A three-way extension of the boolean type. More...

#include <utilities/nbooleans.h>

Public Member Functions

 NTriBool ()
 Creates a new three-way boolean initialised to the unknown value. More...
 
 NTriBool (const NTriBool &cloneMe)
 Creates a copy of the given three-way boolean. More...
 
 NTriBool (bool value)
 Creates a new three-way boolean whose initial value is the given standard boolean. More...
 
bool isTrue () const
 Is the value of this three-way boolean equal to true? More...
 
bool isFalse () const
 Is the value of this three-way boolean equal to false? More...
 
bool isUnknown () const
 Is the value of this three-way boolean equal to unknown? More...
 
bool isKnown () const
 Does this three-way boolean take one of the explicit values true or false? More...
 
void setTrue ()
 Sets this three-way boolean to true. More...
 
void setFalse ()
 Sets this three-way boolean to false. More...
 
void setUnknown ()
 Sets this three-way boolean to unknown. More...
 
bool operator== (const NTriBool &other) const
 Determines whether this and the given three-way boolean are equal. More...
 
bool operator== (bool other) const
 Determines whether this and the given standard boolean are equal. More...
 
bool operator!= (const NTriBool &other) const
 Determines whether this and the given three-way boolean are different. More...
 
bool operator!= (bool other) const
 Determines whether this and the given standard boolean are different. More...
 
NTriBooloperator= (const NTriBool &cloneMe)
 Sets this three-way boolean to be identical to the given three-way boolean. More...
 
NTriBooloperator= (bool cloneMe)
 Sets this three-way boolean to be identical to the given standard boolean. More...
 
NTriBooloperator|= (const NTriBool &other)
 Sets this to be the disjunction of this and the given value. More...
 
NTriBooloperator|= (bool other)
 Sets this to be the disjunction of this and the given value. More...
 
NTriBooloperator&= (const NTriBool &other)
 Sets this to be the conjunction of this and the given value. More...
 
NTriBooloperator&= (bool other)
 Sets this to be the conjunction of this and the given value. More...
 
NTriBool operator| (const NTriBool &other) const
 Returns the disjunction of this and the given value. More...
 
NTriBool operator| (bool other) const
 Returns the disjunction of this and the given value. More...
 
NTriBool operator& (const NTriBool &other) const
 Returns the conjunction of this and the given value. More...
 
NTriBool operator& (bool other) const
 Returns the conjunction of this and the given value. More...
 
NTriBool operator~ () const
 Returns the negation of this value. More...
 

Static Public Attributes

static const NTriBool True
 A global instance of the true value. More...
 
static const NTriBool False
 A global instance of the false value. More...
 
static const NTriBool Unknown
 A global instance of the unknown value. More...
 

Detailed Description

A three-way extension of the boolean type.

Three-way booleans can be true, false or unknown.

Deprecated:
NTriBool has now been replaced with native (two-way) bool throughout Regina, and will be removed in some future release.

Constructor & Destructor Documentation

regina::NTriBool::NTriBool ( )
inline

Creates a new three-way boolean initialised to the unknown value.

regina::NTriBool::NTriBool ( const NTriBool cloneMe)
inline

Creates a copy of the given three-way boolean.

Parameters
cloneMethe three-way boolean to clone.
regina::NTriBool::NTriBool ( bool  value)
inline

Creates a new three-way boolean whose initial value is the given standard boolean.

Parameters
valuethe value (true or false) to assign to the new three-way boolean.

Member Function Documentation

bool regina::NTriBool::isFalse ( ) const
inline

Is the value of this three-way boolean equal to false?

Returns
whether or not this object has the value of false.
bool regina::NTriBool::isKnown ( ) const
inline

Does this three-way boolean take one of the explicit values true or false?

Note that this routine is the negation of isUnknown().

Returns
whether or not this object has an explicit true or false value.
bool regina::NTriBool::isTrue ( ) const
inline

Is the value of this three-way boolean equal to true?

Returns
whether or not this object has the value of true.
bool regina::NTriBool::isUnknown ( ) const
inline

Is the value of this three-way boolean equal to unknown?

Returns
whether or not this object has the value of unknown.
bool regina::NTriBool::operator!= ( const NTriBool other) const
inline

Determines whether this and the given three-way boolean are different.

This routine makes a straightforward comparison of states. That is, true is equal to true, false is equal to false and unknown is equal to unknown.

Parameters
otherthe three-way boolean to compare with this.
Returns
true if and only if this and the given value are different.
bool regina::NTriBool::operator!= ( bool  other) const
inline

Determines whether this and the given standard boolean are different.

This routine makes a straightforward comparison of states. That is, true is equal to true and false is equal to false. Unknown is equal to neither true nor false.

Python:
Not present, to avoid accidental integer conversions in Python.
Parameters
otherthe standard boolean to compare with this.
Returns
true if and only if this and the given value are different.
NTriBool regina::NTriBool::operator& ( const NTriBool other) const
inline

Returns the conjunction of this and the given value.

Unknown is handled in the intuitive way. For instance, (unknown and true) is unknown, and (unknown and false) is false.

Parameters
otherthe value to combine with this value.
Returns
the conjunction of this and the given value.
NTriBool regina::NTriBool::operator& ( bool  other) const
inline

Returns the conjunction of this and the given value.

Unknown is handled in the intuitive way. For instance, (unknown and true) is unknown, and (unknown and false) is false.

Python:
Not present, to avoid accidental integer conversions in Python.
Parameters
otherthe value to combine with this value.
Returns
the conjunction of this and the given value.
NTriBool & regina::NTriBool::operator&= ( const NTriBool other)
inline

Sets this to be the conjunction of this and the given value.

Unknown is handled in the intuitive way. For instance, (unknown and true) is unknown, and (unknown and false) is false.

Parameters
otherthe value to combine with this value.
Returns
a reference to this object.
NTriBool & regina::NTriBool::operator&= ( bool  other)
inline

Sets this to be the conjunction of this and the given value.

Unknown is handled in the intuitive way. For instance, (unknown and true) is unknown, and (unknown and false) is false.

Python:
Not present, to avoid accidental integer conversions in Python.
Parameters
otherthe value to combine with this value.
Returns
a reference to this object.
NTriBool & regina::NTriBool::operator= ( const NTriBool cloneMe)
inline

Sets this three-way boolean to be identical to the given three-way boolean.

Parameters
cloneMethe value to assign to this object.
Returns
a reference to this object.
NTriBool & regina::NTriBool::operator= ( bool  cloneMe)
inline

Sets this three-way boolean to be identical to the given standard boolean.

Python:
Not present, to avoid accidental integer conversions in Python.
Parameters
cloneMethe value to assign to this object.
Returns
a reference to this object.
bool regina::NTriBool::operator== ( const NTriBool other) const
inline

Determines whether this and the given three-way boolean are equal.

This routine makes a straightforward comparison of states. That is, true is equal to true, false is equal to false and unknown is equal to unknown.

Parameters
otherthe three-way boolean to compare with this.
Returns
true if and only if this and the given value are equal.
bool regina::NTriBool::operator== ( bool  other) const
inline

Determines whether this and the given standard boolean are equal.

This routine makes a straightforward comparison of states. That is, true is equal to true and false is equal to false. Unknown is equal to neither true nor false.

Python:
Not present, to avoid accidental integer conversions in Python.
Parameters
otherthe standard boolean to compare with this.
Returns
true if and only if this and the given value are equal.
NTriBool regina::NTriBool::operator| ( const NTriBool other) const
inline

Returns the disjunction of this and the given value.

Unknown is handled in the intuitive way. For instance, (unknown or true) is true, and (unknown or false) is unknown.

Parameters
otherthe value to combine with this value.
Returns
the disjunction of this and the given value.
NTriBool regina::NTriBool::operator| ( bool  other) const
inline

Returns the disjunction of this and the given value.

Unknown is handled in the intuitive way. For instance, (unknown or true) is true, and (unknown or false) is unknown.

Python:
Not present, to avoid accidental integer conversions in Python.
Parameters
otherthe value to combine with this value.
Returns
the disjunction of this and the given value.
NTriBool & regina::NTriBool::operator|= ( const NTriBool other)
inline

Sets this to be the disjunction of this and the given value.

Unknown is handled in the intuitive way. For instance, (unknown or true) is true, and (unknown or false) is unknown.

Parameters
otherthe value to combine with this value.
Returns
a reference to this object.
NTriBool & regina::NTriBool::operator|= ( bool  other)
inline

Sets this to be the disjunction of this and the given value.

Unknown is handled in the intuitive way. For instance, (unknown or true) is true, and (unknown or false) is unknown.

Python:
Not present, to avoid accidental integer conversions in Python.
Parameters
otherthe value to combine with this value.
Returns
a reference to this object.
NTriBool regina::NTriBool::operator~ ( ) const
inline

Returns the negation of this value.

The negation of unknown is unknown.

Returns
the negation of this value.
void regina::NTriBool::setFalse ( )
inline

Sets this three-way boolean to false.

void regina::NTriBool::setTrue ( )
inline

Sets this three-way boolean to true.

void regina::NTriBool::setUnknown ( )
inline

Sets this three-way boolean to unknown.

Member Data Documentation

const NTriBool regina::NTriBool::False
static

A global instance of the false value.

const NTriBool regina::NTriBool::True
static

A global instance of the true value.

const NTriBool regina::NTriBool::Unknown
static

A global instance of the unknown value.


The documentation for this class was generated from the following file:

Copyright © 1999-2014, The Regina development team
This software is released under the GNU General Public License, with some additional permissions; see the source code for details.
For further information, or to submit a bug or other problem, please contact Ben Burton (bab@debian.org).