Implement Latex Table generation #330#490
Conversation
Created a new class named LatexTable in the org.cloudsimplus.builders.tables package. The LatexTable class provides functionality for building LaTeX tables. Implemented methods for adding columns and rows to the table. Added a method for generating the LaTeX code for the table. Incorporated column specifiers to define alignment and formatting options for columns. Improved code readability and maintainability by encapsulating table-building functionality within the LatexTable class.
Created a new class named LatexTableColumn in the org.cloudsimplus.builders.tables package. The LatexTableColumn class represents a column in a LaTeX table. Added methods for retrieving the column name and specifier. Enhanced modularity and organization to manage individual table columns.
LatexTableBuilder class in the org.cloudsimplus.builders.tables package facilitates the construction of LaTeX tables. It was used to test the output of the tables on the cloudlets of the BasicFirstExample.java
File of simple simulation for testing purposes.
manoelcampos
left a comment
There was a problem hiding this comment.
Hello @marwenbenhajhassine
Thanks for your contribution. This feature will be great for researchers that uses LaTeX.
However, I see many issues in the implementation.
You just created a bunch of new classes that don't use the existing class hierarchy.
Every new class must extend an existing class, namely:
- a new Table must extends AbstractTable
- a new Column must extends AbstractTableColumn
You must not create a LatexTableBuilder class, since the CloudletsTableBuilder accepts a Table as a constructor parameter. This way, it will work with any format (any class that implements the Table interface).
The major issue in the PR is that it has lots of duplicated code.
Code duplication is the reason that CloudSim became so buggy and the main reason that CloudSim Plus exists. My primary intention with CloudSim Plus was to remove the huge amount of code duplication in CloudSim.
Therefore, this PR needs a major rewrite in order to follow CloudSim Plus requirements.
Let me know if you need help understanding how the mentioned classes works.
And thanks for contributing.
This comment was marked as resolved.
This comment was marked as resolved.
- Updated new LatexTable class to extend AbstractTable. - Updated new LatexColumn class to extend AbstractTableColumn. - Removed LatexTableBuilder class so that the updated code can be used on CloudletsTableBuilder with a Table constructor parameter, ensuring compatibility with any Table format. - Eliminated duplicated code to maintain codebase quality and adhere to CloudSim Plus principles. - Improved overall integration with existing class hierarchy.
It was there for testing purposes.
…w data, so that each subclass (such as LatexTable and CsvTable) don't have to deal with the column separator. Previously, the subclasses needed to check if the column being printed is the last column so that the separator is not printed. Now, using Stream to process generate the row data, there is not need for that. Signed-off-by: Manoel Campos <manoelcampos@gmail.com>
- Correctly indent the generated LaTeX code - Code format, cleanup and refactoring - Fix issue of generation of duplicated number of column specifiers - Improves docs Signed-off-by: Manoel Campos <manoelcampos@gmail.com>
Signed-off-by: Manoel Campos <manoelcampos@gmail.com>
Signed-off-by: Manoel Campos <manoelcampos@gmail.com>
Signed-off-by: Manoel Campos <manoelcampos@gmail.com>
Signed-off-by: Manoel Campos <manoelcampos@gmail.com>
|
Hey @marwenbenhajhassine Thanks for your contribution. |
I have implemented a LatexTable class, a LatexTableColumn class, and a LatexTableBuilder class. Each with functionalities explained in the separate commits.
I have tested the output of my work by adding a modified version of BasicFirstExample.java in cloudsimplus/src/main/java/org/cloudsimplus that creates a latex table of the cloudlets data. This file is found in the last commit of my forked cloudsimplus repository.
Let me know if you have any feedback on my work and how to improve it.
Close #330