Advertisement
Guest User

Node

a guest
Nov 13th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.69 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class Node {
  4.     public int x;
  5.     public int y;
  6.     public int lastIndex;
  7.     public ArrayList<Node> edges = new ArrayList<Node>();
  8.     public ArrayList<Integer> costs = new ArrayList<Integer>();
  9.     public int outCost;
  10.     public int index;
  11.    
  12.     public Node(int x, int y) {
  13.         this.x = x;
  14.         this.y = y;
  15.         lastIndex = -1;
  16.     }
  17.    
  18.     public void add(Node node, int cost) {
  19.         edges.add(node);
  20.         costs.add(cost);
  21.         outCost++;
  22.     }
  23.    
  24.     public Node getEdge(int i) {
  25.         return edges.get(i);
  26.     }
  27.    
  28.     public int getEdgesCount() {
  29.         return outCost;
  30.     }
  31.    
  32.     public void setIndex(int i) {
  33.         index = i;
  34.     }
  35.    
  36.     public void setLastIndex(int lastIndices) {
  37.         lastIndex = lastIndices;
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement