refactoring: Issue #2377: The repository code has been refactored to use the recor… (#2505)

* Issue #2377: The repository code has been refactored to use the record class

* Issue #2377: Refactored according to the rules defined for the repo code

* Issue #2377: Refactored according to the rules defined for the repo code

* Issue #2377: Refactored according to the rules defined for the repo code
This commit is contained in:
Mughees Qasim
2023-05-06 14:08:12 +05:00
committed by GitHub
parent c0e1603f90
commit 3ae6b07590
26 changed files with 244 additions and 293 deletions
@@ -29,27 +29,9 @@ import lombok.extern.slf4j.Slf4j;
/**
* Implementation for binary tree's normal nodes.
*/
@Slf4j
public class NodeImpl implements Node {
private final String name;
private final Node left;
private final Node right;
/**
* Constructor.
*/
public NodeImpl(String name, Node left, Node right) {
this.name = name;
this.left = left;
this.right = right;
}
@Override
public int getTreeSize() {
return 1 + left.getTreeSize() + right.getTreeSize();
}
public record NodeImpl(String name, Node left, Node right) implements Node {
@Override
public Node getLeft() {
return left;
@@ -64,7 +46,10 @@ public class NodeImpl implements Node {
public String getName() {
return name;
}
@Override
public int getTreeSize() {
return 1 + left.getTreeSize() + right.getTreeSize();
}
@Override
public void walk() {
LOGGER.info(name);