Skip to content

Commit e38f402

Browse files
committed
refact: simplify SystemSrkCPA subclass constructors
1 parent 8775862 commit e38f402

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

src/main/java/neqsim/thermo/system/SystemSrkCPAs.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ public SystemSrkCPAs(double T, double P) {
4444
* @param checkForSolids Set true to do solid phase check and calculations
4545
*/
4646
public SystemSrkCPAs(double T, double P, boolean checkForSolids) {
47-
super(T, P);
48-
this.solidPhaseCheck = checkForSolids;;
47+
super(T, P, checkForSolids);
4948
modelName = "CPAs-SRK-EOS";
5049

50+
// Recreates phases created in super constructor SystemSrkCPA
5151
for (int i = 0; i < numberOfPhases; i++) {
5252
phaseArray[i] = new PhaseSrkCPAsOld();
5353
phaseArray[i].setTemperature(T);
@@ -80,10 +80,6 @@ public SystemSrkCPAs clone() {
8080
logger.error("Cloning failed.", ex);
8181
}
8282

83-
// for(int i = 0; i < numberOfPhases; i++) {
84-
// clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
85-
// }
86-
8783
return clonedSystem;
8884
}
8985
}

src/main/java/neqsim/thermo/system/SystemSrkCPAstatoil.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,11 @@ public SystemSrkCPAstatoil(double T, double P) {
3838
* @param checkForSolids Set true to do solid phase check and calculations
3939
*/
4040
public SystemSrkCPAstatoil(double T, double P, boolean checkForSolids) {
41-
super(T, P);
42-
this.solidPhaseCheck = checkForSolids;;
41+
super(T, P, checkForSolids);
4342
modelName = "CPAs-SRK-EOS-statoil";
4443
attractiveTermNumber = 15;
44+
45+
// Recreates phases created in super constructor SystemSrkCPAs
4546
for (int i = 0; i < numberOfPhases; i++) {
4647
phaseArray[i] = new PhaseSrkCPAs();
4748
phaseArray[i].setTemperature(T);
@@ -74,10 +75,6 @@ public SystemSrkCPAstatoil clone() {
7475
logger.error("Cloning failed.", ex);
7576
}
7677

77-
// for(int i = 0; i < numberOfPhases; i++) {
78-
// clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
79-
// }
80-
8178
return clonedSystem;
8279
}
8380
}

0 commit comments

Comments
 (0)