@@ -96,10 +96,10 @@ public CompletableFuture<EntryPointAndLayer> fetchEntryNodeKey(@Nonnull final Re
96
96
97
97
@ Nonnull
98
98
@ Override
99
- protected <N extends Neighbor > CompletableFuture <NodeWithLayer < N >> fetchNodeInternal (@ Nonnull final Node .NodeCreator <N > creator ,
100
- @ Nonnull final ReadTransaction readTransaction ,
101
- final int layer ,
102
- @ Nonnull final Tuple primaryKey ) {
99
+ protected <R extends NodeReference > CompletableFuture <Node < R >> fetchNodeInternal (@ Nonnull final Node .NodeCreator <R > creator ,
100
+ @ Nonnull final ReadTransaction readTransaction ,
101
+ final int layer ,
102
+ @ Nonnull final Tuple primaryKey ) {
103
103
final byte [] key = getDataSubspace ().pack (Tuple .from (layer , primaryKey ));
104
104
105
105
return readTransaction .get (key )
@@ -109,11 +109,11 @@ protected <N extends Neighbor> CompletableFuture<NodeWithLayer<N>> fetchNodeInte
109
109
}
110
110
111
111
final Tuple nodeTuple = Tuple .fromBytes (valueBytes );
112
- final Node <N > node = nodeFromTuple (creator , nodeTuple );
112
+ final Node <R > node = nodeFromTuple (creator , nodeTuple );
113
113
final OnReadListener onReadListener = getOnReadListener ();
114
114
onReadListener .onNodeRead (node );
115
115
onReadListener .onKeyValueRead (key , valueBytes );
116
- return node . withLayer ( layer ) ;
116
+ return node ;
117
117
});
118
118
}
119
119
@@ -158,8 +158,8 @@ private Tuple toTuple(@Nonnull final Node node) {
158
158
}
159
159
160
160
@ Nonnull
161
- private <N extends Neighbor > Node <N > nodeFromTuple (@ Nonnull final Node .NodeCreator <N > creator ,
162
- @ Nonnull final Tuple tuple ) {
161
+ private <N extends NodeReference > Node <N > nodeFromTuple (@ Nonnull final Node .NodeCreator <N > creator ,
162
+ @ Nonnull final Tuple tuple ) {
163
163
final NodeKind nodeKind = NodeKind .fromSerializedNodeKind ((byte )tuple .getLong (0 ));
164
164
final Tuple primaryKey = tuple .getNestedTuple (1 );
165
165
final Tuple vectorTuple ;
@@ -179,27 +179,27 @@ private <N extends Neighbor> Node<N> nodeFromTuple(@Nonnull final Node.NodeCreat
179
179
}
180
180
181
181
@ Nonnull
182
- private <N extends Neighbor > Node <N > dataNodeFromTuples (@ Nonnull final Node .NodeCreator <N > creator ,
183
- @ Nonnull final Tuple primaryKey ,
184
- @ Nonnull final Tuple vectorTuple ,
185
- @ Nonnull final Tuple neighborsTuple ) {
182
+ private <N extends NodeReference > Node <N > dataNodeFromTuples (@ Nonnull final Node .NodeCreator <N > creator ,
183
+ @ Nonnull final Tuple primaryKey ,
184
+ @ Nonnull final Tuple vectorTuple ,
185
+ @ Nonnull final Tuple neighborsTuple ) {
186
186
final Vector <Half > vector = vectorFromTuple (vectorTuple );
187
187
188
- List <Neighbor > neighbors = Lists .newArrayListWithExpectedSize (neighborsTuple .size ());
188
+ List <NodeReference > nodeReferences = Lists .newArrayListWithExpectedSize (neighborsTuple .size ());
189
189
190
190
for (final Object neighborObject : neighborsTuple ) {
191
191
final Tuple neighborTuple = (Tuple )neighborObject ;
192
- neighbors .add (new Neighbor (neighborTuple ));
192
+ nodeReferences .add (new NodeReference (neighborTuple ));
193
193
}
194
194
195
- return creator .create (NodeKind .DATA , primaryKey , vector , neighbors );
195
+ return creator .create (NodeKind .DATA , primaryKey , vector , nodeReferences );
196
196
}
197
197
198
198
@ Nonnull
199
- private <N extends Neighbor > Node <N > intermediateNodeFromTuples (@ Nonnull final Node .NodeCreator <N > creator ,
200
- @ Nonnull final Tuple primaryKey ,
201
- @ Nonnull final Tuple neighborsTuple ) {
202
- List <NeighborWithVector > neighborsWithVectors = Lists .newArrayListWithExpectedSize (neighborsTuple .size ());
199
+ private <N extends NodeReference > Node <N > intermediateNodeFromTuples (@ Nonnull final Node .NodeCreator <N > creator ,
200
+ @ Nonnull final Tuple primaryKey ,
201
+ @ Nonnull final Tuple neighborsTuple ) {
202
+ List <NodeReferenceWithVector > neighborsWithVectors = Lists .newArrayListWithExpectedSize (neighborsTuple .size ());
203
203
Half [] neighborVectorHalfs = null ;
204
204
205
205
for (final Object neighborObject : neighborsTuple ) {
@@ -213,7 +213,7 @@ private <N extends Neighbor> Node<N> intermediateNodeFromTuples(@Nonnull final N
213
213
for (int i = 0 ; i < neighborVectorTuple .size (); i ++) {
214
214
neighborVectorHalfs [i ] = Half .shortBitsToHalf (shortFromBytes (neighborVectorTuple .getBytes (i )));
215
215
}
216
- neighborsWithVectors .add (new NeighborWithVector (neighborPrimaryKey , new Vector .HalfVector (neighborVectorHalfs )));
216
+ neighborsWithVectors .add (new NodeReferenceWithVector (neighborPrimaryKey , new Vector .HalfVector (neighborVectorHalfs )));
217
217
}
218
218
219
219
return creator .create (NodeKind .INTERMEDIATE , primaryKey , null , neighborsWithVectors );
0 commit comments