import { element } from 'prop-types'; export namespace Ethics { class eth_template { protected key: string = ""; private data: Array<{type: Scale, value: number}> = [] constructor(data: Array<{type: Scale, value: number}>) { this.data = data; } sum(weigthed: boolean): number { let sum = 0; this.data.forEach((element) => { if (weigthed) { sum = sum + element.value * element.type; } else { sum = sum + element.value * 1; } }); return sum; } sumRegular(): number { let sum = 0; this.data.forEach((element) => { if (element.type == Scale.normal) { sum = sum + element.value; } }); return sum; } entries(): number { let sum = 0; this.data.forEach((element) => { sum = sum + element.value; }); return sum; } getKey(): string { return this.key } } export class ega extends eth_template { protected key = "Egalitarian"; } export class aut extends eth_template { protected key = "Authoritarian"; } export class mil extends eth_template { protected key = "Militarist"; } export class pac extends eth_template { protected key = "Pacifist"; } export class pho extends eth_template { protected key = "Xenophobe"; } export class phi extends eth_template { protected key = "Xenophile"; } export class com extends eth_template { protected key = "Competitive"; } export class coo extends eth_template { protected key = "Cooperative"; } export class eli extends eth_template { protected key = "Elitist"; } export class plu extends eth_template { protected key = "Pluralist"; } export class mat extends eth_template { protected key = "Materialist"; } export class spi extends eth_template { protected key = "Spiritualist"; } export class eco extends eth_template { protected key = "Ecologist"; } export class ind extends eth_template { protected key = "Industrialist"; } } export enum Scale { normal = 1, fanatic = 2 }