Compare commits

..

No commits in common. "e15cc0e410c75191ff0a2d8b1201b6bfe2ca2021" and "c1dde87e300b734793e8434d7d41129681f7ed1f" have entirely different histories.

4 changed files with 8 additions and 53 deletions

View File

@ -1,24 +0,0 @@
import { LabelObject } from "./Label"
import type { Model } from "./Model";
/**
*
*/
class CtrlObject extends LabelObject {
/**
*
*/
protected model: Model;
/**
*
*/
public constructor(model: Model) {
super();
this.model = model;
}
}
export default CtrlObject;
export { CtrlObject };

View File

@ -1,12 +1,11 @@
import { Individual } from "./Individual"; import { Individual } from "./Individual";
import { CtrlObject } from "./CtrlObject";
import type { Behavior } from "./Behavior"; import type { Behavior } from "./Behavior";
import type { Model } from "./Model"; import type { Model } from "./Model";
/** /**
* *
*/ */
class Group extends CtrlObject { class Group {
/** /**
* *
@ -112,10 +111,10 @@ class Group extends CtrlObject {
* *
* @param * @param
*/ */
public runner(t: number): void { public runner(model: Model, t: number): void {
this.individuals.forEach((individual) => { this.individuals.forEach((individual) => {
for(let j = 0; j < this.behaviors.length; j++) { for(let j = 0; j < this.behaviors.length; j++) {
this.behaviors[j].effect(individual, this, this.model, t); this.behaviors[j].effect(individual, this, model, t);
} }
}); });
} }

View File

@ -44,20 +44,20 @@ class LabelObject {
/** /**
* *
*/ */
private labels: Label[] = []; private labels: Set<Label> = new Set();
/** /**
* Label * Label
*/ */
public allLabels(): Label[] { public allLabels(): Label[] {
return this.labels.concat([]); return Array.from(this.labels);
} }
/** /**
* *
*/ */
public addLabel(label: Label): this { public addLabel(label: Label): this {
this.labels.push(label); this.labels.add(label);
return this; return this;
} }
@ -65,9 +65,7 @@ class LabelObject {
* *
*/ */
public removeLabel(label: Label): this { public removeLabel(label: Label): this {
this.labels = this.labels.filter((localLabel) => { this.labels.delete(label);
return !localLabel.equal(label);
});
return this; return this;
} }
@ -82,5 +80,3 @@ class LabelObject {
return has; return has;
} }
} }
export { Label, LabelObject };

View File

@ -1,16 +0,0 @@
import { CtrlObject } from "./CtrlObject";
/**
*
*/
class Range extends CtrlObject {
/**
*
*/
public position: number[] = [];
}
export default Range;
export { Range };