Class: Operation

Defined in: lib/Types/BasicTypes.coffee

Overview

A generic interface to operations.

An operation has the following methods: _encode: 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

Delete Insert Delimiter

Instance Method Summary

Constructor Details

# (void) constructor(uid)

Parameters:

  • uid ( Object ) A unique identifier. If uid is undefined, a new uid will be created.

See also:

Instance Method Details

# (void) getUid()

Computes a unique identifier (uid) that identifies this operation.

# (void) execute() Private

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.

Overloads:

~ (void) saveOperation(name, op_uid)

Parameters:

  • name ( String ) The name of the operation. After validating (with validateSavedOperations) the instantiated operation will be accessible via this[name].
  • op_uid ( Object ) A uid that refers to an operation

~ (void) saveOperation(name, op)

Parameters:

  • name ( String ) The name of the operation. After calling this function op is accessible via this[name].
  • op ( Operation ) An Operation object

# (Boolean) validateSavedOperations() Private

After calling this function all not instantiated operations will be accessible.

Returns:

  • ( Boolean ) — Whether it was possible to instantiate all operations.

See also:

    Quickly fuzzy find classes, mixins, methods, file:

    Control the navigation frame:

    You can focus and blur the search input: