23
23
* SOFTWARE.
24
24
*/
25
25
26
- namespace doganoo \PHPAlgorithms \Maps ;
26
+ namespace doganoo \PHPAlgorithms \Datastructure \ Maps ;
27
27
28
- use doganoo \PHPAlgorithms \Lists \LinkedLists \SinglyLinkedList ;
29
- use doganoo \PHPAlgorithms \Util \MapUtil ;
28
+ use doganoo \PHPAlgorithms \Common \Util \MapUtil ;
29
+ use doganoo \PHPAlgorithms \Datastructure \Lists \LinkedLists \SinglyLinkedList ;
30
+ use doganoo \PHPAlgorithms \Datastructure \lists \Node ;
30
31
31
32
/**
32
33
* HashMap class - implementation of a map using hashes in order to avoid collisions
@@ -73,8 +74,8 @@ private function initializeBucket() {
73
74
*
74
75
* @param Node $node
75
76
* @return bool
76
- * @throws \doganoo\PHPAlgorithms\Exception\InvalidKeyTypeException
77
- * @throws \doganoo\PHPAlgorithms\Exception\UnsupportedKeyTypeException
77
+ * @throws \doganoo\PHPAlgorithms\common\ Exception\InvalidKeyTypeException
78
+ * @throws \doganoo\PHPAlgorithms\common\ Exception\UnsupportedKeyTypeException
78
79
*/
79
80
public function addNode (Node $ node ): bool {
80
81
$ added = $ this ->add ($ node ->getKey (), $ node ->getValue ());
@@ -88,8 +89,8 @@ public function addNode(Node $node): bool {
88
89
* @param $key
89
90
* @param $value
90
91
* @return bool
91
- * @throws \doganoo\PHPAlgorithms\Exception\InvalidKeyTypeException
92
- * @throws \doganoo\PHPAlgorithms\Exception\UnsupportedKeyTypeException
92
+ * @throws \doganoo\PHPAlgorithms\common\ Exception\InvalidKeyTypeException
93
+ * @throws \doganoo\PHPAlgorithms\common\ Exception\UnsupportedKeyTypeException
93
94
*/
94
95
public function add ($ key , $ value ): bool {
95
96
$ arrayIndex = $ this ->getBucketIndex ($ key );
@@ -125,8 +126,8 @@ public function add($key, $value): bool {
125
126
*
126
127
* @param $key
127
128
* @return int
128
- * @throws \doganoo\PHPAlgorithms\Exception\InvalidKeyTypeException
129
- * @throws \doganoo\PHPAlgorithms\Exception\UnsupportedKeyTypeException
129
+ * @throws \doganoo\PHPAlgorithms\common\ Exception\InvalidKeyTypeException
130
+ * @throws \doganoo\PHPAlgorithms\common\ Exception\UnsupportedKeyTypeException
130
131
*/
131
132
private function getBucketIndex ($ key ) {
132
133
/*
@@ -232,8 +233,8 @@ public function getNodeByValue($value): ?Node {
232
233
*
233
234
* @param $key
234
235
* @return Node|null
235
- * @throws \doganoo\PHPAlgorithms\Exception\InvalidKeyTypeException
236
- * @throws \doganoo\PHPAlgorithms\Exception\UnsupportedKeyTypeException
236
+ * @throws \doganoo\PHPAlgorithms\common\ Exception\InvalidKeyTypeException
237
+ * @throws \doganoo\PHPAlgorithms\common\ Exception\UnsupportedKeyTypeException
237
238
*/
238
239
public function getNodeByKey ($ key ): ?Node {
239
240
$ arrayIndex = $ this ->getBucketIndex ($ key );
@@ -260,8 +261,8 @@ public function getNodeByKey($key): ?Node {
260
261
*
261
262
* @param $key
262
263
* @return bool
263
- * @throws \doganoo\PHPAlgorithms\Exception\InvalidKeyTypeException
264
- * @throws \doganoo\PHPAlgorithms\Exception\UnsupportedKeyTypeException
264
+ * @throws \doganoo\PHPAlgorithms\common\ Exception\InvalidKeyTypeException
265
+ * @throws \doganoo\PHPAlgorithms\common\ Exception\UnsupportedKeyTypeException
265
266
*/
266
267
public function remove ($ key ): bool {
267
268
//get the corresponding index to key
0 commit comments