Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

IDEA::PslVariable Class Reference
[PlanServer handle classes]

Interface abstraction for variables. More...

#include <PslVariable.hh>

List of all members.

Public Methods

 ~PslVariable ()
 Destructor, will release the memory allocated for the PslVariableImpl associated with the invoking class.

PslVariableImplgetImpl () const
const PslDatabasegetDatabase () const
int getId () const
 Returns unique identifier of the invoking variable.

bool write (std::string &value) const
bool read (const std::string &value) const
void commit () const
 Commits the current values of the invoking variable. Commit should not be called in a search or a constraint.

const std::string getName () const
void print (std::ostream &) const
 Prints the contents of the variable in an implementation-dependent fashion.

const PslDataType getDataType () const
 Returns the data type of the contents of the variable.

bool isInterval () const
 Returns true if the variable represents a numeric interval.

bool isEmpty () const
 Returns true if the variable is empty, false otherwise.

bool isDynamic () const
 Returns true if the variable is dynamic, false otherwise.

bool isSingleton () const
 Returns true if the variable represents exactly one value, false otherwise.

bool isEnumerated () const
 Returns true if the variable represents an enumeration, false otherwise.

bool isFinite () const
 Returns true if the variable has a finite number of members, false otherwise.

const PslConstraintList getConstraints () const
 Returns all the constraints associated with the invoking variable created by PSL datastructure invocations.

void removeConstraint (const PslConstraint *cnstr) const
 Removes the PslConstraint cnstr from the list of constraints associated with the invoking variable.

int getSize () const
 Returns the number of values in the variable.

template<class Type> Type getSingleton () const
 Returns the single value represented by the variable.

template<class Type> Type getMinimum () const
 Returns the smallest number in the variable.

template<class Type> Type getMaximum () const
 Returns the largest number in the variable.

template<class Type> void setMinimum (Type v) const
template<class Type> void setMaximum (Type v) const
template<class Type> std::set< Type > getMembers () const
 Returns a set of the variable's members.

template<class Type> bool hasMember (const Type val) const
 Returns true if the variable has the argument as a member, false otherwise.

bool hasIntersection (const PslVariable *variable) const
 Retruns true if the invoking variable has a non-empty intersection with variable.

void intersect (const PslVariable *other) const
 Intersects this variable with the other variable.

template<class Type> void setToSingleton (Type newVal) const
 Restricts the variable to be equal to the supplied value.

template<class Type> void setToInterval (Type min, Type max) const
 Restricts the variable to be equal to its intersection with the supplied interval.

template<class Type> void setMembers (const std::set< Type > &newSet) const
 Restricts the variable to be equal to its intersection with the supplied set.

template<class Type> void remove (Type val) const
 Removes the supplied value from the variable.

template<class Type> const PslConstraintconstrainTo (Type val, int authority) const
template<class Type> const PslConstraintconstrainToInterval (Type min, Type max, int authority) const
template<class Type> void insert (Type newVal) const
 Adds the supplied value to the variable.

void reset () const
 Resets the variable to the full variable for its type.

bool conditionallyReset (const IntSet &authorities) const
 Removes and deletes any constraints on the variable matching the given set of authorities, and resets the variable if any are removed. Returns true if any were removed, false otherwise.

void setStatic () const
 Makes the invoking variable static if not already (non-dynamic).


Protected Attributes

PslVariableImplm_Impl
 Pointer to an instance of PslVariableImpl.


Private Methods

 PslVariable (PslVariableImpl *impl)
 Constructor.

 PslVariable (const PslDatabase *database, const PslDomain *domain, const std::string &name)
 Constructor.

 PslVariable ()
 Default constructor, not implemented by design.


Friends

class PslDatabaseImpl


Detailed Description

Interface abstraction for variables.

class PslVariable

This class implements the Abstraction portion of the Bridge design pattern (GoF p. 151). Constructors are public, but dispatch to an abstract factory to construct the implementation object.


Constructor & Destructor Documentation

IDEA::PslVariable::~PslVariable  
 

Destructor, will release the memory allocated for the PslVariableImpl associated with the invoking class.

IDEA::PslVariable::PslVariable PslVariableImpl   impl [private]
 

Constructor.

IDEA::PslVariable::PslVariable const PslDatabase   database,
const PslDomain   domain,
const std::string &    name
[private]
 

Constructor.

IDEA::PslVariable::PslVariable   [private]
 

Default constructor, not implemented by design.


Member Function Documentation

void IDEA::PslVariable::commit  
 

Commits the current values of the invoking variable. Commit should not be called in a search or a constraint.

A variable can be commited multiple times. Once commited previous values of the invoking variable can no longer be retrieved, not by search (backtracking) or anything. An example for using commit is on a variable which represents time. Time will never change back to it's old value.

bool IDEA::PslVariable::conditionallyReset const IntSet   authorities const
 

Removes and deletes any constraints on the variable matching the given set of authorities, and resets the variable if any are removed. Returns true if any were removed, false otherwise.

