Skip to content

Commit

Permalink
refact: simplify preos subclass constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
asmfstatoil committed Mar 15, 2024
1 parent f3cedc5 commit 8775862
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 34 deletions.
9 changes: 2 additions & 7 deletions src/main/java/neqsim/thermo/system/SystemGERGwaterEos.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ public SystemGERGwaterEos(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemGERGwaterEos(double T, double P, boolean checkForSolids) {
super(T, P);
this.solidPhaseCheck = checkForSolids;;
super(T, P, checkForSolids);
modelName = "GERG-water-EOS";
attractiveTermNumber = 10;

// Recreates phases created in super constructor SystemPrEos
for (int i = 0; i < numberOfPhases; i++) {
phaseArray[i] = new PhasePrEos();
phaseArray[i].setTemperature(T);
Expand Down Expand Up @@ -81,11 +81,6 @@ public SystemGERGwaterEos clone() {
logger.error("Cloning failed.", ex);
}

// clonedSystem.phaseArray = (PhaseInterface[]) phaseArray.clone();
// for(int i = 0; i < numberOfPhases; i++) {
// clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
// }

return clonedSystem;
}
}
8 changes: 2 additions & 6 deletions src/main/java/neqsim/thermo/system/SystemPrCPA.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ public SystemPrCPA(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemPrCPA(double T, double P, boolean checkForSolids) {
super(T, P);
this.solidPhaseCheck = checkForSolids;;
super(T, P, checkForSolids);
modelName = "CPA-PR-EOS";

// Recreates phases created in super constructor SystemPrEos
for (int i = 0; i < numberOfPhases; i++) {
phaseArray[i] = new PhasePrCPA();
phaseArray[i].setTemperature(T);
Expand Down Expand Up @@ -80,10 +80,6 @@ public SystemPrCPA clone() {
logger.error("Cloning failed.", ex);
}

// for(int i = 0; i < numberOfPhases; i++) {
// clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
// }

return clonedSystem;
}
}
9 changes: 2 additions & 7 deletions src/main/java/neqsim/thermo/system/SystemPrDanesh.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ public SystemPrDanesh(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemPrDanesh(double T, double P, boolean checkForSolids) {
super(T, P);
this.solidPhaseCheck = checkForSolids;;
super(T, P, checkForSolids);
modelName = "PR-Danesh-EOS";
attractiveTermNumber = 9;

// Recreates phases created in super constructor SystemPrEos
for (int i = 0; i < numberOfPhases; i++) {
phaseArray[i] = new PhasePrEos();
phaseArray[i].setTemperature(T);
Expand Down Expand Up @@ -81,11 +81,6 @@ public SystemPrDanesh clone() {
logger.error("Cloning failed.", ex);
}

// clonedSystem.phaseArray = (PhaseInterface[]) phaseArray.clone();
// for(int i = 0; i < numberOfPhases; i++) {
// clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
// }

return clonedSystem;
}
}
9 changes: 2 additions & 7 deletions src/main/java/neqsim/thermo/system/SystemPrEosDelft1998.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ public SystemPrEosDelft1998(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemPrEosDelft1998(double T, double P, boolean checkForSolids) {
super(T, P);
this.solidPhaseCheck = checkForSolids;;
super(T, P, checkForSolids);
modelName = "PR Delft1998 EOS";
attractiveTermNumber = 7;

// Recreates phases created in super constructor SystemPrEos
for (int i = 0; i < numberOfPhases; i++) {
phaseArray[i] = new PhasePrEos();
phaseArray[i].setTemperature(T);
Expand Down Expand Up @@ -81,11 +81,6 @@ public SystemPrEosDelft1998 clone() {
logger.error("Cloning failed.", ex);
}

// clonedSystem.phaseArray = (PhaseInterface[]) phaseArray.clone();
// for(int i = 0; i < numberOfPhases; i++) {
// clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
// }

return clonedSystem;
}
}
9 changes: 2 additions & 7 deletions src/main/java/neqsim/thermo/system/SystemPrGassemEos.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ public SystemPrGassemEos(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemPrGassemEos(double T, double P, boolean checkForSolids) {
super(T, P);
this.solidPhaseCheck = checkForSolids;;
super(T, P, checkForSolids);
modelName = "PR-Gassem-EOS";
attractiveTermNumber = 8;

// Recreates phases created in super constructor SystemPrEos
for (int i = 0; i < numberOfPhases; i++) {
phaseArray[i] = new PhasePrEos();
phaseArray[i].setTemperature(T);
Expand Down Expand Up @@ -81,11 +81,6 @@ public SystemPrGassemEos clone() {
logger.error("Cloning failed.", ex);
}

// clonedSystem.phaseArray = (PhaseInterface[]) phaseArray.clone();
// for(int i = 0; i < numberOfPhases; i++) {
// clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
// }

return clonedSystem;
}
}

0 comments on commit 8775862

Please sign in to comment.