- Main Page
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# Mers::Models::Base::BaseModelAssignment Class Reference

`#include <BaseModelAssignment.h>`

Inheritance diagram for Mers::Models::Base::BaseModelAssignment:

[legend]
Collaboration diagram for Mers::Models::Base::BaseModelAssignment:

[legend]
List of all members.

## Public Types
enum | OperatorType { Positive = 0, EqualTo = Positive, POSITIVE = Positive, Negative = 1, NotEqualTo = Negative, NEGATIVE = Negative, GreaterThan = 2, GreaterThanOrEqualTo = 3, LessThan = 4, LessThanOrEqualTo = 5 }
## Public Member Functions
| BaseModelAssignment (BaseModelVariable const *myVariable, BaseModelValue const *myValue, OperatorType myOpType=Positive)
| BaseModelAssignment (BaseModelAssignment const &other)
virtual | ~BaseModelAssignment ()
BaseModelVariable const * | getVariable () const
BaseModelValue const * | getValue () const
OperatorType | getOperator () const
bool | assignmentHolds (BaseModelValue const &variableValue) const
bool | assignmentHolds (double variableValue) const
BaseModelAssignment const & | operator= (BaseModelAssignment const &other)
virtual bool | operator== (BaseModelAssignment const &other) const
virtual bool | operator!= (BaseModelAssignment const &other) const
virtual void | print (std::ostream &out) const
## Static Public Member Functions
static char const * | operatorToSymbolString (OperatorType op)
static OperatorType | symbolStringToOperator (char const *op)
## Protected Member Functions
virtual void | destroy ()
virtual int | copy (BaseModelAssignment const &other)
## Protected Attributes
OperatorType | operatorType
BaseModelVariable const * | variable
| The variable of this assignment.
BaseModelValue const * | value
| The value of this assignment.

## Detailed Description

Defines a basic assigment class that records an assignment between a variable and a value. This also includes what was refered to as a "literal". The assignments here can be positive, negative, greaterThan, lessThan, greaterThanOrEqualTo, or lessThanOrEqualTo. The last 5 types of assignments will generally only be valid if the assignments are being used as a query.

Definition at line 38 of file BaseModelAssignment.h.

## Member Enumeration Documentation

enum Mers::Models::Base::BaseModelAssignment::OperatorType

The relationship that holds between the variable and value in this assignment.

Definition at line 45 of file BaseModelAssignment.h.

## Constructor & Destructor Documentation

BaseModelAssignment::BaseModelAssignment | ( | BaseModelVariable const * | myVariable,
|  | BaseModelValue const * | myValue,
|  | OperatorType | myOpType = `Positive` |
| ) |  |  |

Creates an assignment between a variable and a value from the variable's domain The assignment may be positive or negative. If positive is true, then it implies that (variable = value) and if positive is false, then it implies that (variable != value) or, equivalently, (not (variable = value)).

Parameters:

  | myVariable | the variable of the assignment.
  | myValue | the value of the assignment.
  | myOpType | the operator of this assignment

Definition at line 31 of file BaseModelAssignment.cpp.

References Mers::Models::Base::BaseModelValue::getDomain(), Mers::Models::Base::BaseModelVariable::getDomain(), value, and variable.

Here is the call graph for this function:

BaseModelAssignment::BaseModelAssignment | ( | BaseModelAssignment const & | other | ) |

Creates a new assignment by copying the contents of the old assignment.

Parameters:

  | other | the BaseModelAssignment from which the data for this assignment is copied

Definition at line 42 of file BaseModelAssignment.cpp.

References operatorType, value, and variable.

BaseModelAssignment::~BaseModelAssignment | ( |  | ) | `[virtual]`

Destroys the contents of this assignment.

Definition at line 52 of file BaseModelAssignment.cpp.

References destroy().

Here is the call graph for this function:

## Member Function Documentation

char const * BaseModelAssignment::operatorToSymbolString | ( | OperatorType | op | ) | `[static]`

Returns the equivalent infix math/C++ symbol for the specified operator type.

Parameters:

  | op | the operator being converted into a string.

Returns:
  the string representation of the infix operator.

Definition at line 59 of file BaseModelAssignment.cpp.

Referenced by Mers::Models::CCA::Io::Mof::MOFReader::writeTextConstraint().

BaseModelAssignment::OperatorType BaseModelAssignment::symbolStringToOperator | ( | char const * | op | ) | `[static]`

Returns the OperatorType enumerated type equivalent to the infix math/C++ symbol specified. This is the inverse of operatorToSymbolString.

