Skip to content

Commit

Permalink
style: fix checkstyle errors
Browse files Browse the repository at this point in the history
  • Loading branch information
kaitinghh committed Mar 29, 2024
1 parent b4ddf1e commit 1fe6a23
Show file tree
Hide file tree
Showing 6 changed files with 565 additions and 540 deletions.
172 changes: 91 additions & 81 deletions src/main/java/algorithms/orthogonalRangeSearching/RangeTreeNode.java
Original file line number Diff line number Diff line change
@@ -1,86 +1,96 @@
package algorithms.orthogonalRangeSearching;

/**
* This class is the node class for building a range tree.
* @param <T> Generic type of the node class
*/
public class RangeTreeNode<T> {
T val;
int height;
RangeTreeNode<T> left = null;
RangeTreeNode<T> right = null;
RangeTreeNode<T> parent = null;
RangeTreeNode<T> yTree = null;

public RangeTreeNode(T val) {
this.val = val;
}

public RangeTreeNode(T val, RangeTreeNode<T> left, RangeTreeNode<T> right) {
this.val = val;
this.left = left;
this.right = right;
}

public T getVal() {
return this.val;
}

public int getHeight() {
return this.height;
}

public RangeTreeNode<T> getLeft() {
return this.left;
}

public RangeTreeNode<T> getRight() {
return this.right;
}

public RangeTreeNode<T> getParent() {
return this.parent;
}

public RangeTreeNode<T> getYTree() {
return this.yTree;
}

public void setVal(T val) {
this.val = val;
}

public void setLeft(RangeTreeNode<T> left) {
this.left = left;
}

public void setRight(RangeTreeNode<T> right) {
this.right = right;
}

public void setParent(RangeTreeNode<T> parent) {
this.parent = parent;
}

public void setHeight(int height) {
this.height = height;
}

public void setYTree(RangeTreeNode<T> yTree) {
this.yTree = yTree;
}

@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}
if (!(other instanceof RangeTreeNode)) {
return false;
}
RangeTreeNode<T> node = (RangeTreeNode<T>) other;
return this.val == node.val;
}

@Override
public String toString() {
return String.valueOf(this.val);
}
private T val;
private int height;
private RangeTreeNode<T> left = null;
private RangeTreeNode<T> right = null;
private RangeTreeNode<T> parent = null;
private RangeTreeNode<T> yTree = null;

public RangeTreeNode(T val) {
this.val = val;
}

/**
* Constructor for range tree node
* @param val value of node
* @param left left child of node
* @param right right child of node
*/
public RangeTreeNode(T val, RangeTreeNode<T> left, RangeTreeNode<T> right) {
this.val = val;
this.left = left;
this.right = right;
}

public T getVal() {
return this.val;
}

public int getHeight() {
return this.height;
}

public RangeTreeNode<T> getLeft() {
return this.left;
}

public RangeTreeNode<T> getRight() {
return this.right;
}

public RangeTreeNode<T> getParent() {
return this.parent;
}

public RangeTreeNode<T> getYTree() {
return this.yTree;
}

public void setVal(T val) {
this.val = val;
}

public void setLeft(RangeTreeNode<T> left) {
this.left = left;
}

public void setRight(RangeTreeNode<T> right) {
this.right = right;
}

public void setParent(RangeTreeNode<T> parent) {
this.parent = parent;
}

public void setHeight(int height) {
this.height = height;
}

public void setYTree(RangeTreeNode<T> yTree) {
this.yTree = yTree;
}

@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}
if (!(other instanceof RangeTreeNode)) {
return false;
}
RangeTreeNode<T> node = (RangeTreeNode<T>) other;
return this.val == node.val;
}

@Override
public String toString() {
return String.valueOf(this.val);
}

}
Loading

0 comments on commit 1fe6a23

Please sign in to comment.