Package hlcd.run
Class ParametersLoader
java.lang.Object
hlcd.run.ParametersLoader
A way to load a list of parameters of quaternary codes from a
.txt
file. It could be used for two main reasons: the first is testing known
optimal parameters and the second testing potential optimal
parameters that are not known yet. It will load the parameters from a text
file by reading the \(n\), \(k\) and \(d\) values (the base is assumed to be
4). A linkedlist of Parameters is created and can be
obtained to test the parameters read. The offset that is specified
will increase/decrease the \(d\) value read. It can be set to 0 if
the same d value read needs to be tested. The objective of
offset is to have the ability to test whether there exists a more
optimal minimum distance than the currently known minimum distance or find
suboptimal values. A typical parameter list could be:
//Write a comment starting the line with two slashes
//OR, write the parameters and two slashes, as such: n, k, d // some text...
//Note that invalid entries will crash the program
3, 1, 3
3, 2, 2
//Length 4
4, 1, 3
4, 2, 2
4, 3, 1
//Length 5
5, 1, 5
5, 2, 3
5, 3, 2
5, 4, 2
TODO: Check for invalid entries and skip them
//minimal example to execute this class:
public static void main(String[] args) {
System.out.println("Running ParametersLoader...");
String path = Paths.PARAMETERS_PATH;
byte offset = 0;
ParametersLoader parameters = new ParametersLoader(path, offset);
System.out.println("The parameters read from file are:");
LinkedList<CodeParameters> data = parameters.getParameters();
for (int i = 0; i < data.size(); i++) {
System.out.println(data.get(i));
}
System.out.println("ParametersLoader completed.");
}- Since:
- 1.8
- Version:
- 1.0 (February 19th, 2022)
- Author:
- Maysara Al Jumaily
-
Constructor Summary
ConstructorsConstructorDescriptionParametersLoader(String path, byte offset)Starts to read the parameters based on the path specified. -
Method Summary
Modifier and TypeMethodDescriptionReturns the parameters read from the file.
-
Constructor Details
-
ParametersLoader
Starts to read the parameters based on the path specified. In the case where the minimum distance needs to be incremented/decremented,offsetis used for this, otherwise, keepoffsetas0to find the true minimum distance specified in the file. The offset is used when checking if there exists a more optimal value than the current optimal value found.- Parameters:
path- the path of the text file that contains the parameters to testoffset- the value to increment/decrement the minimum distance read from the file
-
-
Method Details
-
getParameters
Returns the parameters read from the file.- Returns:
- the parameters read from the file
-