Skip to content

Commit

Permalink
refact: deprecate getting phase from name
Browse files Browse the repository at this point in the history
  • Loading branch information
asmfstatoil committed Feb 27, 2024
1 parent 77b36e0 commit 2f27f1f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
10 changes: 9 additions & 1 deletion src/main/java/neqsim/thermo/system/SystemInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,10 @@ public default double getGamma2() {
* @param phaseTypeName a {@link java.lang.String} object
* @return a {@link neqsim.thermo.phase.PhaseInterface} object
*/
public PhaseInterface getPhase(String phaseTypeName);
@Deprecated
public default PhaseInterface getPhase(String phaseTypeName) {
return getPhase(PhaseType.byDesc(phaseTypeName));
}

/**
* <p>
Expand Down Expand Up @@ -666,6 +669,7 @@ public default double getGamma2() {
* @param phaseTypeName a {@link java.lang.String} object
* @return PhaseIndex to index into phaseArray.
*/
@Deprecated
public int getPhaseIndex(String phaseTypeName);

/**
Expand Down Expand Up @@ -925,6 +929,7 @@ public default double getGamma2() {
* supported)
* @return a {@link neqsim.thermo.phase.PhaseInterface} object
*/
@Deprecated
public PhaseInterface getPhaseOfType(String phaseTypeName);

/**
Expand Down Expand Up @@ -1018,6 +1023,7 @@ public void addPlusFraction(String componentName, double numberOfMoles, double m
* @param phaseTypeName PhaseType to look for
* @return True if system contains a phase of requested type
*/
@Deprecated
public default boolean hasPhaseType(String phaseTypeName) {
return hasPhaseType(PhaseType.byDesc(phaseTypeName));
}
Expand Down Expand Up @@ -2209,6 +2215,7 @@ public default ComponentInterface getComponent(int i) {
* @param unit mole/volume/weight
* @return phase: fraction in specified unit
*/
@Deprecated
public double getPhaseFraction(String phaseTypeName, String unit);

/**
Expand Down Expand Up @@ -2383,6 +2390,7 @@ public default double getNumberOfMoles() {
* @param phaseTypeName Name of phase type to look for
* @return Phase number
*/
@Deprecated
public default int getPhaseNumberOfPhase(String phaseTypeName) {
return getPhaseNumberOfPhase(PhaseType.byDesc(phaseTypeName));
}
Expand Down
9 changes: 1 addition & 8 deletions src/main/java/neqsim/thermo/system/SystemThermo.java
Original file line number Diff line number Diff line change
Expand Up @@ -2352,13 +2352,6 @@ public PhaseInterface getPhase(PhaseType pt) {
return null;
}

/** {@inheritDoc} */
@Override
public PhaseInterface getPhase(String phaseTypeName) {
PhaseType pt = PhaseType.byDesc(phaseTypeName);
return getPhase(pt);
}

/** {@inheritDoc} */
@Override
public PhaseInterface getPhaseOfType(String phaseTypeName) {
Expand Down Expand Up @@ -2392,7 +2385,7 @@ public final int getPhaseIndex(int index) {
@Override
public int getPhaseIndex(String phaseTypeName) {
// TODO: returning first if not found, not same as the others.
for (int i = 0; i < numberOfPhases; i++) {
for (int i = 0; i < getNumberOfPhases(); i++) {
if (getPhase(i).getPhaseTypeName().equals(phaseTypeName)) {
return phaseIndex[i];
}
Expand Down

0 comments on commit 2f27f1f

Please sign in to comment.