SedSynchronizedStateInstance

From SynchroEdit

Jump to: navigation, search

Contents

Interface implementation "SedSynchronizedStateInstance"

extends "SedInstance"

Revision 4 (Apr 22, 2006)

See also DocumentStateSequence.

Warning

This specification is deprecated. There are no plans to implement it at this point in time, as it has proven more or less unnecessary.

Definitions

        DSS <signed integer>; the document state sequence
            Unset DSS       = -1
            Entry-point DSS = 1
            0 and <-1 are invalid

        comm <language-dependent>; the communication object, which differs between the languages; in the server (Java) it is a CommResult object, 
            and in JS it is a String.

Notes

Optimization
It is likely that the correctNodeIdentifier and correct!NodeIfAffected functions can be optimized to check "if anchors are equal + parent is equal then compare indices" instead (as it is impossible for a text node to have a child, and as every element node is an anchor, this should be sufficient).


Variables

  • DSS DocumentStateSequence = -1

Functions

void setDSS(DSS new_sequence)

Set the DSS to new_sequence, signaling that the current DSS is changed. All document state data is discarded.

void unsetDSS()

Set the DSS to -1, signaling that we do not have a document state sequence. All document state data is discarded.

void createdDocument()

Signal that a document was created. The DSS is set to 1 and all document state data is discarded.

DSS incrementDSS()

Increment the DSS, signaling that we have performed a minor alteration that however did not affect the DOM tree, and return the new sequence.

DSS alter!DocumentState(Node affectedNode, int offset)

Record document state alteration which affected the DOM tree at the affected node and with the specified offset, and return the new sequence.

nodeIdentifier correctNodeIdentifier(nodeIdentifier what, DSS from_sequence_position)

Correct a node identifier by applying any affecting document state alterations previously recorded using alter!DocumentState(), beginning at the recorded state sequence from_sequence_position, ending at the current DSS. It is possible that the correct node identifier is no longer existing, in which case the returned value will be null. In this case, the application should ignore the performed update. This happens when one client modifies the content of a node while another client removes the node and the two actions collide. This function should only be used when a client or server knows the client is out-of-sync.

void correctNodeIfAffected(nodeIdentifier which, nodeIdentifier by, int offset)

Determine whether "which" is affected by "by" and correct it based on offset, if so. It is, if it is in the same node-tree or if it is beneath any point in the node-tree "which" is in.

boolean synchronizedDSS(DSS externalDSS)

Determine the DSS synchronization by comparing the externalDSS with the to-be-incremented local DSS. If the resulting DSS values match, the DSS is considered synchronized and a TRUE value is returned. If they aren't, a FALSE value is returned.

comm SyncComm(comm what)

Add a DSS to the communication object 'what'.
Personal tools