-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Impovements and bug fixes for enum PhaseType (#692)
* waterDegasserBugs * style and assert@ * update from master (#690) * 684 addfluid is not adding pc if not existing (#685) * added test for addFLuids * updated test * updated test with new pseudo component * solution for bug * refact: simplified if-else nesting --------- Co-authored-by: Åsmund Våge Fannemel <34712686+asmfstatoil@users.noreply.github.com> * dont do log of zeros (#688) --------- Co-authored-by: Åsmund Våge Fannemel <34712686+asmfstatoil@users.noreply.github.com> * modeidief test * log off * rebase on master (#693) * 684 addfluid is not adding pc if not existing (#685) * added test for addFLuids * updated test * updated test with new pseudo component * solution for bug * refact: simplified if-else nesting --------- Co-authored-by: Åsmund Våge Fannemel <34712686+asmfstatoil@users.noreply.github.com> * dont do log of zeros (#688) * AddfluidHighTemp (#689) * added test for addFLuids * updated test * updated test with new pseudo component * solution for bug * add test TPflas high * added gitlense extension * update * update * update test --------- Co-authored-by: Åsmund Våge Fannemel <34712686+asmfstatoil@users.noreply.github.com> * added pretty print for table * added prettyPrint + various fixes to PhaseType use * copy phasetype object in clone method * removed phasetpye setter not needed? * disable test that throws run tim exception * fixed doc * fixed doc * added BWRS parameter table * exception handling BWRS * updated glycol rigtest * disable pH test * fixed bug * enabled test ph test * added serialization test back again --------- Co-authored-by: Sviatoslav Eroshkin <109044598+Sviatose@users.noreply.github.com> Co-authored-by: Åsmund Våge Fannemel <34712686+asmfstatoil@users.noreply.github.com>
- Loading branch information
1 parent
c31240c
commit 135d3c7
Showing
17 changed files
with
382 additions
and
43 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
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
88 changes: 88 additions & 0 deletions
88
src/main/java/neqsim/thermo/util/readwrite/TablePrinter.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,88 @@ | ||
package neqsim.thermo.util.readwrite; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* A utility class for pretty printing a 2D string table. | ||
*/ | ||
public class TablePrinter implements Serializable{ | ||
|
||
/** | ||
* Prints a 2D string table in a formatted and visually appealing way. | ||
* | ||
* @param table The 2D string table to be printed. | ||
*/ | ||
public static void printTable(String[][] table) { | ||
if (table == null || table.length == 0 || table[0].length == 0) { | ||
System.out.println("Table is empty."); | ||
return; | ||
} | ||
|
||
int[] columnWidths = getColumnWidths(table); | ||
|
||
printHorizontalLine(columnWidths); | ||
|
||
for (String[] row : table) { | ||
printRow(row, columnWidths); | ||
printHorizontalLine(columnWidths); | ||
} | ||
} | ||
|
||
/** | ||
* Calculates the maximum width of each column in the table. | ||
* | ||
* @param table The 2D string table. | ||
* @return An array containing the maximum width of each column. | ||
*/ | ||
private static int[] getColumnWidths(String[][] table) { | ||
int columns = table[0].length; | ||
int[] columnWidths = new int[columns]; | ||
|
||
for (String[] row : table) { | ||
for (int i = 0; i < columns; i++) { | ||
int width = row[i].length(); | ||
if (width > columnWidths[i]) { | ||
columnWidths[i] = width; | ||
} | ||
} | ||
} | ||
|
||
return columnWidths; | ||
} | ||
|
||
/** | ||
* Prints a horizontal line separator based on the column widths. | ||
* | ||
* @param columnWidths An array containing the maximum width of each column. | ||
*/ | ||
private static void printHorizontalLine(int[] columnWidths) { | ||
System.out.print("+"); | ||
for (int width : columnWidths) { | ||
for (int i = 0; i < width + 2; i++) { | ||
System.out.print("-"); | ||
} | ||
System.out.print("+"); | ||
} | ||
System.out.println(); | ||
} | ||
|
||
/** | ||
* Prints a row of the table with appropriate padding based on column widths. | ||
* | ||
* @param row The row of data to be printed. | ||
* @param columnWidths An array containing the maximum width of each column. | ||
*/ | ||
private static void printRow(String[] row, int[] columnWidths) { | ||
System.out.print("|"); | ||
for (int i = 0; i < row.length; i++) { | ||
String cell = row[i]; | ||
int padding = columnWidths[i] - cell.length(); | ||
System.out.print(" " + cell); | ||
for (int j = 0; j < padding; j++) { | ||
System.out.print(" "); | ||
} | ||
System.out.print(" |"); | ||
} | ||
System.out.println(); | ||
} | ||
} |
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,2 @@ | ||
1,"methane",0.000009898,0.021996082,-0.532278800,20.216579620,-2234.398926000,0.000010679,0.000145792,-0.926581666,291.536473200,0.000000231,0.000138721,0.004780467,0.000011761,-0.000198209,-0.025128877,0.000009748,-0.000000120,0.000041283,-0.000000721,508.173825500,-91989.031920000,-2.732264677,74990.243510000,0.001114060,1.083955159,-0.000044909,-1.380337847,-0.000000023,0.000037616,-2.375166954e-10,-0.000000012,0.000000676,10.150000000 | ||
2,"ethane",-0.018439486,1.051016206,-16.057820303,848.440275620,-42738.409106000,0.000765652,-0.483607241,85.195473835,-16607.434721000,-0.000037521,0.028616309,-2.868528597,0.000119069,-0.008531571,3.836506384,0.000024986,0.000005797,-0.007164832,0.000125778,22240.102466000,-1480051.23280000,50.498054887,1642883.75992000,0.213253871,37.791273422,-0.000011857,-31.630780767,-0.000004100,0.001487004,0.000000003,-0.000002167,0.000024000,10.150000000 |
Oops, something went wrong.