Package OpenCAGE.Controller.Condition

Class Condition

This is the abstract superclass of all conditions. Each condition class encapsulates a particular condition of the opencage model, e.g. that at least one node is selected. The current state of the condition (true or false) can be asked for by Get_Result. The condition caches its result in order to optimize the reply time. The Invalid operation is used to tell the condition that it has to recompute its result when Get_Result is called the next time.

Attributes

private Boolean Result 

Caches the computed result.

private Boolean Validity 

Tells whether the Result-Value is up-to-date or has to be recomputed.

private OpenCAGE.Controller.Condition.Cond_Observers_Lists.List Cond_Observer_List 

Holds the list of all registered Condition_Observers.

Operations

public Boolean Get_Result(void);

Returns the result of the condition. Only recomputes the result by using the Compute_Result operation if it has not changed since the last computation.

public Set_Invalid(void);

Tells the condition that it has to recompute its result.

public Attach( OpenCAGE.Controller.Condition.Condition_Observer Observer);

Registers a Condition_Observer at the Condition. The registered observer will be notified whenever the result of the Condition object has become invalid.

public Detach( OpenCAGE.Controller.Condition.Condition_Observer Observer);

public Boolean Compute_Result(void);

Computes the result of the condition. Must be implemented by subclasses

private Notify_Observers(void);

Notifies all observers that something has changed.

Class Condition_Factory

The Condition_Factory is the abstract superclass of all condition factory classes. Each of them is responsible for building a condition class when it is requested by using the operation Create_Condition. The condition factory class therefore knows all dependancies of the corresponding condition in order to initialize it appropriately.

Attributes

private OpenCAGE.Data.Data Oc_Data 

This object holds all data for one instance of OpenCAGE (actual model, lists of command factories, ...)

Operations

public OpenCAGE.Controller.Condition.Condition_Factory Create_Condition(void);

public Set_Oc_Data( OpenCAGE.Data.Data To);

Sets the attribute Oc_Data to the given value.

Class Condition_Observer

This is the abstract super class of all classes that observe Conditions. If a Command Object changes its state, it notifies all registered Command Observers.

Operations

public Changed( OpenCAGE.Controller.Condition.Condition Cond);

Tells the Condition_Observer that the value of a Condition object has become invalid.