Class: Operation
Defined in: | lib/Types/BasicTypes.coffee |
Overview
A generic interface to operations.
An operation has the following methods: toJson: encodes an operation (needed only if instance of this operation is sent). execute: execute the effects of this operations. Good examples are Insert-type and AddName-type val: in the case that the operation holds a value
Furthermore an encodable operation has a parser.
Direct Known Subclasses
Instance Method Summary
- # (void) getUid() Computes a unique identifier (uid).
- # (void) execute() Notify the all the listeners.
- ~ (void) saveOperation(name, op_uid) Operations may depend on other operations (linked lists, etc.).
- # (Boolean) validateSavedOperations() After calling this function all not instantiated operations will be accessible.
Constructor Details
#
(void)
constructor(uid)
Instance Method Details
#
(void)
getUid()
Computes a unique identifier (uid).
#
(void)
execute()
Notify the all the listeners.
~
(void)
saveOperation(name, op_uid)
~
(void)
saveOperation(name, op)
Operations may depend on other operations (linked lists, etc.). The saveOperation and validateSavedOperations methods provide an easy way to refer to these operations via an uid or object reference.
For example: We can create a new Delete operation that deletes the operation $o like this
- var d = new Delete(uid, $o); or
- var d = new Delete(uid, $o.getUid());
Either way we want to access $o via d.deletes. In the second case validateSavedOperations must be called first.
#
(Boolean)
validateSavedOperations()
After calling this function all not instantiated operations will be accessible.