Package hlcd.exporter
Class CodeExporter
java.lang.Object
hlcd.exporter.CodeExporter
Exports the code found to file as a persistent object, \(\LaTeX\) and Matlab
files. It will not override any files/folders because timestamps will be
added in the names. The options are given using
CodeExporterParameters. It can write a code as a .bin,
.tex and .m (Matlab) file. The .tex files will contain the
generator matrix \(G\) along with the weight enumerator written as two
separate files. The .m file contains the generator matrix \(G\), the
Hermitian transpose \(\overline{G}^{T}\) and \(G^\prime = G \times
\overline{G}^{T}\). It will ensure that Matlab calculates \(G \times
\overline{G}^{T}\) which must match the matrix this program found.
//minimal but complete example
public static void main(String[] args) {
System.out.println("Running CodeExporter...");
String path = Paths.DEFAULT_PATH;
byte n = 7;
byte k = 4;
byte d = 3;
byte base = 4;
boolean printPathToConsole = true;
CodeParameters cp = new CodeParameters(n, k, d, base);
CodeValidatorParameters cvp = new CodeValidatorParameters();
CodeExporterParameters cep = new CodeExporterParameters();
Code code = new Code(cp, cvp);
code.startEngine();
code.printGeneratorMatrix(true, Style.DECIMAL, true);
CodeExporter ce = new CodeExporter(path, cep, code, printPathToConsole);
ce.export(
"G", //label of the generator matrix
" ", //delimiter between generator matrix's columns
"0", //the id of the generator matrix
true, //surround delimiter by space
Style.DECIMAL //the style of digits
);
System.out.println("CodeExporter completed.");
}- Since:
- 1.8
- Version:
- 1.0 (January 24th, 2022)
- Author:
- Maysara Al Jumaily
- See Also:
CodeExporterParameters,CodeObjectIO,LatexMatrixWriter,LatexWeightEnumeratorWriter,MatlabCodeWriter
-
Constructor Summary
ConstructorsConstructorDescriptionCodeExporter(String path, CodeExporterParameters cep, Code code, boolean printPathToConsole)Initializes the code exporter by accepting the parameters of the files that need to be exported. -
Method Summary
-
Constructor Details
-
CodeExporter
public CodeExporter(String path, CodeExporterParameters cep, Code code, boolean printPathToConsole)Initializes the code exporter by accepting the parameters of the files that need to be exported.- Parameters:
path- the directory path to store the filescep- the parameters of the code exportercode- the code to exportprintPathToConsole- should the file paths generated be printed to console- See Also:
CodeExporterParameters
-
-
Method Details
-
export
public void export(String matrixLabel, String delimiter, String id, boolean spaceBetweenDelimiter, Style style)Writes the desired files to disk. It will use theCodeExporterParametersobject that was passed in the constructor which specifies which type of file that needs to be written to disk.- Parameters:
matrixLabel- the generator matrix label (should be"G")delimiter- the delimiter used when.texfile is written (should be"&")id- The id that would be associated with the matrix. Used when multiple generator matrices of the same \(\left[n, \, k, \, d\right]_{base}\) code are generated. Should be"0"if only a single generator matrix is found.spaceBetweenDelimiter- Should there be a space between the delimiter used. Regardless of the value, this doesn't affect the output, it is there for aesthetic purposesstyle- should the.texfile write a matrix in binary, decimal or quaternary. For a binary code, this doesn't matter. For a quaternary code, a binary style will write the digits as \(00\), \(01\), \(10\) and \(11\). A decimal style will use \(0\), \(1\), \(2\) and \(3\). A quaternary style uses \(0\), \(1\), \(\omega\) and \(\overline{\omega}\). Lastly, the LaTeX style will write everything in \(\LaTeX\) syntax.
-
getCompletePath
Returns the complete path of the directory to output to.- Returns:
- the complete path of the directory to output to
-