Parameters:

  | op | the operator being converted from a string.

Returns:
  the operator representation of the infix operator.

Exceptions:

  | RuntimeException | if the op was not a recognized operator.

Definition at line 82 of file BaseModelAssignment.cpp.

BaseModelVariable const * BaseModelAssignment::getVariable | ( |  | ) | const

Returns the variable of this assignment.

Returns:
  a handle to this objects internal variable object.

Reimplemented in Mers::Generators::BFIG::BFIGAssignment.

Definition at line 117 of file BaseModelAssignment.cpp.

References variable.

Referenced by Mers::Estimation::Discrete::Estimate::addAssignment(), Mers::Estimation::Discrete::ModeEstimation::ModeEstimator::addGuardAssign(), Mers::Estimation::Discrete::CompiledTransition::CompiledTransition(), Mers::Solvers::SAT::ValidSAT::VSATNode::evaluate(), Mers::Models::CCA::CCAModel::get_state_p(), Mers::Estimation::Discrete::CompiledTransition::getAntecedentVariableUID(), Mers::Estimation::Discrete::ModeEstimationPerformance::MEPerformanceMonitor::getEstimateFaultTransitions(), Mers::Models::CCA::CCAModel::is_valid(), Mers::Executives::DeductiveController::DCInterface::loadInitialState(), Mers::Solvers::SAT::ISAT::ISATBaseModelAssignmentDescription::operator==(), Mers::Solvers::SAT::ISAT::ISATBaseModelAssignmentDescription::print(), Mers::Solvers::SAT::ValidSAT::VSATNode::propagate(), Mers::Models::CCA::CCAModel::set_state_constraint(), Mers::Models::CCA::CCAAutomata::set_state_constraint(), Mers::Models::CCA::CCAModel::set_state_type(), Mers::Models::CCA::CCAAutomata::set_state_type(), Mers::Models::CCA::CCAModel::state_p(), Mers::Models::CCA::Io::Mof::MOFReader::writeAssignment(), and Mers::Models::CCA::Io::Mof::MOFReader::writeTextConstraint().

BaseModelValue const * BaseModelAssignment::getValue | ( |  | ) | const

Returns the value of this assignment.

Returns:
  a handle to this objects internal value object.

Reimplemented in Mers::Generators::BFIG::BFIGAssignment.

Definition at line 124 of file BaseModelAssignment.cpp.

References value.

Referenced by Mers::Estimation::Discrete::ModeEstimation::ModeEstimator::addGuardAssign(), Mers::Models::CCA::CCAModel::get_state_p(), Mers::Estimation::Discrete::CompiledTransition::getAntecedentValueUID(), Mers::Estimation::Discrete::ModeEstimationPerformance::MEPerformanceMonitor::getEstimateFaultTransitions(), Mers::Models::CCA::CCAModel::is_valid(), Mers::Executives::DeductiveController::DCInterface::loadInitialState(), Mers::Solvers::SAT::ISAT::ISATBaseModelAssignmentDescription::operator==(), Mers::Solvers::SAT::ISAT::ISATBaseModelAssignmentDescription::print(), Mers::Solvers::SAT::ValidSAT::VSATNode::propagate(), Mers::Models::CCA::CCAAutomata::set_state_constraint(), Mers::Models::CCA::CCAAutomata::set_state_type(), Mers::Models::CCA::CCAModel::state_p(), Mers::Models::CCA::Io::Mof::MOFReader::writeAssignment(), and Mers::Models::CCA::Io::Mof::MOFReader::writeTextConstraint().

BaseModelAssignment::OperatorType BaseModelAssignment::getOperator | ( |  | ) | const

Returns the operator type of this assignment: Positive: (variable = value) Negative: (variable != value), (not (variable = value)) GreaterThan: (variable > value) GreaterThanOrEqualTo: (variable >= value), (not (variable < value)) LessThan: (variable < value) LessThanOrEqualTo, (variable <= value), (not (variable > value))

Returns:
  the operator type of this assignment

Definition at line 131 of file BaseModelAssignment.cpp.

References operatorType.

Referenced by Mers::Estimation::Discrete::ModeEstimation::ModeEstimator::addGuardAssign(), Mers::Solvers::SAT::ValidSAT::VSATNode::evaluate(), Mers::Models::CCA::Io::Mof::MOFReader::writeAssignment(), and Mers::Models::CCA::Io::Mof::MOFReader::writeTextConstraint().

