From 3b3fc51dfaaab7b873dea1ec00e6c00fc21d4cfe Mon Sep 17 00:00:00 2001 From: "francois.grand" <francois.grand@irstea.fr> Date: Thu, 26 Apr 2018 17:03:32 +0200 Subject: [PATCH] =?UTF-8?q?=20#47=20:=20ParallelStructure.addStructure()?= =?UTF-8?q?=20:=20ajout=20d'un=20param=C3=A8tre=20pour=20ajouter=20la=20st?= =?UTF-8?q?ructure=20apr=C3=A8s=20un=20indice=20donn=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/structure/parallel_structure.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/structure/parallel_structure.ts b/src/structure/parallel_structure.ts index d4dc9749..6184f7f4 100644 --- a/src/structure/parallel_structure.ts +++ b/src/structure/parallel_structure.ts @@ -58,9 +58,13 @@ export class ParallelStructure extends Nub { /** * Ajout d'une structure en parallèle * @param structure La structure à rajouter + * @param after position après laquelle insérer la structure, à la fin sinon */ - public addStructure(structure: Structure) { - this.structures.push(structure); + public addStructure(structure: Structure, after?: number) { + if (after !== undefined) + this.structures.splice(after + 1, 0, structure); + else + this.structures.push(structure); } /** -- GitLab