Advertisement
Guest User

KILL ME

a guest
Oct 13th, 2015
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.40 KB | None | 0 0
  1. import java.util.LinkedList;
  2. import java.util.List;
  3.  
  4. /**
  5.  * Created by jake on 10/13/15.
  6.  */
  7. public class Node extends Object implements Comparable<Node>{
  8.     private Coordinates value;
  9.     private List<Node> neighbors;
  10.     public Node(Coordinates value){
  11.         this.value = value;
  12.         this.neighbors = new LinkedList<Node>();
  13.     }
  14.     public Coordinates getValue(){
  15.         return value;
  16.     }
  17.     public void addNeighbor(Node newNeighbor){
  18.         if(!neighbors.contains(newNeighbor)){
  19.             neighbors.add(newNeighbor);
  20.         }
  21.  
  22.     }
  23.     public Iterable<Node> getNeighbors(){
  24.         return neighbors;
  25.         //TODO FUCKING EVEYTHING
  26.         //FUCK YOUR FUCKING COMPARABLE BULLSHIT
  27.     }
  28.     @Override
  29.     public String toString(){
  30.         String result;
  31.         result = getValue() + ": ";
  32.         for(Node nbr : neighbors) {
  33.             result = result + nbr.getValue() + ", ";
  34.         }
  35.         return (result.substring(0, result.length()-2));
  36.     }
  37.     public void printDetail(){
  38.         System.out.print("Node coordinates: ");
  39.         for (Node nbr : neighbors) {
  40.             System.out.print(nbr.getValue() + " ");
  41.         }
  42.     }
  43.  
  44.     public int compareTo(Node o){
  45.         //TODO FUCKING EVEYTHING
  46.         /*
  47.         int result = this.r - o.r;
  48.         if ( result == 0 ) result = this.c - o.c;
  49.         return result;
  50.          */
  51.         return 0;
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement