UNPKG

1.99 kBTypeScriptView Raw
1import { Map as ImmutableMap } from 'immutable';
2import { BranchId, StateId } from './interfaces';
3export default class DagGraph<T> {
4 graph: ImmutableMap<any, any>;
5 constructor(graph: ImmutableMap<any, any>);
6 print(): string;
7 readonly currentStateId: StateId;
8 branchStartDepth(branch: BranchId): number;
9 branchEndDepth(branch: BranchId): number;
10 stateDepth(commit: StateId): number;
11 depthIndexOf(branch: BranchId, commit: StateId): number;
12 readonly maxDepth: number;
13 setCurrentStateId(stateId: StateId): this;
14 readonly currentBranch: BranchId;
15 setCurrentBranch(branchId: BranchId): this;
16 latestOn(branch: BranchId): StateId;
17 committedOn(branch: BranchId): StateId;
18 setLatest(branch: BranchId, commit: StateId): this;
19 setCommitted(branch: BranchId, commit: StateId): this;
20 markStateForBranch(commit: StateId, branch: BranchId): this;
21 setFirst(branch: BranchId, commit: StateId): this;
22 firstOn(branch: BranchId): StateId;
23 renameState(commit: StateId, name: string): this;
24 stateName(commit: StateId): any;
25 getBranchName(branch: BranchId): string;
26 setBranchName(branch: BranchId, name: string): this;
27 getState(commit: StateId): T;
28 insertState(commit: StateId, parent: StateId, state: T, name: string): this;
29 childrenOf(commit: StateId): StateId[];
30 parentOf(commit: StateId): StateId;
31 alternateParentsOf(commit: StateId): StateId[];
32 shallowestParentOf(commit: StateId): StateId;
33 replaceState(commit: StateId, state: T): this;
34 commitPath(commit: StateId): StateId[];
35 shortestCommitPath(commit: StateId): StateId[];
36 branchCommitPath(branch: BranchId): StateId[];
37 setParent(commit: StateId, parent: StateId): void;
38 setAlternateParent(commit: StateId, parent: StateId): void;
39 readonly branches: BranchId[];
40 branchOf(commit: StateId): BranchId;
41 branchesOf(commit: StateId): BranchId[];
42 private remove(commit);
43 squashCurrentBranch(): this;
44}