This class represents a choice between multiple operations. The alternates are sorted in order of priority. More...
#include <model.h>
Public Types | |
typedef pair< int, DateRange > | alternateProperty |
Public Member Functions | |
void | addAlternate (Operation *, int=1, DateRange=DateRange()) |
void | beginElement (XMLInput &, const Attribute &) |
virtual OperationPlan * | createOperationPlan (double, Date, Date, Demand *=NULL, OperationPlan *=NULL, unsigned long=0, bool makeflowsloads=true) const |
void | endElement (XMLInput &, const Attribute &, const DataElement &) |
const alternateProperty & | getProperties (Operation *o) const |
virtual size_t | getSize () const |
virtual const Operationlist & | getSubOperations () const |
virtual const MetaClass & | getType () const |
OperationAlternate (const string &c) | |
void | removeSubOperation (Operation *) |
void | setEffective (Operation *, DateRange) |
void | setOperationPlanParameters (OperationPlan *, double, Date, Date, bool=true) const |
void | setPriority (Operation *, int) |
void | setProperties (Operation *, int, DateRange) |
virtual void | solve (Solver &s, void *v=NULL) const |
void | writeElement (XMLOutput *, const Keyword &, mode=DEFAULT) const |
~OperationAlternate () | |
Static Public Attributes | |
static const MetaClass * | metadata |
This class represents a choice between multiple operations. The alternates are sorted in order of priority.
Definition at line 2485 of file model.h.
typedef pair<int,DateRange> frepple::OperationAlternate::alternateProperty |
frepple::OperationAlternate::OperationAlternate | ( | const string & | c | ) | [inline, explicit] |
frepple::OperationAlternate::~OperationAlternate | ( | ) |
Destructor.
Definition at line 77 of file operation.cpp.
void frepple::OperationAlternate::addAlternate | ( | Operation * | o, | |
int | prio = 1 , |
|||
DateRange | eff = DateRange() | |||
) |
Add a new alternate operation.
The lower the priority value, the more important this alternate operation is.
Definition at line 837 of file operation.cpp.
Called while restoring the model from an XML-file.
This is called for each element within the "this" element, for which the "this" element is immediate parent.
It is called when the open element tag is encountered.
Reimplemented from frepple::Operation.
Definition at line 949 of file operation.cpp.
OperationPlan * frepple::OperationAlternate::createOperationPlan | ( | double | q, | |
Date | s, | |||
Date | e, | |||
Demand * | l = NULL , |
|||
OperationPlan * | ow = NULL , |
|||
unsigned long | i = 0 , |
|||
bool | makeflowsloads = true | |||
) | const [virtual] |
This is the factory method which creates all operationplans of the operation.
Reimplemented from frepple::Operation.
Definition at line 996 of file operation.cpp.
void frepple::OperationAlternate::endElement | ( | XMLInput & | , | |
const Attribute & | , | |||
const DataElement & | ||||
) | [virtual] |
Called while restoring the model from an XML-file.
This is called when the corresponding close element tag is encountered, and the Data() member of pElement is valid.
Reimplemented from frepple::Operation.
Definition at line 958 of file operation.cpp.
const OperationAlternate::alternateProperty & frepple::OperationAlternate::getProperties | ( | Operation * | o | ) | const |
Returns the properties of a certain suboperation.
LogicException | Generated when the argument operation is null or when it is not a sub-operation of this alternate. |
Definition at line 854 of file operation.cpp.
virtual size_t frepple::OperationAlternate::getSize | ( | ) | const [inline, virtual] |
Return the memory size of the object in bytes.
Implements frepple::utils::Object.
virtual const Operationlist& frepple::OperationAlternate::getSubOperations | ( | ) | const [inline, virtual] |
Returns a reference to the list of sub operations of this operation.
Reimplemented from frepple::Operation.
virtual const MetaClass& frepple::OperationAlternate::getType | ( | ) | const [inline, virtual] |
This returns the type information on the object, a bit similar to the standard type_info information.
Implements frepple::utils::Object.
void frepple::OperationAlternate::removeSubOperation | ( | Operation * | o | ) |
Removes an alternate from the list.
Definition at line 1033 of file operation.cpp.
Updates the effective daterange of a certain suboperation.
LogicException | Generated when the argument operation is not null and not a sub-operation of this alternate. |
Definition at line 890 of file operation.cpp.
void frepple::OperationAlternate::setOperationPlanParameters | ( | OperationPlan * | oplan, | |
double | q, | |||
Date | s, | |||
Date | e, | |||
bool | preferEnd = true | |||
) | const [virtual] |
A operation of this type enforces the following rules on its operationplans:
Implements frepple::Operation.
Definition at line 1010 of file operation.cpp.
void frepple::OperationAlternate::setPriority | ( | Operation * | o, | |
int | f | |||
) |
Updates the priority of a certain suboperation.
LogicException | Generated when the argument operation is not null and not a sub-operation of this alternate. |
Definition at line 872 of file operation.cpp.
Updates the properties of a certain suboperation.
LogicException | Generated when the argument operation is not null and not a sub-operation of this alternate. |
virtual void frepple::OperationAlternate::solve | ( | Solver & | s, | |
void * | v = NULL | |||
) | const [inline, virtual] |
This method is called by solver classes. The implementation of this class simply calls the solve method on the solver class. Using the polymorphism the solver can implement seperate methods for different plannable subclasses.
Reimplemented from frepple::Operation.
void frepple::OperationAlternate::writeElement | ( | XMLOutput * | , | |
const Keyword & | , | |||
mode | = DEFAULT | |||
) | const [virtual] |
Called while writing the model into an XML-file. The user class should write itself out, using the IOutStream members for its "simple" members and calling writeElement recursively for any contained objects. Not all classes are expected to implement this method. In instances of such a class can be created but can't be persisted. E.g. Command
Reimplemented from frepple::Operation.
Definition at line 909 of file operation.cpp.
const MetaClass * frepple::OperationAlternate::metadata [static] |
Reimplemented from frepple::Operation.