Guest User

Untitled

a guest
Oct 21st, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. package Graphs;
  2.  
  3. public class PQEntry implements Comparable<PQEntry> {
  4. public int node;
  5. public int nodeVal;
  6.  
  7. public PQEntry(int node, int nodeVal) {
  8. this.node = node;
  9. this.nodeVal = nodeVal;
  10. }
  11.  
  12. @Override
  13. public String toString() {
  14. return "Node: " + this.node + ", Value: " + this.nodeVal;
  15. }
  16.  
  17. public int getNodeVal() {
  18. return this.nodeVal;
  19. }
  20.  
  21. @Override
  22. public int compareTo(PQEntry other) {
  23. return Integer.compare(this.getNodeVal(), other.nodeVal);
  24. }
  25. }
  26.  
  27. PriorityQueue<PQEntry> pq = new PriorityQueue();
Add Comment
Please, Sign In to add comment