Skip to content

Commit

Permalink
Shorten tree interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
hackerwins committed Nov 8, 2023
1 parent 2c3f24e commit db5634d
Show file tree
Hide file tree
Showing 3 changed files with 202 additions and 361 deletions.
13 changes: 2 additions & 11 deletions src/document/crdt/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -808,10 +808,10 @@ export class CRDTTree extends CRDTGCElement {
}

/**
* `editByIndex` edits the given range with the given value.
* `editT` edits the given range with the given value.
* This method uses indexes instead of a pair of TreePos for testing.
*/
public editByIndex(
public editT(
range: [number, number],
contents: Array<CRDTTreeNode> | undefined,
editedAt: TimeTicket,
Expand All @@ -821,15 +821,6 @@ export class CRDTTree extends CRDTGCElement {
this.edit([fromPos, toPos], contents, editedAt);
}

/**
* `split` splits the node at the given index.
*/
public split(index: number, depth = 1): TreePos<CRDTTreeNode> {
// TODO(hackerwins, easylogic): Implement this with keeping references in the list.
// return this.treeByIndex.split(index, depth);
throw new Error(`not implemented, ${index} ${depth}`);
}

/**
* `move` move the given source range to the given target range.
*/
Expand Down
12 changes: 0 additions & 12 deletions src/document/json/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,18 +434,6 @@ export class Tree {
return this.editInternal(fromPos, toPos, contents);
}

/**
* `split` splits this tree at the given index.
*/
public split(index: number, depth: number): boolean {
if (!this.context || !this.tree) {
throw new Error('it is not initialized yet');
}

this.tree.split(index, depth);
return true;
}

/**
* `toXML` returns the XML string of this tree.
*/
Expand Down
Loading

0 comments on commit db5634d

Please sign in to comment.