bool BaseModelAssignment::assignmentHolds | ( | BaseModelValue const & | variableValue | ) | const

Returns true if the value, when substitued for the variable in this assignment, makes the operator relationship true. For example, if this assignment represented (Time < 3) and we input the value 2, then this function would return true because (2 < 3) is true, and if we input the value 3, then this function would return false because (3 < 3) is false.

Parameters:

  | variableValue | the value to use for the variable. This is used to check the current assignment's truth.

Returns:
  true if (variableValue <operatorType> value) is true.

Definition at line 138 of file BaseModelAssignment.cpp.

References operatorType, and value.

bool BaseModelAssignment::assignmentHolds | ( | double | variableValue | ) | const

Returns true if the value, when substitued for the variable in this assignment, makes the operator relationship true. For example, if this assignment represented (Time < 3) and we input the value 2, then this function would return true because (2 < 3) is true, and if we input the value 3, then this function would return false because (3 < 3) is false.

Parameters:

  | variableValue | the value to use for the variable. This is used to check the current assignment's truth.

Returns:
  true if (variableValue <operatorType> value) is true.

Definition at line 162 of file BaseModelAssignment.cpp.

References Mers::Models::Base::BaseModelValue::getDouble(), operatorType, and value.

Here is the call graph for this function:

BaseModelAssignment const & BaseModelAssignment::operator= | ( | BaseModelAssignment const & | other | ) |

Copies the contents of the other object to this object. The contents of this object are destroyed in the copy process.

Parameters:

  | other | the object being copied to this object.

Returns:
  the other object.

Definition at line 186 of file BaseModelAssignment.cpp.

References copy().

Here is the call graph for this function:

bool BaseModelAssignment::operator== | ( | BaseModelAssignment const & | other | ) | const`[virtual]`

Returns true if this object and the other object are both the same assignment the assignments are the same if the have the same variable, value, and sign.

Parameters:

  | other | the object being compared to this object.

Returns:
  true if they are equivalent, otherwise false.

Definition at line 194 of file BaseModelAssignment.cpp.

References operatorType, value, and variable.

Referenced by operator!=().

bool BaseModelAssignment::operator!= | ( | BaseModelAssignment const & | other | ) | const`[virtual]`

Returns false if this object and the other object are both the same assignment the assignments are the same if the have the same variable, value, and sign.

Parameters:

  | other | the object being compared to this object.

Returns:
  false if they are equivalent, otherwise true.

Definition at line 207 of file BaseModelAssignment.cpp.

References operator==().

Here is the call graph for this function:

void BaseModelAssignment::print | ( | std::ostream & | out | ) | const`[virtual]`

Prints the contents of this assignment to the ostream out Derived classes should overide this function to change printing behavior.

Parameters:

  | out | all the data from this object is printed to this ostream object.

Implements Mers::Utils::Lang::BaseModelObject.

Definition at line 216 of file BaseModelAssignment.cpp.

References Mers::Models::Base::BaseModelValue::getName(), Mers::Models::Base::BaseModelVariable::getName(), operatorType, value, and variable.

Here is the call graph for this function:

void BaseModelAssignment::destroy | ( |  | ) | `[protected, virtual]`

Called to destroy the information in this Assignment object and make it suitable for deletion, loading new data or copying new data Derived classes should ensure this function is also called: BaseModelAssignment::destroy()

Definition at line 263 of file BaseModelAssignment.cpp.

References value, and variable.

Referenced by ~BaseModelAssignment().

int BaseModelAssignment::copy | ( | BaseModelAssignment const & | other | ) | `[protected, virtual]`

copies the contents of the other object to this object Derived classes that define this function should ensure that this function is also called: BaseModelAssignment::copy(other).

Parameters:

  | other | the assignment being copied to this assignment.

Returns:
  0 on success or a positive number if there was insufficient memory to copy the assignment.

Definition at line 272 of file BaseModelAssignment.cpp.

References operatorType, value, and variable.

Referenced by operator=().

## Member Data Documentation

OperatorType Mers::Models::Base::BaseModelAssignment::operatorType`[protected]`

The operator of this object. This specifies the relationship between the variable and value.

Definition at line 253 of file BaseModelAssignment.h.

Referenced by assignmentHolds(), BaseModelAssignment(), copy(), getOperator(), operator==(), and print().

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

- /Users/fpy/titan-1-5-MBARI/Mers/Models/Base/BaseModelAssignment.h
- /Users/fpy/titan-1-5-MBARI/Mers/Models/Base/BaseModelAssignment.cpp