data structure bl

This commit is contained in:
Jan Barfuss 2023-12-23 21:36:34 +01:00
parent 1ee58fa90d
commit 2a8f5635dc

View File

@ -2,18 +2,18 @@ import * as cheerio from 'cheerio';
class Campus { class Campus {
name: string; name: string;
mensen: Mensa[]; locations: Mensa[];
constructor(name: string) { constructor(name: string) {
this.name = name; this.name = name;
this.mensen = []; this.locations = [];
} }
addMensa(mensa: Mensa) { addMensa(mensa: Mensa) {
this.mensen.push(mensa); this.locations.push(mensa);
} }
toString() { toString() {
let str = this.name + "\n"; let str = this.name + "\n";
this.mensen.forEach((elem) => { this.locations.forEach((elem) => {
str += " -> " + elem.name + " | " + elem.url + "\n"; str += " -> " + elem.name + " | " + elem.url + "\n";
}); });
return str; return str;