template<class Type>
const PslConstraint* IDEA::PslVariable::constrainTo Type    val,
int    authority
const [inline]
 

template<class Type>
const PslConstraint* IDEA::PslVariable::constrainToInterval Type    min,
Type    max,
int    authority
const [inline]
 

const PslConstraintList IDEA::PslVariable::getConstraints  
 

Returns all the constraints associated with the invoking variable created by PSL datastructure invocations.

const PslDatabase * IDEA::PslVariable::getDatabase  
 

const PslDataType IDEA::PslVariable::getDataType  
 

Returns the data type of the contents of the variable.

Will return INVALID if the implementation is a null-pointer.

int IDEA::PslVariable::getId  
 

Returns unique identifier of the invoking variable.

PslVariableImpl * IDEA::PslVariable::getImpl  
 

template<class Type>
Type IDEA::PslVariable::getMaximum   const [inline]
 

Returns the largest number in the variable.

Raises PslVariableEmptyError if the variable is empty. Raises PslTypeUnknown if the variable is not numeric.

template<class Type>
std::set<Type> IDEA::PslVariable::getMembers   const [inline]
 

Returns a set of the variable's members.

template<class Type>
Type IDEA::PslVariable::getMinimum   const [inline]
 

Returns the smallest number in the variable.

Raises PslVariableEmptyError if the variable is emptyl raises PslTypeUnknown if the variable is not numeric.

const std::string IDEA::PslVariable::getName  
 

template<class Type>
Type IDEA::PslVariable::getSingleton   const [inline]
 

Returns the single value represented by the variable.

int IDEA::PslVariable::getSize  
 

Returns the number of values in the variable.

bool IDEA::PslVariable::hasIntersection const PslVariable *    variable const
 

Retruns true if the invoking variable has a non-empty intersection with variable.

template<class Type>
bool IDEA::PslVariable::hasMember const Type    val const [inline]
 

Returns true if the variable has the argument as a member, false otherwise.

template<class Type>
void IDEA::PslVariable::insert Type    newVal const [inline]
 

Adds the supplied value to the variable.

void IDEA::PslVariable::intersect const PslVariable *    other const
 

Intersects this variable with the other variable.

bool IDEA::PslVariable::isDynamic  
 

Returns true if the variable is dynamic, false otherwise.

A dynamic variable is an enumerated variable for which not all the enumerations have been defined yet.

bool IDEA::PslVariable::isEmpty  
 

Returns true if the variable is empty, false otherwise.

Also note that when called on invalid ( PslVariable::isValid() == false ) variables, will return false.

bool IDEA::PslVariable::isEnumerated  
 

Returns true if the variable represents an enumeration, false otherwise.

bool IDEA::PslVariable::isFinite  
 

Returns true if the variable has a finite number of members, false otherwise.

bool IDEA::PslVariable::isInterval  
 

Returns true if the variable represents a numeric interval.

bool IDEA::PslVariable::isSingleton  
 

Returns true if the variable represents exactly one value, false otherwise.

void IDEA::PslVariable::print std::ostream &    const
 

Prints the contents of the variable in an implementation-dependent fashion.

bool IDEA::PslVariable::read const std::string &    value const
 

template<class Type>
void IDEA::PslVariable::remove Type    val const [inline]
 

Removes the supplied value from the variable.

void IDEA::PslVariable::removeConstraint const PslConstraint   cnstr const
 

Removes the PslConstraint cnstr from the list of constraints associated with the invoking variable.

Will error out if the constraint is active or if the constraint is not associated with the invoking variable.

void IDEA::PslVariable::reset  
 

Resets the variable to the full variable for its type.

  • In case type is PslLabel the full variable is equal to getLabelSet
  • In case of a numerical value it is the largest possible variable for the type
  • In case of user-defined type....

template<class Type>
void IDEA::PslVariable::setMaximum Type    v const [inline]
 

template<class Type>
void IDEA::PslVariable::setMembers const std::set< Type > &    newSet const [inline]
 

Restricts the variable to be equal to its intersection with the supplied set.

template<class Type>
void IDEA::PslVariable::setMinimum Type    v const [inline]
 

void IDEA::PslVariable::setStatic  
 

Makes the invoking variable static if not already (non-dynamic).

template<class Type>
void IDEA::PslVariable::setToInterval Type    min,
Type    max
const [inline]
 

Restricts the variable to be equal to its intersection with the supplied interval.

template<class Type>
void IDEA::PslVariable::setToSingleton Type    newVal const [inline]
 

Restricts the variable to be equal to the supplied value.

bool IDEA::PslVariable::write std::string &    value const
 


Friends And Related Function Documentation

friend class PslDatabaseImpl [friend]
 


Member Data Documentation

PslVariableImpl* IDEA::PslVariable::m_Impl [protected]
 

Pointer to an instance of PslVariableImpl.

Implementation objects all inherit from the abstract class IDEA::PslVariableImpl.


Contact information
© IDEA
Generated on Fri Feb 3 17:09:48 2006 for IDEA.