Advertisement
Guest User

Indenting Tree File Structure

a guest
Jul 11th, 2018
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1.  
  2. import java.io.BufferedReader;
  3. import java.io.FileReader;
  4. import java.io.IOException;
  5.  
  6. class NodeInfo{
  7.  
  8. private String name;
  9. private String parentID;
  10. private String link;
  11. private String hidden;
  12. private String id;
  13.  
  14.  
  15. public NodeInfo(String id,String name,String pid,String hidden,String link) {
  16.  
  17. this.name = name;
  18. this.parentID = pid;
  19. this.link = link;
  20. this.hidden = hidden;
  21. this.id = id;
  22. }
  23.  
  24. void showInfo() {
  25. System.out.println("This method works and would print out the node with indent");
  26. }
  27.  
  28. }
  29.  
  30. public class TreeNodes {
  31.  
  32. public static void main(String[]args) throws IOException{
  33.  
  34. FileReader in = new FileReader("Navigation.csv");
  35. BufferedReader br = new BufferedReader(in);
  36.  
  37. String line;
  38. line = br.readLine();
  39.  
  40. NodeInfo nodeList[] = new NodeInfo[100];
  41. int counter = 0;
  42.  
  43. while ((line = br.readLine()) != null) {
  44.  
  45. String [] cells = line.split(";");
  46.  
  47. NodeInfo newNode =new NodeInfo(cells[0], cells[1], cells[2], cells[3], cells[4]);
  48.  
  49. nodeList[counter] = newNode;
  50. counter++;
  51.  
  52. System.out.println(line);
  53. }
  54.  
  55. // nodeList[8].showInfo();
  56. in.close();
  57. }
  58.  
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement