Skip to content

Commit

Permalink
refact: simplified if-else nesting
Browse files Browse the repository at this point in the history
  • Loading branch information
asmfstatoil committed May 19, 2023
1 parent b33a319 commit 0abdf7e
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/main/java/neqsim/thermo/system/SystemThermo.java
Original file line number Diff line number Diff line change
Expand Up @@ -236,16 +236,14 @@ public SystemInterface addFluid(SystemInterface addSystem) {

if (index != -1) {
addComponent(index, addSystem.getPhase(0).getComponent(i).getNumberOfmoles());
} else if (addSystem.getPhase(0).getComponent(i).isIsTBPfraction()) {
addTBPfraction(
addSystem.getPhase(0).getComponent(i).getComponentName().replaceFirst("_PC", ""),
addSystem.getPhase(0).getComponent(i).getNumberOfmoles(),
addSystem.getPhase(0).getComponent(i).getMolarMass(),
addSystem.getPhase(0).getComponent(i).getNormalLiquidDensity());
} else {
if (addSystem.getPhase(0).getComponent(i).isIsTBPfraction()) {
addTBPfraction(
addSystem.getPhase(0).getComponent(i).getComponentName().replaceFirst("_PC", ""),
addSystem.getPhase(0).getComponent(i).getNumberOfmoles(),
addSystem.getPhase(0).getComponent(i).getMolarMass(),
addSystem.getPhase(0).getComponent(i).getNormalLiquidDensity());
} else {
addComponent(addSystem.getComponent(i));
}
addComponent(addSystem.getComponent(i));
}
}
if (addedNewComponent) {
Expand Down

0 comments on commit 0abdf7e

Please sign in to comment.