This package contains the commands.
extends OpenCAGE.Controller.Command.Command
Implementation of all operations and attributes Command subclasses have in common.
private OpenCAGE.Controller.Command.Command_State State |
Stores the current state of the Command object.
private FET.Parameter_Pot Param_Pot |
The Param_Pot stores the parameter necessary for the execution of the Command.
private OpenCAGE.Data.Data Oc_Data |
This object holds all data for one instance of OpenCAGE (actual model, lists of command factories, ...)
private OpenCAGE.Controller.Command.Command_Observers_Lists.List Observer_List |
This object holds all observers attached to the command
public FET.Data_Gate Data_Gate |
The Data_Gate where the Command registers its Parameter Pot to.
Executes the Command. May raise Illegal_State_Exception if precondition is not met, i.e. if the state is not "Collect_Data, Done". [This description is adopted from 'OpenCAGE.Controller.Command.Command'.]
Precondition: Collect_Data has been performed before and Execute is called the first time. [This precondition is adopted from 'OpenCAGE.Controller.Command.Command'.]
Collects the data. It simply calls Start_Collect_Data, Do_Collect_Data and End_Collect_Data.
Precondition: Initialization completed and Collect_Data was not called before. [This precondition is adopted from 'OpenCAGE.Controller.Command.Command'.]
Postcondition: The Command knows the data necessary for its execution. [This postcondition is adopted from 'OpenCAGE.Controller.Command.Command'.]
Registers a Command_Observer at a the Command. The register observer will be notified whenever the state of the Command object changes. [This description is adopted from 'OpenCAGE.Controller.Command.Command'.]
Postcondition: The Command_Observer is registered. [This postcondition is adopted from 'OpenCAGE.Controller.Command.Command'.]
Returns a string that tells what the Command does in a human readable format. This operation is used for debugging. [This description is adopted from 'OpenCAGE.Controller.Command.Command'.]
Returns the name of the Command. This operation is used for writing the script. [This description is adopted from 'OpenCAGE.Controller.Command.Command'.]
Sets the attribute Oc_Data to the given value.
Sets the attribute Param_Pot to the given value.
Ends the initialization.
Starts collecting data.
Ends collecting data. If there was an error, specify this as parameter.
Does the data collection by sending the gate a distribute message.
Starts the execution.
Ends the execution. If there was an error, specify this as parameter.
Notifies the observers.
True, when the state is Cancelled_By_User, False, else.
True, when the state is Cancelled_By_Error, False, else.
extends OpenCAGE.Controller.Command.Command_Factory
private OpenCAGE.Data.Data Oc_Data |
This object holds all data for one instance of OpenCAGE (actual model, lists of command factories, ...)
Creates a new command object and initializes it with the given data source. The factory may add other data sources (e.g. dialogs) to the command. The factory may (but is not required to) check if the given data source contains all data required. It is recommanded to first check with Can_Excecute if the created command will get all data required. [This description is adopted from 'OpenCAGE.Controller.Command.Command_Factory'.]
Returns the name of the command this factory creates. [This description is adopted from 'OpenCAGE.Controller.Command.Command_Factory'.]
Postcondition: Nothing is changed. [This postcondition is adopted from 'OpenCAGE.Controller.Command.Command_Factory'.]
Sets the attribute Oc_Data to the given value.
Computes all necessary conditions and tells whether the Command is executable or not. Probably the Command_Factory needs a data_source first. [This description is adopted from 'OpenCAGE.Controller.Command.Command_Factory'.]
Builds the Data Gate from the given Data Source and returns it.
throws Illegal_State_Exception .
This is the interface all Commands have to implement. A Command is used to execute a certain operation. Thus, basically the operations Collect_Data and Execute are used in this order. The Command has different status represented by th Command_State class. The status can be asked for by the Get_Status operation. It is possible to register Command_Observer at a Command Object. They are notified whenever the state of the CommandObject changes. Finally, the operation Get_Param_Pot hands the object that stores the parameters necessary for the execution of the Command, the To_String operation returns a string that tells what the Command does in a human readable format and the Get_Name operation returns the name of the Command.
Executes the Command. May raise Illegal_State_Exception if precondition is not met, i.e. if the state is not "Collect_Data, Done".
Precondition: Collect_Data has been performed before and Execute is called the first time.
This operation collects the data necessary for the execution of this Command. May raise Illegal_State_Exception if precondition is not met, i.e. if the state is not "Initialization, Done".
Precondition: Initialization completed and Collect_Data was not called before.
Postcondition: The Command knows the data necessary for its execution.
Registers a Command_Observer at a the Command. The register observer will be notified whenever the state of the Command object changes.
Postcondition: The Command_Observer is registered.
Returns a string that tells what the Command does in a human readable format. This operation is used for debugging.
Returns the name of the Command. This operation is used for writing the script.
Returns the current state of the command.
This is the interface for command factories which is useed to create commands. This follows the abstract factory pattern.
Creates a new command object and initializes it with the given data source. The factory may add other data sources (e.g. dialogs) to the command. The factory may (but is not required to) check if the given data source contains all data required. It is recommanded to first check with Can_Excecute if the created command will get all data required.
Returns the name of the command this factory creates.
Postcondition: Nothing is changed.
Computes all necessary conditions and tells whether the Command is executable or not. Probably the Command_Factory needs a data_source first.
This is the abstract super class of all classes that observe Commands. If a Command Object changes its state, it notifies all registered Command Observers.
This class stores the state of a command. This state consists of two values: the current action and the state of this action. It is really really REALLY important to use the atomar Get() and Set() functions if both Action and Status are to be read or written to. Otherwise a parallel running task might get really confused.
private OpenCAGE.Controller.Command.Command_State_P S |
The protected state.
Returns a human readable string telling the state consisting of action and its state.
Returns true if the command is finished, i.e. the command completed the execute method or it aborted in any stage with an error or by user request, else false.
Setter method for attribute Command_State_State
Setter method for attribute Command_State_Action
Setter method for attribute Command_State_Action and Command_State_State
Getter method for attribute Command_State_Action and Command_State_State
This is an Enumeration. Possible values: Initalization, Collect_Data and Execution.
A protected object that encapsulates the state of a command. It is used internally in Command_State.
This is an Enumeration. Possible values: Running, Done, Cancelled_By_User and Cancelled_By_Error.