diff --git a/src/structure/structure_props.ts b/src/structure/structure_props.ts index 4fcd468b552069fa17b36c8fc61626d3dcbdc066..0988e11ff4cb35812c067cf1fdba7fc05c44d896 100644 --- a/src/structure/structure_props.ts +++ b/src/structure/structure_props.ts @@ -77,10 +77,20 @@ export class StructureProperties { } /** - * @return la 1ère valeur de LoiDebit compatible avec le type de structure + * trouve la 1ère valeur de LoiDebit compatible avec le type de structure + * @param struct type de structure avec laquelle la loi de débit doit être compatible + * @param subset si non vide, recherche la loi de débit compatible dans ce tableau; sinon prend la 1ere */ - public static findCompatibleLoiDebit(struct: StructureType): LoiDebit { + public static findCompatibleLoiDebit(struct: StructureType, subset: LoiDebit[]): LoiDebit { const sst: string = StructureType[struct]; - return loiAdmissibles[sst][0]; + + if (subset.length === 0) + return loiAdmissibles[sst][0]; + + for (const ld of loiAdmissibles[sst]) + if (subset.includes(ld)) + return ld; + + return undefined; } }