-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
58c04dd
commit 3dd93e6
Showing
36 changed files
with
410 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
src/main/java/neqsim/thermo/mixingrule/CPAMixingRuleType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package neqsim.thermo.mixingrule; | ||
|
||
import neqsim.util.exception.InvalidInputException; | ||
|
||
/** | ||
* Types of CPAMixingRule, relating to different kind of mixing rules relevant for CPA type phases. | ||
* Available types are: | ||
* <ul> | ||
* <li>CPA_RADOCH - 1 -</li> | ||
* <li>PCSAFTA_RADOCH - 3 -</li> | ||
* </ul> | ||
* | ||
* @author ASMF | ||
*/ | ||
public enum CPAMixingRuleType implements MixingRuleTypeInterface { | ||
CPA_RADOCH(1), PCSAFTA_RADOCH(3); | ||
|
||
/** Holder for old style integer pt. */ | ||
private final int value; | ||
/** Holder for old style string physical property description. */ | ||
|
||
// We know we'll never mutate this, so we can keep | ||
// a local copy for fast lookup in forName | ||
private static final CPAMixingRuleType[] copyOfValues = values(); | ||
|
||
/** | ||
* Constructor for CPAMixingRuleType enum. | ||
* | ||
* @param value Numeric value index for mixing rule | ||
*/ | ||
private CPAMixingRuleType(int value) { | ||
this.value = value; | ||
} | ||
|
||
/** | ||
* Getter for property value. | ||
* | ||
* @return Numeric index of phase type | ||
*/ | ||
@Deprecated | ||
public int getValue() { | ||
return this.value; | ||
} | ||
|
||
/** | ||
* Get CPAMixingRuleType by name. | ||
* | ||
* @param name Name to get CPAMixingRuleType for. | ||
* @return CPAMixingRuleType object | ||
*/ | ||
public static CPAMixingRuleType byName(String name) { | ||
for (CPAMixingRuleType mr : copyOfValues) { | ||
if (mr.name().equals(name.toUpperCase())) { | ||
return mr; | ||
} | ||
} | ||
throw new RuntimeException( | ||
new InvalidInputException("CPAMixingRuleType", "byName", "name", "is not valid.")); | ||
} | ||
|
||
/** | ||
* Get CPAMixingRuleType by value. | ||
* | ||
* @param value Value to get CPAMixingRuleType for. | ||
* @return CPAMixingRuleType object | ||
*/ | ||
public static CPAMixingRuleType byValue(int value) { | ||
for (CPAMixingRuleType mr : copyOfValues) { | ||
if (mr.getValue() == (value)) { | ||
return mr; | ||
} | ||
} | ||
throw new RuntimeException( | ||
new InvalidInputException("CPAMixingRuleType", "byValue", "value", "is not valid.")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/main/java/neqsim/thermo/mixingrule/MixingRuleTypeInterface.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package neqsim.thermo.mixingrule; | ||
|
||
/** | ||
* Dummy Interface to allow Phase object to keep either CPA or EosMixingRuleType | ||
*/ | ||
public interface MixingRuleTypeInterface { | ||
|
||
|
||
public int getValue(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.