behavior-graph
Advanced tools
Comparing version
@@ -142,2 +142,9 @@ var bg = (function (exports) { | ||
} | ||
toString() { | ||
let name = "Resource"; | ||
if (this.debugName != null) { | ||
name = this.debugName + "(r)"; | ||
} | ||
return name; | ||
} | ||
assertValidUpdater() { | ||
@@ -218,2 +225,15 @@ let graph = this.graph; | ||
} | ||
toString() { | ||
let name = "Moment"; | ||
if (this.debugName != null) { | ||
name = (this.debugName + "(m)"); | ||
} | ||
if (this._happenedValue !== undefined) { | ||
name = name + "=" + this._happenedValue; | ||
} | ||
if (this._happenedWhen !== null) { | ||
name = name + " : " + this._happenedWhen.sequence; | ||
} | ||
return name; | ||
} | ||
justUpdatedTo(value) { | ||
@@ -249,2 +269,11 @@ return this.justUpdated && this._happenedValue == value; | ||
} | ||
toString() { | ||
let name = "State"; | ||
if (this.debugName != null) { | ||
name = (this.debugName + "(s)"); | ||
} | ||
name = name + "=" + this.currentState.value; | ||
name = name + " : " + this.currentState.event.sequence; | ||
return name; | ||
} | ||
updateWithAction(newValue, debugName) { | ||
@@ -587,2 +616,20 @@ this.graph.action(() => { | ||
} | ||
debugHere() { | ||
let text = ""; | ||
if (this.currentEvent != null) { | ||
text = "Current Event: " + this.currentEvent.sequence + "\n"; | ||
text = text + "Action Updates:\n"; | ||
this.eventLoopState?.actionUpdates.forEach(item => { | ||
text = text + " " + item.toString() + "\n"; | ||
}); | ||
if (this.currentBehavior != null) { | ||
text = text + "Current Behavior:\n"; | ||
text = text + this.currentBehavior.toString(); | ||
} | ||
} | ||
else { | ||
text = "No current event."; | ||
} | ||
return text; | ||
} | ||
addUntrackedBehaviors() { | ||
@@ -797,6 +844,7 @@ if (this.untrackedBehaviors.length > 0) { | ||
if (this.cycleDFS(behavior, behavior, stack)) { | ||
while (stack.length > 0) { | ||
let rez = stack.pop(); | ||
output.push(rez); | ||
} | ||
output = stack; | ||
// while (stack.length > 0) { | ||
// let rez = stack.pop(); | ||
// output.push(rez!); | ||
// } | ||
} | ||
@@ -808,5 +856,5 @@ return output; | ||
for (let r of currentBehavior.demands) { | ||
stack.push(r); | ||
let b = r.suppliedBy; | ||
if (b != null) { | ||
stack.push(r); | ||
if (b == target) { | ||
@@ -1000,2 +1048,21 @@ return true; | ||
} | ||
toString() { | ||
let name = "Behavior (" + this.order + ")"; | ||
if (this.enqueuedWhen != null) { | ||
name = name + " : " + this.enqueuedWhen; | ||
} | ||
if (this.supplies != null && this.supplies?.size > 0) { | ||
name = name + " \n Supplies:"; | ||
this.supplies?.forEach(item => { | ||
name = name + "\n " + item.toString(); | ||
}); | ||
} | ||
if (this.demands != null && this.demands?.size > 0) { | ||
name = name + " \n Demands:"; | ||
this.demands?.forEach(item => { | ||
name = name + "\n " + item.toString(); | ||
}); | ||
} | ||
return name; | ||
} | ||
setDynamicDemands(newDemands) { | ||
@@ -1234,2 +1301,5 @@ this.extent.graph.updateDemands(this, newDemands?.filter(item => item != undefined)); | ||
} | ||
debugHere() { | ||
return this.graph.debugHere(); | ||
} | ||
unifyLifetime(extent) { | ||
@@ -1236,0 +1306,0 @@ if (this.lifetime == null) { |
@@ -24,2 +24,3 @@ import { Orderable } from "./bufferedqueue.js"; | ||
constructor(extent: Extent, demands: Demandable[] | null, supplies: Resource[] | null, block: (extent: Extent) => void); | ||
toString(): string; | ||
setDynamicDemands(newDemands: (Demandable | undefined)[] | null): void; | ||
@@ -26,0 +27,0 @@ setDynamicSupplies(newSupplies: (Resource | undefined)[] | null): void; |
@@ -30,2 +30,22 @@ "use strict"; | ||
} | ||
toString() { | ||
var _a, _b, _c, _d; | ||
let name = "Behavior (" + this.order + ")"; | ||
if (this.enqueuedWhen != null) { | ||
name = name + " : " + this.enqueuedWhen; | ||
} | ||
if (this.supplies != null && ((_a = this.supplies) === null || _a === void 0 ? void 0 : _a.size) > 0) { | ||
name = name + " \n Supplies:"; | ||
(_b = this.supplies) === null || _b === void 0 ? void 0 : _b.forEach(item => { | ||
name = name + "\n " + item.toString(); | ||
}); | ||
} | ||
if (this.demands != null && ((_c = this.demands) === null || _c === void 0 ? void 0 : _c.size) > 0) { | ||
name = name + " \n Demands:"; | ||
(_d = this.demands) === null || _d === void 0 ? void 0 : _d.forEach(item => { | ||
name = name + "\n " + item.toString(); | ||
}); | ||
} | ||
return name; | ||
} | ||
setDynamicDemands(newDemands) { | ||
@@ -32,0 +52,0 @@ this.extent.graph.updateDemands(this, newDemands === null || newDemands === void 0 ? void 0 : newDemands.filter(item => item != undefined)); |
@@ -33,2 +33,3 @@ import { Graph } from "./graph.js"; | ||
constructor(graph: Graph); | ||
debugHere(): string; | ||
unifyLifetime<T extends Extent>(extent: T): void; | ||
@@ -35,0 +36,0 @@ addChildLifetime<T extends Extent>(extent: T): void; |
@@ -132,2 +132,5 @@ "use strict"; | ||
} | ||
debugHere() { | ||
return this.graph.debugHere(); | ||
} | ||
unifyLifetime(extent) { | ||
@@ -134,0 +137,0 @@ if (this.lifetime == null) { |
@@ -59,2 +59,3 @@ import { BufferedPriorityQueue } from "./bufferedqueue.js"; | ||
sideEffectHelper(sideEffect: SideEffect): void; | ||
debugHere(): string; | ||
private addUntrackedBehaviors; | ||
@@ -61,0 +62,0 @@ private addUntrackedSupplies; |
@@ -291,2 +291,21 @@ "use strict"; | ||
} | ||
debugHere() { | ||
var _a; | ||
let text = ""; | ||
if (this.currentEvent != null) { | ||
text = "Current Event: " + this.currentEvent.sequence + "\n"; | ||
text = text + "Action Updates:\n"; | ||
(_a = this.eventLoopState) === null || _a === void 0 ? void 0 : _a.actionUpdates.forEach(item => { | ||
text = text + " " + item.toString() + "\n"; | ||
}); | ||
if (this.currentBehavior != null) { | ||
text = text + "Current Behavior:\n"; | ||
text = text + this.currentBehavior.toString(); | ||
} | ||
} | ||
else { | ||
text = "No current event."; | ||
} | ||
return text; | ||
} | ||
addUntrackedBehaviors() { | ||
@@ -503,6 +522,7 @@ if (this.untrackedBehaviors.length > 0) { | ||
if (this.cycleDFS(behavior, behavior, stack)) { | ||
while (stack.length > 0) { | ||
let rez = stack.pop(); | ||
output.push(rez); | ||
} | ||
output = stack; | ||
// while (stack.length > 0) { | ||
// let rez = stack.pop(); | ||
// output.push(rez!); | ||
// } | ||
} | ||
@@ -514,5 +534,5 @@ return output; | ||
for (let r of currentBehavior.demands) { | ||
stack.push(r); | ||
let b = r.suppliedBy; | ||
if (b != null) { | ||
stack.push(r); | ||
if (b == target) { | ||
@@ -519,0 +539,0 @@ return true; |
@@ -25,2 +25,3 @@ import { Behavior } from "./behavior.js"; | ||
get type(): LinkType; | ||
toString(): string; | ||
assertValidUpdater(): void; | ||
@@ -39,2 +40,3 @@ assertValidAccessor(): void; | ||
get event(): GraphEvent | null; | ||
toString(): string; | ||
justUpdatedTo(value: T): boolean; | ||
@@ -53,2 +55,3 @@ updateWithAction(value?: T | undefined, debugName?: string): void; | ||
constructor(extent: Extent, initialState: T, name?: string); | ||
toString(): string; | ||
updateWithAction(newValue: T, debugName?: string): void; | ||
@@ -55,0 +58,0 @@ update(newValue: T): void; |
@@ -38,2 +38,9 @@ "use strict"; | ||
} | ||
toString() { | ||
let name = "Resource"; | ||
if (this.debugName != null) { | ||
name = this.debugName + "(r)"; | ||
} | ||
return name; | ||
} | ||
assertValidUpdater() { | ||
@@ -120,2 +127,15 @@ let graph = this.graph; | ||
} | ||
toString() { | ||
let name = "Moment"; | ||
if (this.debugName != null) { | ||
name = (this.debugName + "(m)"); | ||
} | ||
if (this._happenedValue !== undefined) { | ||
name = name + "=" + this._happenedValue; | ||
} | ||
if (this._happenedWhen !== null) { | ||
name = name + " : " + this._happenedWhen.sequence; | ||
} | ||
return name; | ||
} | ||
justUpdatedTo(value) { | ||
@@ -151,2 +171,11 @@ return this.justUpdated && this._happenedValue == value; | ||
} | ||
toString() { | ||
let name = "State"; | ||
if (this.debugName != null) { | ||
name = (this.debugName + "(s)"); | ||
} | ||
name = name + "=" + this.currentState.value; | ||
name = name + " : " + this.currentState.event.sequence; | ||
return name; | ||
} | ||
updateWithAction(newValue, debugName) { | ||
@@ -153,0 +182,0 @@ this.graph.action(() => { |
@@ -24,2 +24,3 @@ import { Orderable } from "./bufferedqueue.js"; | ||
constructor(extent: Extent, demands: Demandable[] | null, supplies: Resource[] | null, block: (extent: Extent) => void); | ||
toString(): string; | ||
setDynamicDemands(newDemands: (Demandable | undefined)[] | null): void; | ||
@@ -26,0 +27,0 @@ setDynamicSupplies(newSupplies: (Resource | undefined)[] | null): void; |
@@ -36,2 +36,21 @@ // | ||
} | ||
toString() { | ||
let name = "Behavior (" + this.order + ")"; | ||
if (this.enqueuedWhen != null) { | ||
name = name + " : " + this.enqueuedWhen; | ||
} | ||
if (this.supplies != null && this.supplies?.size > 0) { | ||
name = name + " \n Supplies:"; | ||
this.supplies?.forEach(item => { | ||
name = name + "\n " + item.toString(); | ||
}); | ||
} | ||
if (this.demands != null && this.demands?.size > 0) { | ||
name = name + " \n Demands:"; | ||
this.demands?.forEach(item => { | ||
name = name + "\n " + item.toString(); | ||
}); | ||
} | ||
return name; | ||
} | ||
setDynamicDemands(newDemands) { | ||
@@ -38,0 +57,0 @@ this.extent.graph.updateDemands(this, newDemands?.filter(item => item != undefined)); |
@@ -33,2 +33,3 @@ import { Graph } from "./graph.js"; | ||
constructor(graph: Graph); | ||
debugHere(): string; | ||
unifyLifetime<T extends Extent>(extent: T): void; | ||
@@ -35,0 +36,0 @@ addChildLifetime<T extends Extent>(extent: T): void; |
@@ -126,2 +126,5 @@ // | ||
} | ||
debugHere() { | ||
return this.graph.debugHere(); | ||
} | ||
unifyLifetime(extent) { | ||
@@ -128,0 +131,0 @@ if (this.lifetime == null) { |
@@ -59,2 +59,3 @@ import { BufferedPriorityQueue } from "./bufferedqueue.js"; | ||
sideEffectHelper(sideEffect: SideEffect): void; | ||
debugHere(): string; | ||
private addUntrackedBehaviors; | ||
@@ -61,0 +62,0 @@ private addUntrackedSupplies; |
@@ -276,2 +276,20 @@ // | ||
} | ||
debugHere() { | ||
let text = ""; | ||
if (this.currentEvent != null) { | ||
text = "Current Event: " + this.currentEvent.sequence + "\n"; | ||
text = text + "Action Updates:\n"; | ||
this.eventLoopState?.actionUpdates.forEach(item => { | ||
text = text + " " + item.toString() + "\n"; | ||
}); | ||
if (this.currentBehavior != null) { | ||
text = text + "Current Behavior:\n"; | ||
text = text + this.currentBehavior.toString(); | ||
} | ||
} | ||
else { | ||
text = "No current event."; | ||
} | ||
return text; | ||
} | ||
addUntrackedBehaviors() { | ||
@@ -486,6 +504,7 @@ if (this.untrackedBehaviors.length > 0) { | ||
if (this.cycleDFS(behavior, behavior, stack)) { | ||
while (stack.length > 0) { | ||
let rez = stack.pop(); | ||
output.push(rez); | ||
} | ||
output = stack; | ||
// while (stack.length > 0) { | ||
// let rez = stack.pop(); | ||
// output.push(rez!); | ||
// } | ||
} | ||
@@ -497,5 +516,5 @@ return output; | ||
for (let r of currentBehavior.demands) { | ||
stack.push(r); | ||
let b = r.suppliedBy; | ||
if (b != null) { | ||
stack.push(r); | ||
if (b == target) { | ||
@@ -502,0 +521,0 @@ return true; |
@@ -25,2 +25,3 @@ import { Behavior } from "./behavior.js"; | ||
get type(): LinkType; | ||
toString(): string; | ||
assertValidUpdater(): void; | ||
@@ -39,2 +40,3 @@ assertValidAccessor(): void; | ||
get event(): GraphEvent | null; | ||
toString(): string; | ||
justUpdatedTo(value: T): boolean; | ||
@@ -53,2 +55,3 @@ updateWithAction(value?: T | undefined, debugName?: string): void; | ||
constructor(extent: Extent, initialState: T, name?: string); | ||
toString(): string; | ||
updateWithAction(newValue: T, debugName?: string): void; | ||
@@ -55,0 +58,0 @@ update(newValue: T): void; |
@@ -39,2 +39,9 @@ // | ||
} | ||
toString() { | ||
let name = "Resource"; | ||
if (this.debugName != null) { | ||
name = this.debugName + "(r)"; | ||
} | ||
return name; | ||
} | ||
assertValidUpdater() { | ||
@@ -115,2 +122,15 @@ let graph = this.graph; | ||
} | ||
toString() { | ||
let name = "Moment"; | ||
if (this.debugName != null) { | ||
name = (this.debugName + "(m)"); | ||
} | ||
if (this._happenedValue !== undefined) { | ||
name = name + "=" + this._happenedValue; | ||
} | ||
if (this._happenedWhen !== null) { | ||
name = name + " : " + this._happenedWhen.sequence; | ||
} | ||
return name; | ||
} | ||
justUpdatedTo(value) { | ||
@@ -146,2 +166,11 @@ return this.justUpdated && this._happenedValue == value; | ||
} | ||
toString() { | ||
let name = "State"; | ||
if (this.debugName != null) { | ||
name = (this.debugName + "(s)"); | ||
} | ||
name = name + "=" + this.currentState.value; | ||
name = name + " : " + this.currentState.event.sequence; | ||
return name; | ||
} | ||
updateWithAction(newValue, debugName) { | ||
@@ -148,0 +177,0 @@ this.graph.action(() => { |
{ | ||
"name": "behavior-graph", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"main": "lib/cjs/index.js", | ||
@@ -5,0 +5,0 @@ "module": "lib/mjs/index.js", |
@@ -45,2 +45,22 @@ // | ||
toString() { | ||
let name = "Behavior (" + this.order + ")" | ||
if (this.enqueuedWhen != null) { | ||
name = name + " : " + this.enqueuedWhen | ||
} | ||
if (this.supplies != null && this.supplies?.size > 0) { | ||
name = name + " \n Supplies:" | ||
this.supplies?.forEach(item => { | ||
name = name + "\n " + item.toString() | ||
}); | ||
} | ||
if (this.demands != null && this.demands?.size > 0) { | ||
name = name + " \n Demands:" | ||
this.demands?.forEach(item => { | ||
name = name + "\n " + item.toString() | ||
}); | ||
} | ||
return name; | ||
} | ||
setDynamicDemands(newDemands: (Demandable | undefined)[] | null) { | ||
@@ -47,0 +67,0 @@ this.extent.graph.updateDemands(this, newDemands?.filter(item => item != undefined) as (Demandable[] | null)); |
@@ -137,2 +137,6 @@ // | ||
debugHere(): string { | ||
return this.graph.debugHere(); | ||
} | ||
unifyLifetime<T extends Extent>(extent: T) { | ||
@@ -139,0 +143,0 @@ if (this.lifetime == null) { |
@@ -324,2 +324,20 @@ // | ||
debugHere(): string { | ||
let text = "" | ||
if (this.currentEvent != null) { | ||
text = "Current Event: " + this.currentEvent.sequence + "\n"; | ||
text = text + "Action Updates:\n"; | ||
this.eventLoopState?.actionUpdates.forEach(item => { | ||
text = text + " " + item.toString() + "\n"; | ||
}) | ||
if (this.currentBehavior != null) { | ||
text = text + "Current Behavior:\n"; | ||
text = text + this.currentBehavior.toString(); | ||
} | ||
} else { | ||
text = "No current event."; | ||
} | ||
return text | ||
} | ||
private addUntrackedBehaviors() { | ||
@@ -562,6 +580,7 @@ if (this.untrackedBehaviors.length > 0) { | ||
if (this.cycleDFS(behavior, behavior, stack)) { | ||
while (stack.length > 0) { | ||
let rez = stack.pop(); | ||
output.push(rez!); | ||
} | ||
output = stack; | ||
// while (stack.length > 0) { | ||
// let rez = stack.pop(); | ||
// output.push(rez!); | ||
// } | ||
} | ||
@@ -574,5 +593,5 @@ return output; | ||
for (let r of currentBehavior.demands) { | ||
stack.push(r) | ||
let b = r.suppliedBy; | ||
if (b != null) { | ||
stack.push(r) | ||
if (b == target) { | ||
@@ -579,0 +598,0 @@ return true; |
@@ -53,2 +53,10 @@ // | ||
toString() { | ||
let name = "Resource"; | ||
if (this.debugName != null) { | ||
name = this.debugName + "(r)"; | ||
} | ||
return name; | ||
} | ||
assertValidUpdater() { | ||
@@ -137,2 +145,16 @@ let graph = this.graph; | ||
toString() { | ||
let name = "Moment"; | ||
if (this.debugName != null) { | ||
name = (this.debugName + "(m)" ) | ||
} | ||
if (this._happenedValue !== undefined) { | ||
name = name + "=" + this._happenedValue; | ||
} | ||
if (this._happenedWhen !== null) { | ||
name = name + " : " + this._happenedWhen!.sequence | ||
} | ||
return name; | ||
} | ||
justUpdatedTo(value: T): boolean { | ||
@@ -176,2 +198,12 @@ return this.justUpdated && this._happenedValue == value; | ||
toString() { | ||
let name = "State"; | ||
if (this.debugName != null) { | ||
name = (this.debugName + "(s)" ); | ||
} | ||
name = name + "=" + this.currentState.value; | ||
name = name + " : " + this.currentState.event.sequence; | ||
return name; | ||
} | ||
updateWithAction(newValue: T, debugName?: string) { | ||
@@ -178,0 +210,0 @@ this.graph.action(() => { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
358251
4.11%6336
4.85%2
-60%1
Infinity%