summaryrefslogtreecommitdiff
path: root/src/com.example.portfolio3/com/example/portfolio3/Edge.java
blob: c4fa22750ff7b2a80a09f6f07762877912911fcc (plain)
  1. package com.example.portfolio3;
  2. // origin: <https://moodle.ruc.dk/course/section.php?id=211877>
  3. /// foo
  4. public class Edge {
  5. /// foo
  6. private Vertex from, to;
  7. /// foo
  8. private int weight;
  9. /// foo
  10. /// @return Vertex
  11. public final Vertex from() {
  12. return from;
  13. }
  14. /// foo
  15. /// @return Vertex
  16. public final Vertex to() {
  17. return to;
  18. }
  19. /// foo
  20. /// @return int
  21. public final int weight() {
  22. return weight;
  23. }
  24. /// foo
  25. /// @param from foo
  26. /// @param to foo
  27. /// @param w foo
  28. Edge(final Vertex from, final Vertex to, final int w) {
  29. this.from = from;
  30. this.to = to;
  31. weight = w;
  32. }
  33. /// foo
  34. /// @return String
  35. public final String toString() {
  36. return from.name() + " - " + weight + " -> " + to.name();
  37. }
  38. }