Mantid
|
Tri-state variable. More...
#include <BnId.h>
Public Member Functions | |
BnId () | |
Standard Constructor. More... | |
BnId (const size_t, unsigned int) | |
Constructer that creates a true/false mapping without the undetermined option. More... | |
std::string | display () const |
Displays the value as a string. More... | |
int | equivalent (const BnId &) const |
Equal but - is assume to be ok. More... | |
size_t | expressCount () const |
Total requiring expression. More... | |
int | intValue () const |
Integer from binary expression. More... | |
std::pair< int, BnId > | makeCombination (const BnId &) const |
Find if A and this can be differ by one 1/-1 bit and make a 0 value for that bit. More... | |
void | mapState (const std::vector< int > &, std::map< int, int > &) const |
Sets the components within base with true/false. More... | |
int | operator++ () |
addition operator (returns !carry flag) More... | |
int | operator++ (int) |
addition operator (returns !carry flag) More... | |
int | operator-- () |
subtraction operator (returns !carry flag) More... | |
int | operator-- (int) |
subtraction operator (returns !carry flag) More... | |
bool | operator< (const BnId &) const |
operator> for tri-state object More... | |
bool | operator== (const BnId &) const |
Equals operator for tri-state object. More... | |
bool | operator> (const BnId &) const |
operator> for tri-state object More... | |
int | operator[] (int const) const |
Access operator. More... | |
int | PIstatus () const |
PI accessor. More... | |
void | reverse () |
Swap -1 to 1 adn leaver the zeros. More... | |
void | setPI (const int A) |
PI accessor. More... | |
size_t | Size () const |
returns number of variables / size More... | |
int | TrueCount () const |
Access true count. More... | |
void | write (std::ostream &) const |
writes the value to a stream More... | |
Private Member Functions | |
void | setCounters () |
Calculates Tnum and Znum. More... | |
Private Attributes | |
int | PI |
Prime Implicant. More... | |
size_t | size |
number of variables More... | |
int | Tnum |
True number (1 in Tval) More... | |
std::vector< int > | Tval |
Truth values. More... | |
int | Znum |
Zero number (0 in Tval) More... | |
Tri-state variable.
This class holds a tri-state variable of -1 (false) 0 (not-important) 1 (true) against each of the possible input desisions. It has arbitrary lenght (unlike using a long integer)
Mantid::Geometry::BnId::BnId | ( | const size_t | A, |
unsigned int | X | ||
) |
std::string Mantid::Geometry::BnId::display | ( | ) | const |
int Mantid::Geometry::BnId::equivalent | ( | const BnId & | A | ) | const |
|
inline |
int Mantid::Geometry::BnId::intValue | ( | ) | const |
Find if A and this can be differ by one 1/-1 bit and make a 0 value for that bit.
A | :: value to check Output
|
Definition at line 260 of file BnId.cpp.
References setCounters(), and Tval.
void Mantid::Geometry::BnId::mapState | ( | const std::vector< int > & | Index, |
std::map< int, int > & | Base | ||
) | const |
Sets the components within base with true/false.
Index | :: vector of Literal/Surface numbers |
Base | :: map to be filled |
Definition at line 247 of file BnId.cpp.
Referenced by Mantid::Geometry::Acomp::getCNFobject(), Mantid::Geometry::Acomp::getDNFobject(), and Mantid::Geometry::Acomp::logicalEqual().
int Mantid::Geometry::BnId::operator++ | ( | ) |
addition operator (returns !carry flag)
Addition operator Carrys out a rotational addition (effective binary addition.
It ignores non-important flags (Tval[i]==0)
0 | :: the function has looped (carry flag) |
1 | :: no loop occored |
Definition at line 157 of file BnId.cpp.
Referenced by operator++().
int Mantid::Geometry::BnId::operator++ | ( | int | ) |
addition operator (returns !carry flag)
convertion to ++operator (prefix) from operator++ (postfix)
0 | :: the function has looped (carry flag) |
1 | :: no loop occored |
Definition at line 146 of file BnId.cpp.
References operator++().
int Mantid::Geometry::BnId::operator-- | ( | ) |
subtraction operator (returns !carry flag)
Subtraction operator Carrys out a rotational subtraction (effective binary addition.
It ignores non-important flags (Tval[i]==0)
0 | :: the function has looped (carry flag) |
1 | :: no loop occored |
Definition at line 192 of file BnId.cpp.
Referenced by operator--().
int Mantid::Geometry::BnId::operator-- | ( | int | ) |
subtraction operator (returns !carry flag)
Convertion to –operator (prefix) from operator-- (postfix)
0 | :: the function has looped (carry flag) |
1 | :: no loop occored |
Definition at line 181 of file BnId.cpp.
References operator--().
bool Mantid::Geometry::BnId::operator< | ( | const BnId & | A | ) | const |
bool Mantid::Geometry::BnId::operator== | ( | const BnId & | A | ) | const |
bool Mantid::Geometry::BnId::operator> | ( | const BnId & | A | ) | const |
int Mantid::Geometry::BnId::operator[] | ( | int const | A | ) | const |
|
inline |
void Mantid::Geometry::BnId::reverse | ( | ) |
Swap -1 to 1 adn leaver the zeros.
Reverset the bits.
Transform 1 -> -1
Definition at line 312 of file BnId.cpp.
References setCounters(), and Tval.
|
private |
|
inline |
|
inline |
returns number of variables / size
Definition at line 71 of file BnId.h.
Referenced by Mantid::Geometry::Acomp::addUnit().
|
inline |
void Mantid::Geometry::BnId::write | ( | std::ostream & | os | ) | const |
|
private |
|
private |
True number (1 in Tval)
Definition at line 41 of file BnId.h.
Referenced by BnId(), display(), operator++(), operator--(), and setCounters().
|
private |
Truth values.
Definition at line 43 of file BnId.h.
Referenced by BnId(), display(), intValue(), makeCombination(), operator++(), operator--(), reverse(), and setCounters().
|
private |
Zero number (0 in Tval)
Definition at line 42 of file BnId.h.
Referenced by display(), and setCounters().