Commit 9520206f authored by Grand Francois's avatar Grand Francois
Browse files

#47 NubFactory : ajout de la méthode deleteSessionNub()

Showing with 31 additions and 0 deletions
+31 -0
......@@ -86,6 +86,24 @@ export class NubFactory {
}
}
private deleteStructureNub(n: Nub) {
if (n instanceof Structure) {
for (const sn of this._session)
if (sn.nub instanceof ParallelStructure) {
const psn = sn.nub as ParallelStructure;
let i = 0;
for (const st of psn.structures) {
if (st.uid == n.uid) {
psn.deleteStructure(i);
return;
}
i++;
}
}
throw new Error(`NubFactory.deleteStructureNub() : la structure (uid ${n.uid}) à supprimer n'a pas été trouvée`);
}
}
/**
* remplace un SessionNub par un nouveau
* @param sn SessionNub à remplacer
......@@ -205,6 +223,19 @@ export class NubFactory {
}
}
public deleteSessionNub(sn: SessionNub) {
let i = 0;
for (const n of this._session) {
if (n.uid == sn.uid) {
this._session.splice(i, 1);
this.deleteStructureNub(sn.nub);
return;
}
i++;
}
throw new Error(`NubFactory.deleteSessionNub() : le SessionNub (uid ${sn.uid}) à supprimer n'a pas été trouvé`);
}
private createSection(nt: ComputeNodeType): acSection {
switch (nt) {
case ComputeNodeType.None: // pour les paramètres communs, n'importe quelle section convient
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment