import Role from './Role'; class Frame { roles: Role[]; constructor(roles: Role[]) { const predCount = roles.filter(role=>role.isPredicate).length; if(predCount !== 1) { throw new Error("A frame must have exactly 1 predicate. got "+predCount); } this.roles = roles.sort(function(a,b){ return a.beginTokenIndex - b.beginTokenIndex; }); Object.freeze(this); } static getPredicateIndex(frame:Frame):number { for(let i=0; i