-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBLeafNode.java
86 lines (79 loc) · 1.95 KB
/
BLeafNode.java
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
/**
* This class instantiates the Leaf nodes that are to be used
* within the implementation of this 2-3+ tree. It also contains
* getter, setter, and boolean methods which help manipulate
* these specific nodes within the tree.
*
* @author karl88
* @author sfbahr
* @version Oct 18, 2014
*/
public class BLeafNode extends BNode
{
private BLeafNode prev;
private BLeafNode next;
// ----------------------------------------------------------
/**
* Create a new BLeftNode object.
* @param lKVPair the left Key/Value pair
* @param rKVPair the right Key/Value pair
*/
public BLeafNode(KVPair lKVPair, KVPair rKVPair)
{
setLeftKVPair(lKVPair);
setRightKVPair(rKVPair);
prev = null;
next = null;
setMinPair(null);
}
/**
* This is a boolean method that determines whether or not a given node
* is a leaf.
*
* @return whether the node is a leaf or not
*/
public boolean isLeaf()
{
return true;
}
/**
* This method is a getter for the previous node to the
* given node in the list.
*
* @return prev the previous node
*/
public BLeafNode getPrev()
{
return prev;
}
/**
* This method is a setter for the previous node to the given
* one in the list.
*
* @param newPrev the new previous node
*/
public void setPrev(BLeafNode newPrev)
{
prev = newPrev;
}
/**
* This method is a setter for the next node to the given one
* in the list.
*
* @return next the next node in the list
*/
public BLeafNode getNext()
{
return next;
}
/**
* This method is a setter for the next node in the list to
* the given one.
*
* @param newNext the new next node in the list
*/
public void setNext(BLeafNode newNext)
{
next = newNext;
}
}