1919 * @since 27.06.17
2020 */
2121public class Kernel {
22- private final Statement statement ;
2322 private ReadOperations readOperations ;
2423
2524 public Kernel (Statement statement ) {
26- this .statement = statement ;
2725 readOperations = statement .readOperations ();
2826 }
2927
@@ -52,7 +50,6 @@ public Cursor<NodeItem> nodeCursorGetAll() {
5250
5351 private Cursor <NodeItem > wrapNodes (PrimitiveLongIterator nodes ) {
5452 return new Cursor <NodeItem >() {
55- Cursor <org .neo4j .storageengine .api .NodeItem > cursor ;
5653 Kernel .NodeItem item = new Kernel .NodeItem ();
5754 @ Override
5855 public boolean next () {
@@ -61,7 +58,7 @@ public boolean next() {
6158 if (!hasNext ) return false ;
6259 long nodeId = nodes .next ();
6360 try {
64- cursor = readOperations .nodeCursorById (nodeId );
61+ item . item = readOperations .nodeCursorById (nodeId ). get ( );
6562 return true ;
6663 } catch (EntityNotFoundException e ) {
6764 // throw new RuntimeException(e);
@@ -70,20 +67,16 @@ public boolean next() {
7067 }
7168
7269 @ Override
73- public void close () {
74- cursor .close ();
75- }
70+ public void close () { }
7671
7772 @ Override
7873 public NodeItem get () {
79- item .item = cursor .get ();
8074 return item ;
8175 }
8276 };
8377 }
8478 private Cursor <RelationshipItem > wrapRelationships (PrimitiveLongIterator rels ) {
8579 return new Cursor <RelationshipItem >() {
86- Cursor <org .neo4j .storageengine .api .RelationshipItem > cursor ;
8780 Kernel .RelationshipItem item = new Kernel .RelationshipItem ();
8881 @ Override
8982 public boolean next () {
@@ -92,7 +85,7 @@ public boolean next() {
9285 if (!hasNext ) return false ;
9386 long relId = rels .next ();
9487 try {
95- cursor = readOperations .relationshipCursorById (relId );
88+ item . item = readOperations .relationshipCursorById (relId ). get ( );
9689 return true ;
9790 } catch (EntityNotFoundException e ) {
9891 // throw new RuntimeException(e);
@@ -102,12 +95,11 @@ public boolean next() {
10295
10396 @ Override
10497 public void close () {
105- if ( cursor != null ) cursor . close ();
98+
10699 }
107100
108101 @ Override
109102 public Kernel .RelationshipItem get () {
110- item .item = cursor .get ();
111103 return item ;
112104 }
113105 };
@@ -152,43 +144,6 @@ public PropertyItem property(RelationshipItem item, int propertyId) {
152144 return item .property (propertyId ).get ();
153145 }
154146
155- public Cursor <RelationshipItem > relationshipCursor (long relationId ) {
156- try {
157- return new Cursor <Kernel .RelationshipItem >() {
158- RelationshipItem item = new RelationshipItem (readOperations .relationshipCursorById (relationId ).get ());
159- boolean first = true ;
160-
161- @ Override
162- public boolean next () {
163- if (first ) {
164- first = false ;
165- return true ;
166- }
167- return false ;
168- }
169-
170- @ Override
171- public void close () {
172- }
173-
174- @ Override
175- public RelationshipItem get () {
176- return item ;
177- }
178- };
179- } catch (EntityNotFoundException e ) {
180- return EMPTY_CURSOR ;
181- }
182- }
183-
184- public Object relationshipGetProperty (long relationId , int propertyKey ) {
185- try {
186- return readOperations .relationshipGetProperty (relationId ,propertyKey );
187- } catch (EntityNotFoundException e ) {
188- throw new RuntimeException (e );
189- }
190- }
191-
192147 public Cursor <NodeItem > nodeCursor (long nodeId ) {
193148 try {
194149 return new Cursor <Kernel .NodeItem >() {
@@ -245,42 +200,6 @@ static org.neo4j.graphdb.Direction direction(Direction direction) {
245200 throw new RuntimeException ("Illegal direction " +direction );
246201 }
247202
248- public long countsForRelationship (int labelId , int relationId , int otherLabelId ) {
249- return readOperations .countsForRelationship (labelId , relationId , otherLabelId );
250- }
251-
252- public int nodeGetDegree (long nodeId , org .neo4j .graphdb .Direction direction ) {
253- try {
254- return readOperations .nodeGetDegree (nodeId ,direction );
255- } catch (EntityNotFoundException e ) {
256- throw new RuntimeException (e );
257- }
258- }
259-
260- public int nodeGetDegree (long nodeId , org .neo4j .graphdb .Direction direction , int relType ) {
261- try {
262- return readOperations .nodeGetDegree (nodeId ,direction ,relType );
263- } catch (EntityNotFoundException e ) {
264- throw new RuntimeException (e );
265- }
266- }
267-
268- public long nodesGetCount () {
269- return readOperations .nodesGetCount ();
270- }
271-
272- public long countsForNodeWithoutTxState (int labelId ) {
273- return readOperations .countsForNodeWithoutTxState (labelId );
274- }
275-
276- public long relationshipsGetCount () {
277- return readOperations .relationshipsGetCount ();
278- }
279-
280- public long countsForRelationshipWithoutTxState (int labelId , int relTypeId , int otherLabelId ) {
281- return readOperations .countsForRelationshipWithoutTxState (labelId , relTypeId , otherLabelId );
282- }
283-
284203 public class NodeItem implements org .neo4j .storageengine .api .NodeItem {
285204 org .neo4j .storageengine .api .NodeItem item ;
286205
0 commit comments