From 528b3ca6d8bf3c4ec07c0c26f3fa9464b7318954 Mon Sep 17 00:00:00 2001 From: Sviatoslav Eroshkin <109044598+Sviatose@users.noreply.github.com> Date: Sat, 13 Jan 2024 15:56:57 +0100 Subject: [PATCH] feat: module class add get meas device (#903) --- .../processSystem/ProcessModule.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/main/java/neqsim/processSimulation/processSystem/ProcessModule.java b/src/main/java/neqsim/processSimulation/processSystem/ProcessModule.java index 705948fce4..b3c0348a25 100644 --- a/src/main/java/neqsim/processSimulation/processSystem/ProcessModule.java +++ b/src/main/java/neqsim/processSimulation/processSystem/ProcessModule.java @@ -224,6 +224,32 @@ public Object getUnit(String name) { return null; // no unit found with the given name } + + + /** + * Returns the unit with the given name from the list of added unit operations and list of added + * modules. + * + * @param name the name of the unit to retrieve + * @return the unit with the given name, or {@code null} if no such unit is found + */ + public Object getMeasurumentDevice(String name) { + for (ProcessSystem processSystem : addedUnitOperations) { + Object unit = processSystem.getMeasurementDevice(name); + if (unit != null) { + return unit; + } + } + + for (ProcessModule processModule : addedModules) { + Object unit = processModule.getMeasurumentDevice(name); + if (unit != null) { + return unit; + } + } + return null; // no unit found with the given name + } + /** *
* Create deep copy.