class AdaptiveDifferential { public compareFunction : (noun : any) => boolean = () => false; public countsAs = 0; constructor (replacer : (noun : any) => boolean) { this.compareFunction = replacer; } public isMatch (noun : any) { return this.compareFunction(noun); } public static ANYOF (...acceptableValues) { return new AdaptiveDifferential((noun : any) => { //console.log(acceptableValues, noun); for (let i = 0; i < acceptableValues.length; i++) { if (ContentDifferential.compareNouns(acceptableValues[i], noun)) { return true; } } return false; }); } public static FULLYADAPTIVE (...acceptableValues) { let ad = AdaptiveDifferential.ANYOF(...acceptableValues); ad.countsAs = -1; return ad; } public static MALE = new AdaptiveDifferential((noun : any) => { if (noun instanceof Humanoid) { return noun.isMale(); } return false; }); public static FEMALE = new AdaptiveDifferential((noun : any) => { if (noun instanceof Humanoid) { return noun.isMale(); } return false; }); public static MASCULINE = new AdaptiveDifferential((noun : any) => { if (noun instanceof Humanoid) { return noun.getGenderValue().genderValueCorrected <= 50; } return false; }); public static FEMININE = new AdaptiveDifferential((noun : any) => { if (noun instanceof Humanoid) { return noun.getGenderValue().genderValueCorrected >= 50; } return false; }); }