-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBInternalNode.java
More file actions
127 lines (113 loc) · 3.1 KB
/
BInternalNode.java
File metadata and controls
127 lines (113 loc) · 3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/**
* This class instantiates the Internal Nodes of the B+ tree.
* It contains getters and setters for the relevant information
* about the internal nodes needed to manipulate the tree.
*
* @author karl88
* @author sfbahr
* @version Oct 18, 2014
*/
public class BInternalNode extends BNode
{
private BNode leftChild;
private BNode middleChild;
private BNode rightChild;
private boolean isPromoted;
/**
* Create a new BInternalNode object, passing in the necessary
* parameters.
*
* @param lKVPair left KV pair
* @param rKVPair right KV pair
* @param left left node
* @param center center node
* @param right right node
* @param setIsPromoted boolean operator for promoted
*/
public BInternalNode(KVPair lKVPair, KVPair rKVPair, BNode left,
BNode center, BNode right, boolean setIsPromoted)
{
setLeftKVPair(lKVPair);
setRightKVPair(rKVPair);
leftChild = left;
middleChild = center;
rightChild = right;
isPromoted = setIsPromoted;
setMinPair(null);
}
/**
* Boolean method returns whether or not the node is a leaf.
* @return if it is a leaf or not
*/
public boolean isLeaf()
{
return false;
}
/**
* This method is a getter for the left child of a node.
* @return the left child
*/
public BNode getLeftChild()
{
return leftChild;
}
/**
* This method is a setter for the left child of a node.
* @param newLeftChild the new left child of the node
*/
public void setLeftChild(BNode newLeftChild)
{
leftChild = newLeftChild;
}
/**
* This method is a getter for the middle child of a node.
* @return middleChild the middle child of the given node
*/
public BNode getMiddleChild()
{
return middleChild;
}
/**
* This method is a setter for the middle child of a node.
* @param newMiddleChild the new middle child of a given node
*/
public void setMiddleChild(BNode newMiddleChild)
{
middleChild = newMiddleChild;
}
/**
* This method is a getter method for the right child of a node.
*@return rightChild the right child of a given node
*/
public BNode getRightChild()
{
return rightChild;
}
/**
* This method is a setter for the right child of a node.
* @param newRightChild the new right child of a given node
*/
public void setRightChild(BNode newRightChild)
{
rightChild = newRightChild;
}
/**
* This is a boolean method that determines whether or not a certain
* node is promoted up the tree or not.
* @return isPromoted the boolean operator
*/
public boolean isPromoted()
{
return isPromoted;
}
/**
* This method is a setter for the boolean operation of promotion
* within the tree.
*
* @param setIsPromoted the boolean operator for promotion within the tree
*/
public void setIsPromoted(boolean setIsPromoted)
{
isPromoted = setIsPromoted;
}
}