2019-04-04 19:35:38 +02:00
|
|
|
import {
|
2020-12-29 16:59:27 +01:00
|
|
|
UpdateEncoderV1, UpdateEncoderV2, ID, Transaction // eslint-disable-line
|
2019-04-04 19:35:38 +02:00
|
|
|
} from '../internals.js'
|
|
|
|
|
|
2021-05-14 18:53:24 +02:00
|
|
|
import * as error from 'lib0/error'
|
2019-03-26 01:14:15 +01:00
|
|
|
|
|
|
|
|
export class AbstractStruct {
|
|
|
|
|
/**
|
|
|
|
|
* @param {ID} id
|
2019-05-28 14:18:20 +02:00
|
|
|
* @param {number} length
|
2019-03-26 01:14:15 +01:00
|
|
|
*/
|
2019-05-28 14:18:20 +02:00
|
|
|
constructor (id, length) {
|
2019-03-26 01:14:15 +01:00
|
|
|
this.id = id
|
2019-05-28 14:18:20 +02:00
|
|
|
this.length = length
|
2020-06-09 16:34:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @type {boolean}
|
|
|
|
|
*/
|
|
|
|
|
get deleted () {
|
|
|
|
|
throw error.methodUnimplemented()
|
2019-03-26 01:14:15 +01:00
|
|
|
}
|
2020-01-22 16:42:16 +01:00
|
|
|
|
2019-04-03 02:30:44 +02:00
|
|
|
/**
|
|
|
|
|
* Merge this struct with the item to the right.
|
|
|
|
|
* This method is already assuming that `this.id.clock + this.length === this.id.clock`.
|
|
|
|
|
* Also this method does *not* remove right from StructStore!
|
|
|
|
|
* @param {AbstractStruct} right
|
2025-01-03 18:11:43 +00:00
|
|
|
* @return {boolean} whether this merged with right
|
2019-04-03 02:30:44 +02:00
|
|
|
*/
|
|
|
|
|
mergeWith (right) {
|
|
|
|
|
return false
|
|
|
|
|
}
|
2020-01-22 16:42:16 +01:00
|
|
|
|
2019-03-29 01:02:44 +01:00
|
|
|
/**
|
2020-12-29 16:59:27 +01:00
|
|
|
* @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.
|
2019-04-02 23:08:58 +02:00
|
|
|
* @param {number} offset
|
2019-03-29 01:02:44 +01:00
|
|
|
* @param {number} encodingRef
|
|
|
|
|
*/
|
2019-04-02 23:08:58 +02:00
|
|
|
write (encoder, offset, encodingRef) {
|
|
|
|
|
throw error.methodUnimplemented()
|
|
|
|
|
}
|
2020-01-22 16:42:16 +01:00
|
|
|
|
2019-04-02 23:08:58 +02:00
|
|
|
/**
|
|
|
|
|
* @param {Transaction} transaction
|
2019-04-05 12:38:02 +02:00
|
|
|
* @param {number} offset
|
2019-03-26 01:14:15 +01:00
|
|
|
*/
|
2020-06-09 00:53:05 +02:00
|
|
|
integrate (transaction, offset) {
|
2019-03-29 01:02:44 +01:00
|
|
|
throw error.methodUnimplemented()
|
|
|
|
|
}
|
2019-03-26 01:14:15 +01:00
|
|
|
}
|