binary-decision-diagram 2.0.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{es → src}/abstract-node.d.ts +4 -4
- package/dist/{lib → src}/abstract-node.js +7 -4
- package/dist/src/abstract-node.js.map +1 -0
- package/dist/{es → src}/branches.d.ts +2 -2
- package/dist/{es → src}/branches.js +3 -2
- package/dist/src/branches.js.map +1 -0
- package/dist/src/create-bdd-from-truth-table.d.ts +3 -0
- package/dist/{lib → src}/create-bdd-from-truth-table.js +4 -4
- package/dist/src/create-bdd-from-truth-table.js.map +1 -0
- package/dist/{es → src}/ensure-correct-bdd.d.ts +2 -2
- package/dist/{es → src}/ensure-correct-bdd.js +1 -1
- package/dist/src/ensure-correct-bdd.js.map +1 -0
- package/dist/{lib → src}/fill-truth-table.d.ts +1 -1
- package/dist/{lib → src}/fill-truth-table.js +1 -1
- package/dist/{es → src}/fill-truth-table.js.map +1 -1
- package/dist/{lib → src}/find-similar-node.d.ts +1 -1
- package/dist/src/index.d.ts +14 -0
- package/dist/src/index.js +14 -0
- package/dist/src/index.js.map +1 -0
- package/dist/{es → src}/internal-node.d.ts +5 -5
- package/dist/{lib → src}/internal-node.js +5 -5
- package/dist/{es → src}/internal-node.js.map +1 -1
- package/dist/{es → src}/leaf-node.d.ts +4 -4
- package/dist/{es → src}/leaf-node.js +5 -4
- package/dist/src/leaf-node.js.map +1 -0
- package/dist/{es → src}/minimal-string/bdd-to-minimal-string.d.ts +2 -2
- package/dist/{es → src}/minimal-string/bdd-to-minimal-string.js +2 -2
- package/dist/{es → src}/minimal-string/bdd-to-minimal-string.js.map +1 -1
- package/dist/{lib → src}/minimal-string/bdd-to-simple-bdd.d.ts +3 -3
- package/dist/src/minimal-string/index.d.ts +5 -0
- package/dist/src/minimal-string/index.js +6 -0
- package/dist/{es → src}/minimal-string/index.js.map +1 -1
- package/dist/{es → src}/minimal-string/minimal-string-to-simple-bdd.d.ts +1 -1
- package/dist/{es → src}/minimal-string/minimal-string-to-simple-bdd.js +2 -2
- package/dist/{es → src}/minimal-string/minimal-string-to-simple-bdd.js.map +1 -1
- package/dist/{es → src}/minimal-string/resolve-with-simple-bdd.d.ts +1 -1
- package/dist/{lib → src}/minimal-string/resolve-with-simple-bdd.js +1 -1
- package/dist/{es → src}/minimal-string/resolve-with-simple-bdd.js.map +1 -1
- package/dist/{lib → src}/optimize-brute-force.d.ts +2 -2
- package/dist/{lib → src}/optimize-brute-force.js +2 -2
- package/dist/{es → src}/optimize-brute-force.js.map +1 -1
- package/dist/{es → src}/parents.d.ts +1 -1
- package/dist/{es → src}/parents.js +2 -1
- package/dist/src/parents.js.map +1 -0
- package/dist/{lib → src}/root-node.d.ts +4 -4
- package/dist/{lib → src}/root-node.js +8 -8
- package/dist/src/root-node.js.map +1 -0
- package/dist/{es → src}/types.d.ts +3 -3
- package/dist/{es → src}/util.d.ts +1 -1
- package/package.json +18 -18
- package/src/abstract-node.ts +7 -7
- package/src/branches.ts +2 -2
- package/src/create-bdd-from-truth-table.ts +5 -5
- package/src/ensure-correct-bdd.ts +4 -4
- package/src/fill-truth-table.ts +2 -2
- package/src/find-similar-node.ts +1 -1
- package/src/index.ts +14 -32
- package/src/internal-node.ts +5 -5
- package/src/leaf-node.ts +6 -6
- package/src/minimal-string/bdd-to-minimal-string.ts +4 -4
- package/src/minimal-string/bdd-to-simple-bdd.ts +4 -4
- package/src/minimal-string/index.ts +5 -5
- package/src/minimal-string/minimal-string-to-simple-bdd.ts +3 -3
- package/src/minimal-string/resolve-with-simple-bdd.ts +2 -2
- package/src/optimize-brute-force.ts +5 -5
- package/src/parents.ts +1 -1
- package/src/root-node.ts +7 -7
- package/src/types.ts +3 -3
- package/src/util.ts +1 -1
- package/.github/workflows/main.yml +0 -22
- package/dist/es/abstract-node.js +0 -166
- package/dist/es/abstract-node.js.map +0 -1
- package/dist/es/branches.js.map +0 -1
- package/dist/es/create-bdd-from-truth-table.d.ts +0 -3
- package/dist/es/create-bdd-from-truth-table.js +0 -34
- package/dist/es/create-bdd-from-truth-table.js.map +0 -1
- package/dist/es/ensure-correct-bdd.js.map +0 -1
- package/dist/es/fill-truth-table.d.ts +0 -6
- package/dist/es/fill-truth-table.js +0 -22
- package/dist/es/find-similar-node.d.ts +0 -7
- package/dist/es/index.d.ts +0 -20
- package/dist/es/index.js +0 -14
- package/dist/es/index.js.map +0 -1
- package/dist/es/internal-node.js +0 -42
- package/dist/es/leaf-node.js.map +0 -1
- package/dist/es/minimal-string/bdd-to-simple-bdd.d.ts +0 -11
- package/dist/es/minimal-string/index.d.ts +0 -5
- package/dist/es/minimal-string/index.js +0 -6
- package/dist/es/minimal-string/resolve-with-simple-bdd.js +0 -17
- package/dist/es/optimize-brute-force.d.ts +0 -43
- package/dist/es/optimize-brute-force.js +0 -132
- package/dist/es/parents.js.map +0 -1
- package/dist/es/root-node.d.ts +0 -28
- package/dist/es/root-node.js +0 -154
- package/dist/es/root-node.js.map +0 -1
- package/dist/lib/abstract-node.d.ts +0 -33
- package/dist/lib/abstract-node.js.map +0 -1
- package/dist/lib/branches.d.ts +0 -20
- package/dist/lib/branches.js +0 -70
- package/dist/lib/branches.js.map +0 -1
- package/dist/lib/create-bdd-from-truth-table.d.ts +0 -3
- package/dist/lib/create-bdd-from-truth-table.js.map +0 -1
- package/dist/lib/ensure-correct-bdd.d.ts +0 -8
- package/dist/lib/ensure-correct-bdd.js +0 -97
- package/dist/lib/ensure-correct-bdd.js.map +0 -1
- package/dist/lib/fill-truth-table.js.map +0 -1
- package/dist/lib/find-similar-node.js +0 -18
- package/dist/lib/find-similar-node.js.map +0 -1
- package/dist/lib/index.d.ts +0 -20
- package/dist/lib/index.js +0 -14
- package/dist/lib/index.js.map +0 -1
- package/dist/lib/internal-node.d.ts +0 -16
- package/dist/lib/internal-node.js.map +0 -1
- package/dist/lib/leaf-node.d.ts +0 -10
- package/dist/lib/leaf-node.js +0 -29
- package/dist/lib/leaf-node.js.map +0 -1
- package/dist/lib/minimal-string/bdd-to-minimal-string.d.ts +0 -8
- package/dist/lib/minimal-string/bdd-to-minimal-string.js +0 -55
- package/dist/lib/minimal-string/bdd-to-minimal-string.js.map +0 -1
- package/dist/lib/minimal-string/bdd-to-simple-bdd.js +0 -19
- package/dist/lib/minimal-string/bdd-to-simple-bdd.js.map +0 -1
- package/dist/lib/minimal-string/index.d.ts +0 -5
- package/dist/lib/minimal-string/index.js +0 -6
- package/dist/lib/minimal-string/index.js.map +0 -1
- package/dist/lib/minimal-string/minimal-string-to-simple-bdd.d.ts +0 -2
- package/dist/lib/minimal-string/minimal-string-to-simple-bdd.js +0 -54
- package/dist/lib/minimal-string/minimal-string-to-simple-bdd.js.map +0 -1
- package/dist/lib/minimal-string/resolve-with-simple-bdd.d.ts +0 -2
- package/dist/lib/minimal-string/resolve-with-simple-bdd.js.map +0 -1
- package/dist/lib/minimal-string/string-format.d.ts +0 -9
- package/dist/lib/minimal-string/string-format.js +0 -54
- package/dist/lib/minimal-string/string-format.js.map +0 -1
- package/dist/lib/optimize-brute-force.js.map +0 -1
- package/dist/lib/parents.d.ts +0 -15
- package/dist/lib/parents.js +0 -38
- package/dist/lib/parents.js.map +0 -1
- package/dist/lib/root-node.js.map +0 -1
- package/dist/lib/types.d.ts +0 -24
- package/dist/lib/types.js +0 -2
- package/dist/lib/types.js.map +0 -1
- package/dist/lib/util.d.ts +0 -26
- package/dist/lib/util.js +0 -109
- package/dist/lib/util.js.map +0 -1
- package/renovate.json +0 -8
- package/test/helper/big-truth-table.json +0 -578
- package/test/helper/test-util.ts +0 -110
- package/test/unit/create-bdd-from-truth-table.test.ts +0 -24
- package/test/unit/find-similar-node.test.ts +0 -53
- package/test/unit/index.test.ts +0 -6
- package/test/unit/minimize.test.ts +0 -145
- package/test/unit/optimize-brute-force.test.ts +0 -114
- package/test/unit/resolve.test.ts +0 -74
- package/test/unit/simple-bdd.test.ts +0 -186
- package/tsconfig.json +0 -38
- package/tslint.json +0 -116
- /package/dist/{es → src}/find-similar-node.js +0 -0
- /package/dist/{es → src}/find-similar-node.js.map +0 -0
- /package/dist/{es → src}/minimal-string/bdd-to-simple-bdd.js +0 -0
- /package/dist/{es → src}/minimal-string/bdd-to-simple-bdd.js.map +0 -0
- /package/dist/{es → src}/minimal-string/string-format.d.ts +0 -0
- /package/dist/{es → src}/minimal-string/string-format.js +0 -0
- /package/dist/{es → src}/minimal-string/string-format.js.map +0 -0
- /package/dist/{es → src}/types.js +0 -0
- /package/dist/{es → src}/types.js.map +0 -0
- /package/dist/{es → src}/util.js +0 -0
- /package/dist/{es → src}/util.js.map +0 -0
package/src/abstract-node.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { nextNodeId } from './util';
|
|
2
|
-
import type { NonRootNode, NonLeafNode, NodeType } from './types';
|
|
3
|
-
import { Branches } from './branches';
|
|
4
|
-
import { RootNode } from './root-node';
|
|
5
|
-
import { InternalNode } from './internal-node';
|
|
6
|
-
import { LeafNode } from './leaf-node';
|
|
7
|
-
import { findSimilarNode } from './find-similar-node';
|
|
1
|
+
import { nextNodeId } from './util.js';
|
|
2
|
+
import type { NonRootNode, NonLeafNode, NodeType } from './types.js';
|
|
3
|
+
import { Branches } from './branches.js';
|
|
4
|
+
import { RootNode } from './root-node.js';
|
|
5
|
+
import { InternalNode } from './internal-node.js';
|
|
6
|
+
import { LeafNode } from './leaf-node.js';
|
|
7
|
+
import { findSimilarNode } from './find-similar-node.js';
|
|
8
8
|
|
|
9
9
|
export class AbstractNode {
|
|
10
10
|
readonly id: string = nextNodeId();
|
package/src/branches.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { BooleanString, NonRootNode, NonLeafNode } from './types';
|
|
2
|
-
import { AbstractNode } from './abstract-node';
|
|
1
|
+
import type { BooleanString, NonRootNode, NonLeafNode } from './types.js';
|
|
2
|
+
import { AbstractNode } from './abstract-node.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* represents the branches of a single node
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { RootNode } from './root-node';
|
|
2
|
-
import { lastChar } from './util';
|
|
3
|
-
import { InternalNode } from './internal-node';
|
|
4
|
-
import { LeafNode } from './leaf-node';
|
|
5
|
-
import type { TruthTable, NonLeafNode, BooleanString } from './types';
|
|
1
|
+
import { RootNode } from './root-node.js';
|
|
2
|
+
import { lastChar } from './util.js';
|
|
3
|
+
import { InternalNode } from './internal-node.js';
|
|
4
|
+
import { LeafNode } from './leaf-node.js';
|
|
5
|
+
import type { TruthTable, NonLeafNode, BooleanString } from './types.js';
|
|
6
6
|
|
|
7
7
|
export function createBddFromTruthTable(
|
|
8
8
|
truthTable: TruthTable
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { RootNode } from './root-node';
|
|
2
|
-
import { AbstractNode } from './abstract-node';
|
|
3
|
-
import type { NonRootNode, NonLeafNode } from './types';
|
|
4
|
-
import { InternalNode } from './internal-node';
|
|
1
|
+
import { RootNode } from './root-node.js';
|
|
2
|
+
import { AbstractNode } from './abstract-node.js';
|
|
3
|
+
import type { NonRootNode, NonLeafNode } from './types.js';
|
|
4
|
+
import { InternalNode } from './internal-node.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* run some tests on the bdd
|
package/src/fill-truth-table.ts
CHANGED
package/src/find-similar-node.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,32 +1,14 @@
|
|
|
1
|
-
export * from './minimal-string/index';
|
|
2
|
-
export * from './abstract-node';
|
|
3
|
-
export * from './branches';
|
|
4
|
-
export * from './create-bdd-from-truth-table';
|
|
5
|
-
export * from './ensure-correct-bdd';
|
|
6
|
-
export * from './fill-truth-table';
|
|
7
|
-
export * from './find-similar-node';
|
|
8
|
-
export * from './internal-node';
|
|
9
|
-
export * from './leaf-node';
|
|
10
|
-
export * from './optimize-brute-force';
|
|
11
|
-
export * from './parents';
|
|
12
|
-
export * from './root-node';
|
|
13
|
-
export * from './util';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* There is no "export type * from 'xxx'"
|
|
17
|
-
* So we have to export each type by its own
|
|
18
|
-
* to ensure the types js file is not included
|
|
19
|
-
* into the bundle.
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
export type {
|
|
23
|
-
NodeType,
|
|
24
|
-
NonLeafNode,
|
|
25
|
-
NonRootNode,
|
|
26
|
-
TruthTable,
|
|
27
|
-
BooleanString,
|
|
28
|
-
ResolverFunction,
|
|
29
|
-
ResolverFunctions,
|
|
30
|
-
SimpleBddLeafNode,
|
|
31
|
-
SimpleBdd
|
|
32
|
-
} from './types';
|
|
1
|
+
export * from './minimal-string/index.js';
|
|
2
|
+
export * from './abstract-node.js';
|
|
3
|
+
export * from './branches.js';
|
|
4
|
+
export * from './create-bdd-from-truth-table.js';
|
|
5
|
+
export * from './ensure-correct-bdd.js';
|
|
6
|
+
export * from './fill-truth-table.js';
|
|
7
|
+
export * from './find-similar-node.js';
|
|
8
|
+
export * from './internal-node.js';
|
|
9
|
+
export * from './leaf-node.js';
|
|
10
|
+
export * from './optimize-brute-force.js';
|
|
11
|
+
export * from './parents.js';
|
|
12
|
+
export * from './root-node.js';
|
|
13
|
+
export * from './util.js';
|
|
14
|
+
export type * from './types.js';
|
package/src/internal-node.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Branches } from './branches';
|
|
2
|
-
import { Parents } from './parents';
|
|
3
|
-
import { RootNode } from './root-node';
|
|
4
|
-
import { AbstractNode } from './abstract-node';
|
|
5
|
-
import type { NonLeafNode, NonRootNode } from './types';
|
|
1
|
+
import { Branches } from './branches.js';
|
|
2
|
+
import { Parents } from './parents.js';
|
|
3
|
+
import { RootNode } from './root-node.js';
|
|
4
|
+
import { AbstractNode } from './abstract-node.js';
|
|
5
|
+
import type { NonLeafNode, NonRootNode } from './types.js';
|
|
6
6
|
|
|
7
7
|
export class InternalNode extends AbstractNode {
|
|
8
8
|
public branches: Branches = new Branches(this);
|
package/src/leaf-node.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Parents } from './parents';
|
|
2
|
-
import { AbstractNode } from './abstract-node';
|
|
3
|
-
import { RootNode } from './root-node';
|
|
4
|
-
import type { NonLeafNode } from './types';
|
|
5
|
-
import { oppositeBoolean } from './util';
|
|
6
|
-
import { InternalNode } from './internal-node';
|
|
1
|
+
import { Parents } from './parents.js';
|
|
2
|
+
import { AbstractNode } from './abstract-node.js';
|
|
3
|
+
import { RootNode } from './root-node.js';
|
|
4
|
+
import type { NonLeafNode } from './types.js';
|
|
5
|
+
import { oppositeBoolean } from './util.js';
|
|
6
|
+
import { InternalNode } from './internal-node.js';
|
|
7
7
|
|
|
8
8
|
export class LeafNode extends AbstractNode {
|
|
9
9
|
public parents = new Parents(this);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { RootNode } from '../root-node';
|
|
2
|
-
import { AbstractNode } from '../abstract-node';
|
|
3
|
-
import { getCharOfLevel, getCharOfValue, getNextCharId } from './string-format';
|
|
1
|
+
import { RootNode } from '../root-node.js';
|
|
2
|
+
import { AbstractNode } from '../abstract-node.js';
|
|
3
|
+
import { getCharOfLevel, getCharOfValue, getNextCharId } from './string-format.js';
|
|
4
4
|
import {
|
|
5
5
|
FIRST_CHAR_CODE_FOR_ID
|
|
6
|
-
} from './string-format';
|
|
6
|
+
} from './string-format.js';
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
export function bddToMinimalString(bdd: RootNode): string {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { RootNode } from '../root-node';
|
|
1
|
+
import { RootNode } from '../root-node.js';
|
|
2
2
|
import {
|
|
3
3
|
SimpleBdd
|
|
4
|
-
} from '../types';
|
|
5
|
-
import { AbstractNode } from '../abstract-node';
|
|
6
|
-
import { InternalNode } from '../internal-node';
|
|
4
|
+
} from '../types.js';
|
|
5
|
+
import { AbstractNode } from '../abstract-node.js';
|
|
6
|
+
import { InternalNode } from '../internal-node.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @recursive
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './bdd-to-minimal-string';
|
|
2
|
-
export * from './minimal-string-to-simple-bdd';
|
|
3
|
-
export * from './resolve-with-simple-bdd';
|
|
4
|
-
export * from './string-format';
|
|
5
|
-
export * from './bdd-to-simple-bdd';
|
|
1
|
+
export * from './bdd-to-minimal-string.js';
|
|
2
|
+
export * from './minimal-string-to-simple-bdd.js';
|
|
3
|
+
export * from './resolve-with-simple-bdd.js';
|
|
4
|
+
export * from './string-format.js';
|
|
5
|
+
export * from './bdd-to-simple-bdd.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SimpleBdd,
|
|
3
3
|
SimpleBddLeafNode
|
|
4
|
-
} from '../types';
|
|
5
|
-
import { splitStringToChunks } from '../util';
|
|
6
|
-
import { getNumberOfChar } from './string-format';
|
|
4
|
+
} from '../types.js';
|
|
5
|
+
import { splitStringToChunks } from '../util.js';
|
|
6
|
+
import { getNumberOfChar } from './string-format.js';
|
|
7
7
|
|
|
8
8
|
export function minimalStringToSimpleBdd(
|
|
9
9
|
str: string
|
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
SimpleBdd,
|
|
3
3
|
ResolverFunctions,
|
|
4
4
|
SimpleBddLeafNode
|
|
5
|
-
} from '../types';
|
|
6
|
-
import { booleanToBooleanString } from '../util';
|
|
5
|
+
} from '../types.js';
|
|
6
|
+
import { booleanToBooleanString } from '../util.js';
|
|
7
7
|
|
|
8
8
|
export function resolveWithSimpleBdd(
|
|
9
9
|
simpleBdd: SimpleBdd,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { TruthTable } from './types';
|
|
2
|
-
import { RootNode } from './root-node';
|
|
3
|
-
import { createBddFromTruthTable } from './create-bdd-from-truth-table';
|
|
4
|
-
import { firstKeyOfMap, shuffleArray, lastOfArray } from './util';
|
|
5
|
-
import { AbstractNode } from './abstract-node';
|
|
1
|
+
import type { TruthTable } from './types.js';
|
|
2
|
+
import { RootNode } from './root-node.js';
|
|
3
|
+
import { createBddFromTruthTable } from './create-bdd-from-truth-table.js';
|
|
4
|
+
import { firstKeyOfMap, shuffleArray, lastOfArray } from './util.js';
|
|
5
|
+
import { AbstractNode } from './abstract-node.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* a function that is called each time
|
package/src/parents.ts
CHANGED
package/src/root-node.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { AbstractNode } from './abstract-node';
|
|
2
|
-
import { Branches } from './branches';
|
|
1
|
+
import { AbstractNode } from './abstract-node.js';
|
|
2
|
+
import { Branches } from './branches.js';
|
|
3
3
|
import type {
|
|
4
4
|
NonRootNode,
|
|
5
5
|
ResolverFunctions,
|
|
6
6
|
NonLeafNode,
|
|
7
7
|
SimpleBdd
|
|
8
|
-
} from './types';
|
|
8
|
+
} from './types.js';
|
|
9
9
|
import {
|
|
10
10
|
lastOfArray,
|
|
11
11
|
booleanToBooleanString
|
|
12
|
-
} from './util';
|
|
13
|
-
import { InternalNode } from './internal-node';
|
|
14
|
-
import { LeafNode } from './leaf-node';
|
|
15
|
-
import { bddToSimpleBdd } from './minimal-string';
|
|
12
|
+
} from './util.js';
|
|
13
|
+
import { InternalNode } from './internal-node.js';
|
|
14
|
+
import { LeafNode } from './leaf-node.js';
|
|
15
|
+
import { bddToSimpleBdd } from './minimal-string/index.js';
|
|
16
16
|
|
|
17
17
|
export class RootNode extends AbstractNode {
|
|
18
18
|
public branches: Branches = new Branches(this);
|
package/src/types.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { LeafNode } from './leaf-node';
|
|
2
|
-
import { InternalNode } from './internal-node';
|
|
3
|
-
import { RootNode } from './root-node';
|
|
1
|
+
import type { LeafNode } from './leaf-node.js';
|
|
2
|
+
import type { InternalNode } from './internal-node.js';
|
|
3
|
+
import type { RootNode } from './root-node.js';
|
|
4
4
|
|
|
5
5
|
export type NodeType = 'LeafNode' | 'InternalNode' | 'RootNode';
|
|
6
6
|
|
package/src/util.ts
CHANGED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
name: CI
|
|
2
|
-
on:
|
|
3
|
-
push:
|
|
4
|
-
branches: [ master ]
|
|
5
|
-
pull_request:
|
|
6
|
-
branches: [ master ]
|
|
7
|
-
|
|
8
|
-
workflow_dispatch:
|
|
9
|
-
|
|
10
|
-
jobs:
|
|
11
|
-
build:
|
|
12
|
-
runs-on: ubuntu-latest
|
|
13
|
-
steps:
|
|
14
|
-
- uses: actions/checkout@v3
|
|
15
|
-
- name: Use Node.js
|
|
16
|
-
uses: actions/setup-node@v3
|
|
17
|
-
with:
|
|
18
|
-
node-version: 16.10.0
|
|
19
|
-
- run: npm install
|
|
20
|
-
- run: npm run build
|
|
21
|
-
- run: npm run test
|
|
22
|
-
- run: npm run lint
|
package/dist/es/abstract-node.js
DELETED
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import { nextNodeId } from './util';
|
|
2
|
-
import { findSimilarNode } from './find-similar-node';
|
|
3
|
-
export class AbstractNode {
|
|
4
|
-
constructor(level, rootNode, type) {
|
|
5
|
-
this.level = level;
|
|
6
|
-
this.id = nextNodeId();
|
|
7
|
-
this.deleted = false;
|
|
8
|
-
this.type = type;
|
|
9
|
-
this.rootNode = rootNode;
|
|
10
|
-
if (rootNode) {
|
|
11
|
-
this.rootNode.addNode(this);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
isEqualToOtherNode(otherNode,
|
|
15
|
-
// optimisation shortcut, is faster if own string already known
|
|
16
|
-
ownString = this.toString()) {
|
|
17
|
-
const ret = ownString === otherNode.toString();
|
|
18
|
-
return ret;
|
|
19
|
-
}
|
|
20
|
-
// deletes the whole node
|
|
21
|
-
remove() {
|
|
22
|
-
this.ensureNotDeleted('remove');
|
|
23
|
-
// console.log('AbstractNode().remove() node: ' + this.id);
|
|
24
|
-
// console.log(this.toJSON(true));
|
|
25
|
-
if (this.isInternalNode()) {
|
|
26
|
-
const useNode = this;
|
|
27
|
-
if (useNode.parents.size > 0) {
|
|
28
|
-
throw new Error('cannot remove node with parents ' + this.id);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
if (this.branches) {
|
|
32
|
-
const useNode = this;
|
|
33
|
-
if (useNode.branches.areBranchesStrictEqual()) {
|
|
34
|
-
useNode.branches.getBranch('0').parents.remove(useNode);
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
useNode.branches.getBranch('0').parents.remove(useNode);
|
|
38
|
-
useNode.branches.getBranch('1').parents.remove(useNode);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
this.deleted = true;
|
|
42
|
-
this.rootNode.removeNode(this);
|
|
43
|
-
}
|
|
44
|
-
toJSON(withId = false) {
|
|
45
|
-
const ret = {
|
|
46
|
-
id: withId ? this.id : undefined,
|
|
47
|
-
deleted: withId ? this.deleted : undefined,
|
|
48
|
-
type: this.type,
|
|
49
|
-
level: this.level
|
|
50
|
-
};
|
|
51
|
-
if (withId && this.parents) {
|
|
52
|
-
ret.parents = this.parents.toString();
|
|
53
|
-
}
|
|
54
|
-
if (this.isLeafNode()) {
|
|
55
|
-
ret.value = this.asLeafNode().value;
|
|
56
|
-
}
|
|
57
|
-
if (this.branches && !this.branches.deleted) {
|
|
58
|
-
const branches = this.branches;
|
|
59
|
-
ret.branches = {
|
|
60
|
-
'0': branches.getBranch('0').toJSON(withId),
|
|
61
|
-
'1': branches.getBranch('1').toJSON(withId)
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
return ret;
|
|
65
|
-
}
|
|
66
|
-
// a strange string-representation
|
|
67
|
-
// to make an equal check between nodes
|
|
68
|
-
toString() {
|
|
69
|
-
let ret = '' +
|
|
70
|
-
'<' +
|
|
71
|
-
this.type + ':' + this.level;
|
|
72
|
-
if (this.branches) {
|
|
73
|
-
const branches = this.branches;
|
|
74
|
-
ret += '|0:' + branches.getBranch('0');
|
|
75
|
-
ret += '|1:' + branches.getBranch('1');
|
|
76
|
-
}
|
|
77
|
-
if (this.isLeafNode()) {
|
|
78
|
-
ret += '|v:' + this.asLeafNode().value;
|
|
79
|
-
}
|
|
80
|
-
ret += '>';
|
|
81
|
-
return ret;
|
|
82
|
-
}
|
|
83
|
-
isRootNode() {
|
|
84
|
-
return this.type === 'RootNode';
|
|
85
|
-
}
|
|
86
|
-
isInternalNode() {
|
|
87
|
-
return this.type === 'InternalNode';
|
|
88
|
-
}
|
|
89
|
-
isLeafNode() {
|
|
90
|
-
return this.type === 'LeafNode';
|
|
91
|
-
}
|
|
92
|
-
asRootNode() {
|
|
93
|
-
if (!this.isRootNode()) {
|
|
94
|
-
throw new Error('ouch');
|
|
95
|
-
}
|
|
96
|
-
return this;
|
|
97
|
-
}
|
|
98
|
-
asInternalNode() {
|
|
99
|
-
if (!this.isInternalNode()) {
|
|
100
|
-
throw new Error('ouch');
|
|
101
|
-
}
|
|
102
|
-
return this;
|
|
103
|
-
}
|
|
104
|
-
asLeafNode() {
|
|
105
|
-
if (!this.isLeafNode()) {
|
|
106
|
-
throw new Error('ouch');
|
|
107
|
-
}
|
|
108
|
-
return this;
|
|
109
|
-
}
|
|
110
|
-
ensureNotDeleted(op = 'unknown') {
|
|
111
|
-
if (this.deleted) {
|
|
112
|
-
throw new Error('forbidden operation ' + op + ' on deleted node ' + this.id);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
log() {
|
|
116
|
-
console.log(JSON.stringify(this.toJSON(true), null, 2));
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* by the elimination-rule of bdd,
|
|
120
|
-
* if two branches of the same level are equal,
|
|
121
|
-
* one can be removed
|
|
122
|
-
*
|
|
123
|
-
* See page 21 at:
|
|
124
|
-
* @link https://people.eecs.berkeley.edu/~sseshia/219c/lectures/BinaryDecisionDiagrams.pdf
|
|
125
|
-
*/
|
|
126
|
-
applyEliminationRule(
|
|
127
|
-
// can be provided for better performance
|
|
128
|
-
nodesOfSameLevel) {
|
|
129
|
-
this.ensureNotDeleted('applyEliminationRule');
|
|
130
|
-
if (!nodesOfSameLevel) {
|
|
131
|
-
nodesOfSameLevel = this.rootNode.getNodesOfLevel(this.level);
|
|
132
|
-
}
|
|
133
|
-
const other = findSimilarNode(this, nodesOfSameLevel);
|
|
134
|
-
if (other) {
|
|
135
|
-
// console.log('applyEliminationRule() remove:' + this.id + '; other: ' + other.id);
|
|
136
|
-
// keep 'other', remove 'this'
|
|
137
|
-
// move own parents to other
|
|
138
|
-
const ownParents = this.parents.getAll();
|
|
139
|
-
const parentsWithStrictEqualBranches = [];
|
|
140
|
-
ownParents.forEach((parent) => {
|
|
141
|
-
// console.log('ownParent: ' + parent.id);
|
|
142
|
-
const branchKey = parent.branches.getKeyOfNode(this);
|
|
143
|
-
// console.log('branchKey: ' + branchKey);
|
|
144
|
-
parent.branches.setBranch(branchKey, other);
|
|
145
|
-
if (parent.branches.areBranchesStrictEqual()) {
|
|
146
|
-
parentsWithStrictEqualBranches.push(parent);
|
|
147
|
-
}
|
|
148
|
-
// remove parents from own list
|
|
149
|
-
// this will auto-remove the connection to the other '1'-branch
|
|
150
|
-
this.parents.remove(parent);
|
|
151
|
-
});
|
|
152
|
-
// parents that now have equal branches, must be removed again
|
|
153
|
-
parentsWithStrictEqualBranches.forEach(node => {
|
|
154
|
-
if (node.isInternalNode()) {
|
|
155
|
-
// console.log('trigger applyReductionRule from applyEliminationRule');
|
|
156
|
-
node.applyReductionRule();
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
return true;
|
|
160
|
-
}
|
|
161
|
-
else {
|
|
162
|
-
return false;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
//# sourceMappingURL=abstract-node.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"abstract-node.js","sourceRoot":"","sources":["../../src/abstract-node.ts"],"names":[],"mappings":"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@ -1,34 +0,0 @@
|
|
|
1
|
-
import { RootNode } from './root-node';
|
|
2
|
-
import { lastChar } from './util';
|
|
3
|
-
import { InternalNode } from './internal-node';
|
|
4
|
-
import { LeafNode } from './leaf-node';
|
|
5
|
-
export function createBddFromTruthTable(truthTable) {
|
|
6
|
-
const root = new RootNode();
|
|
7
|
-
const firstKey = truthTable.keys().next().value;
|
|
8
|
-
const keyLength = firstKey.length;
|
|
9
|
-
const mustBeSize = Math.pow(2, keyLength);
|
|
10
|
-
if (truthTable.size !== mustBeSize) {
|
|
11
|
-
throw new Error('truth table has missing entries');
|
|
12
|
-
}
|
|
13
|
-
for (const [stateSet, value] of truthTable) {
|
|
14
|
-
let lastNode = root;
|
|
15
|
-
// itterate over each char of the state
|
|
16
|
-
for (let i = 0; i < (stateSet.length - 1); i++) {
|
|
17
|
-
const level = i + 1;
|
|
18
|
-
const state = stateSet.charAt(i);
|
|
19
|
-
// if node for this state-char not exists, add new one
|
|
20
|
-
if (!lastNode.branches.getBranch(state)) {
|
|
21
|
-
lastNode.branches.setBranch(state, new InternalNode(level, root, lastNode));
|
|
22
|
-
}
|
|
23
|
-
lastNode = lastNode.branches.getBranch(state);
|
|
24
|
-
}
|
|
25
|
-
// last node is leaf-node
|
|
26
|
-
const lastState = lastChar(stateSet);
|
|
27
|
-
if (lastNode.branches.getBranch(lastState)) {
|
|
28
|
-
throw new Error('leafNode already exists, this should not happen');
|
|
29
|
-
}
|
|
30
|
-
lastNode.branches.setBranch(lastState, new LeafNode(stateSet.length, root, value, lastNode));
|
|
31
|
-
}
|
|
32
|
-
return root;
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=create-bdd-from-truth-table.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-bdd-from-truth-table.js","sourceRoot":"","sources":["../../src/create-bdd-from-truth-table.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE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AC,CAAC;IAGH,IAAI,UAAU,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE;QACvC,MAAM,IAAI,KAAK,CACX,qBAAqB;YACrB,6BAA6B,CAChC,CAAC;KACL;AACL,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC7B,IAAkB,EAClB,MAAyB,IAAI,GAAG,EAAE;IAElC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACd,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE;QACpB,MAAM,OAAO,GAAG,IAAmB,CAAC;QAEpC,MAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QAChD,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACjB,iBAAiB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAEhC,MAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QAChD,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACjB,iBAAiB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;KACnC;IAED,OAAO,GAAG,CAAC;AACf,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { minBinaryWithLength, maxBinaryWithLength, getNextStateSet } from './util';
|
|
2
|
-
/**
|
|
3
|
-
* fills each missing row of a table
|
|
4
|
-
* with the given value
|
|
5
|
-
*/
|
|
6
|
-
export function fillTruthTable(truthTable, inputLength, value) {
|
|
7
|
-
const endInput = maxBinaryWithLength(inputLength);
|
|
8
|
-
let currentInput = minBinaryWithLength(inputLength);
|
|
9
|
-
let done = false;
|
|
10
|
-
while (!done) {
|
|
11
|
-
if (!truthTable.has(currentInput)) {
|
|
12
|
-
truthTable.set(currentInput, value);
|
|
13
|
-
}
|
|
14
|
-
if (currentInput === endInput) {
|
|
15
|
-
done = true;
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
currentInput = getNextStateSet(currentInput);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=fill-truth-table.js.map
|
package/dist/es/index.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export * from './minimal-string/index';
|
|
2
|
-
export * from './abstract-node';
|
|
3
|
-
export * from './branches';
|
|
4
|
-
export * from './create-bdd-from-truth-table';
|
|
5
|
-
export * from './ensure-correct-bdd';
|
|
6
|
-
export * from './fill-truth-table';
|
|
7
|
-
export * from './find-similar-node';
|
|
8
|
-
export * from './internal-node';
|
|
9
|
-
export * from './leaf-node';
|
|
10
|
-
export * from './optimize-brute-force';
|
|
11
|
-
export * from './parents';
|
|
12
|
-
export * from './root-node';
|
|
13
|
-
export * from './util';
|
|
14
|
-
/**
|
|
15
|
-
* There is no "export type * from 'xxx'"
|
|
16
|
-
* So we have to export each type by its own
|
|
17
|
-
* to ensure the types js file is not included
|
|
18
|
-
* into the bundle.
|
|
19
|
-
*/
|
|
20
|
-
export type { NodeType, NonLeafNode, NonRootNode, TruthTable, BooleanString, ResolverFunction, ResolverFunctions, SimpleBddLeafNode, SimpleBdd } from './types';
|
package/dist/es/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export * from './minimal-string/index';
|
|
2
|
-
export * from './abstract-node';
|
|
3
|
-
export * from './branches';
|
|
4
|
-
export * from './create-bdd-from-truth-table';
|
|
5
|
-
export * from './ensure-correct-bdd';
|
|
6
|
-
export * from './fill-truth-table';
|
|
7
|
-
export * from './find-similar-node';
|
|
8
|
-
export * from './internal-node';
|
|
9
|
-
export * from './leaf-node';
|
|
10
|
-
export * from './optimize-brute-force';
|
|
11
|
-
export * from './parents';
|
|
12
|
-
export * from './root-node';
|
|
13
|
-
export * from './util';
|
|
14
|
-
//# sourceMappingURL=index.js.map
|
package/dist/es/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC"}
|