Advertisement
Guest User

BTNode.java

a guest
Mar 26th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. public class BTNode implements Position{
  2.  
  3. String word;
  4. int wordCounter=0;
  5. BTNode left, right, parent;
  6. public BTNode(String s, BTNode u, BTNode v, BTNode w){
  7. word = s; // ?setElement(word);
  8. left = u; //???setLeft(left);
  9. right = v; //???setRight(right);
  10. parent = w; //????setParent(parent);
  11. }
  12. public String getElement() { //I think same as getElement()
  13. return word;
  14. }
  15.  
  16. public int getWordCounter() { ///that's it ? or more?
  17. return wordCounter;
  18. }
  19.  
  20. public void increaseWordCounter() { ///not sure if we have to do more here
  21. wordCounter++;
  22. }
  23.  
  24. //-----------------------------------
  25.  
  26. public BTNode getLeft() {
  27. return left;
  28. }
  29.  
  30. public void setLeft(BTNode v) {
  31. left = v;
  32. }
  33.  
  34. public BTNode getRight() {
  35. return right;
  36. }
  37.  
  38. public void setRight(BTNode v) {
  39. right = v;
  40. }
  41.  
  42. public BTNode getParent() {
  43. return parent;
  44. }
  45.  
  46. public void setParent(BTNode v) {
  47. parent = v;
  48. }
  49. /*
  50. public String getElement(){ //not sure with the given just element() method
  51. return word; //return the word at a specific position using interface Position;
  52. }
  53. */
  54. public void setElement(String e){
  55. word = e;
  56. }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement