import { Type } from "./Type"; export enum ConcreteSystemType { LOCK, CONDITION, AGENT } export class SystemType extends Type { constructor(readonly concreteSystemType: ConcreteSystemType) { super(); } override equals(otherType: Type): boolean { return otherType instanceof SystemType && otherType.concreteSystemType == this.concreteSystemType; } override isAssignableTo(otherType: Type): boolean { return this.equals(otherType) } override toString(): string { switch (this.concreteSystemType) { case ConcreteSystemType.LOCK: return "lock"; case ConcreteSystemType.CONDITION: return "condition"; case ConcreteSystemType.AGENT: return "agent"; } } override get isConditionType() : boolean { return this.concreteSystemType == ConcreteSystemType.CONDITION; } override get isLockType() : boolean { return this.concreteSystemType == ConcreteSystemType.LOCK; } override get isAgentType() : boolean { return this.concreteSystemType == ConcreteSystemType.AGENT; } } export const SystemTypes = { lock: new SystemType(ConcreteSystemType.LOCK), condition: new SystemType(ConcreteSystemType.CONDITION), agent: new SystemType(ConcreteSystemType.AGENT) }