import { CollisionEvent } from "./collision-event";
export class CollisionMatrix {
    constructor(world) {
        this.world = world;
        this.collisions = [];
    }
    add(a, b) {
        this.collisions.push(new CollisionEvent(a, b));
    }
    remove(a, b) {
        for (let i = 0; i < this.collisions.length; i++) {
            if (this.collisions[i].bodyA == a && this.collisions[i].bodyB == b) {
                this.collisions.slice(i, 1);
                return;
            }
        }
    }
    contains(ev) {
        for (let i = 0; i < this.collisions.length; i++) {
            if (this.collisions[i].equals(ev))
                return true;
        }
        return false;
    }
    length() {
        return this.collisions.length;
    }
    getIndex(i) {
        if (i >= this.collisions.length)
            return null;
        return this.collisions[i];
    }
    clear() {
        this.collisions = [];
    }
}
