module mod_vtm_aufbau { /** * @author kcf */ export class klasse_figur { /** * @author kcf */ private zustand : typ_zustand; /** * @author kcf */ private band : Array; /** * @author kcf */ private stelle : typ_stelle; /** * @author kcf */ public constructor(band : Array = [], stelle : typ_stelle = stelle_null()) { this.zustand = zustand_normal; this.band = band; this.stelle = stelle; } /** * @author kcf */ public zustand_lesen() : typ_zustand { return this.zustand; } /** * @author kcf */ public band_lesen() : Array { return this.band; } /** * @author kcf */ public stelle_lesen() : typ_stelle { return this.stelle; } /** * @author kcf */ public bewegen(richtung : typ_richtung) : void { let summand : typ_stelle = stelle_von_richtung(richtung); this.stelle = stelle_addieren(this.stelle, summand); } /** * @author kcf */ public schreiben(symbol : typ_symbol) : void { this.band.push(symbol); } /** * @author kcf */ public lesen() : schnittstelle_fehlermonade { if (this.band.length <= 0) { return (new klasse_nichts()); } else { return (new klasse_schlicht(this.band[0])); } } /** * @author kcf */ public schieben() : void { if (this.band.length <= 0) { let meldung : string = "Band ist leer"; throw (new Error(meldung)); } else { this.band.shift(); } } /** * @author kcf */ public annehmen() : void { this.zustand = zustand_fertig; } /** * @author kcf */ public verwerfen() : void { this.zustand = zustand_tot; } } }