aboutsummaryrefslogtreecommitdiff
path: root/dk/abcdefghijklmnopqrstuvxyzæøå/bachelorizer/model/Combi.java
blob: 238afb69a91cf8af62b662a84f527033f3c37512 (plain)
  1. // SPDX-FileCopyrightText: 2025 Jonas Smedegaard <dr@jones.dk>
  2. // SPDX-License-Identifier: GPL-3.0-or-later
  3. package dk.abcdefghijklmnopqrstuvxyzæøå.bachelorizer.model;
  4. import java.util.List;
  5. import com.example.portfolio3.GraphAlgorithms;
  6. /// Combi - static sample dataset of course combinations
  7. ///
  8. /// Slurps and parses data from upstream-provided comma-separated file.
  9. ///
  10. /// @version 0.0.1
  11. /// @see <https://moodle.ruc.dk/mod/assign/view.php?id=523186>
  12. public final class Combi {
  13. /// Default constructor
  14. ///
  15. /// @param path path to data file
  16. private Combi(final String path) {
  17. // slurp all content at once
  18. List<String> lines = GraphAlgorithms.loadStrings(path);
  19. for (String line : lines) {
  20. String[] values = line.split(",");
  21. for (String value : values) {
  22. System.out.print(value + "\t");
  23. }
  24. System.out.println();
  25. }
  26. }
  27. /// JVM entry point
  28. ///
  29. /// @param args command-line arguments
  30. public static void main(final String[] args) {
  31. // first argument, if provided, is the data file path;
  32. // else use upstream named file in current directory.
  33. String path = (args.length > 0)
  34. ? args[0]
  35. : "combi.txt";
  36. Combi combi = new Combi(path);
  37. }
  38. }