2017-11-08 11:30:34 +01:00
|
|
|
|
|
|
|
|
module mod_vtm_aufbau
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author kcf <vidofnir@folksprak.org>
|
|
|
|
|
*/
|
|
|
|
|
export class klasse_figur
|
|
|
|
|
{
|
|
|
|
|
|
2017-11-08 15:05:06 +01:00
|
|
|
/**
|
|
|
|
|
* @author kcf <vidofnir@folksprak.org>
|
|
|
|
|
*/
|
|
|
|
|
private zustand : typ_zustand;
|
|
|
|
|
|
|
|
|
|
|
2017-11-08 11:30:34 +01:00
|
|
|
/**
|
|
|
|
|
* @author kcf <vidofnir@folksprak.org>
|
|
|
|
|
*/
|
|
|
|
|
private band : Array<typ_symbol>;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author kcf <vidofnir@folksprak.org>
|
|
|
|
|
*/
|
2017-11-08 15:05:06 +01:00
|
|
|
private stelle : typ_stelle;
|
2017-11-08 11:30:34 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author kcf <vidofnir@folksprak.org>
|
|
|
|
|
*/
|
2017-11-08 15:05:06 +01:00
|
|
|
public constructor(band : Array<typ_symbol> = [], stelle : typ_stelle = stelle_null())
|
2017-11-08 11:30:34 +01:00
|
|
|
{
|
2017-11-08 15:05:06 +01:00
|
|
|
this.zustand = zustand_normal;
|
2017-11-08 11:30:34 +01:00
|
|
|
this.band = band;
|
2017-11-08 15:05:06 +01:00
|
|
|
this.stelle = stelle;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author kcf <vidofnir@folksprak.org>
|
|
|
|
|
*/
|
|
|
|
|
public zustand_lesen() : typ_zustand
|
|
|
|
|
{
|
|
|
|
|
return this.zustand;
|
2017-11-08 11:30:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2017-11-08 18:41:56 +01:00
|
|
|
/**
|
|
|
|
|
* @author kcf <vidofnir@folksprak.org>
|
|
|
|
|
*/
|
|
|
|
|
public band_lesen() : Array<typ_symbol>
|
|
|
|
|
{
|
|
|
|
|
return this.band;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2017-11-08 11:30:34 +01:00
|
|
|
/**
|
|
|
|
|
* @author kcf <vidofnir@folksprak.org>
|
|
|
|
|
*/
|
2017-11-08 15:05:06 +01:00
|
|
|
public stelle_lesen() : typ_stelle
|
2017-11-08 11:30:34 +01:00
|
|
|
{
|
2017-11-08 15:05:06 +01:00
|
|
|
return this.stelle;
|
2017-11-08 11:30:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author kcf <vidofnir@folksprak.org>
|
|
|
|
|
*/
|
|
|
|
|
public bewegen(richtung : typ_richtung) : void
|
|
|
|
|
{
|
2017-11-08 15:05:06 +01:00
|
|
|
let summand : typ_stelle = stelle_von_richtung(richtung);
|
|
|
|
|
this.stelle = stelle_addieren(this.stelle, summand);
|
2017-11-08 11:30:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author kcf <vidofnir@folksprak.org>
|
|
|
|
|
*/
|
2017-11-08 18:41:56 +01:00
|
|
|
public schreiben(symbol : typ_symbol) : void
|
2017-11-08 11:30:34 +01:00
|
|
|
{
|
|
|
|
|
this.band.push(symbol);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author kcf <vidofnir@folksprak.org>
|
|
|
|
|
*/
|
2017-11-08 18:41:56 +01:00
|
|
|
public lesen() : schnittstelle_fehlermonade<typ_symbol>
|
2017-11-08 11:30:34 +01:00
|
|
|
{
|
|
|
|
|
if (this.band.length <= 0)
|
|
|
|
|
{
|
|
|
|
|
return (new klasse_nichts<typ_symbol>());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return (new klasse_schlicht<typ_symbol>(this.band[0]));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-08 15:05:06 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author kcf <vidofnir@folksprak.org>
|
|
|
|
|
*/
|
2017-11-08 18:41:56 +01:00
|
|
|
public schieben() : void
|
2017-11-08 15:05:06 +01:00
|
|
|
{
|
|
|
|
|
if (this.band.length <= 0)
|
|
|
|
|
{
|
|
|
|
|
let meldung : string = "Band ist leer";
|
|
|
|
|
throw (new Error(meldung));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
this.band.shift();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author kcf <vidofnir@folksprak.org>
|
|
|
|
|
*/
|
|
|
|
|
public annehmen() : void
|
|
|
|
|
{
|
|
|
|
|
this.zustand = zustand_fertig;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author kcf <vidofnir@folksprak.org>
|
|
|
|
|
*/
|
|
|
|
|
public verwerfen() : void
|
|
|
|
|
{
|
|
|
|
|
this.zustand = zustand_tot;
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-08 11:30:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|