//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public void writePath(org.neo4j.values.virtual.NodeValue[] nodes, org.neo4j.values.virtual.RelationshipValue[] relationships) throws java.io.IOException public override void WritePath(NodeValue[] nodes, RelationshipValue[] relationships) { //A path is serialized in the following form // Given path: (a {id: 42})-[r1 {id: 10}]->(b {id: 43})<-[r1 {id: 11}]-(c {id: 44}) //The serialization will look like: // // { // [a, b, c] // [r1, r2] // [1, 1, -2, 2] // } // The first list contains all nodes where the first node (a) is guaranteed to be the start node of // the path // The second list contains all edges of the path // The third list defines the path order, where every other item specifies the offset into the // relationship and node list respectively. Since all paths is guaranteed to start with a 0, meaning // that // a is the start node in this case, those are excluded. So the first integer in the array refers to the // position // in the relationship array (1 indexed where sign denotes direction) and the second one refers to // the offset // into the // node list (zero indexed) and so on. PackStructHeader(PATH_SIZE, PATH); WriteNodesForPath(nodes); WriteRelationshipsForPath(relationships); PackListHeader(2 * relationships.Length); if (relationships.Length == 0) { return; } NodeValue node = nodes[0]; for (int i = 1; i <= 2 * relationships.Length; i++) { if (i % 2 == 0) { node = nodes[i / 2]; int index = NodeIndexes.getOrDefault(node.Id(), NO_SUCH_ID); Pack(index); } else { RelationshipValue r = relationships[i / 2]; int index = RelationshipIndexes.getOrDefault(r.Id(), NO_SUCH_ID); if (node.Id() == r.StartNode().id()) { Pack(index); } else { Pack(-index); } } } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void writeNodesForPath(org.neo4j.values.virtual.NodeValue[] nodes) throws java.io.IOException internal virtual void WriteNodesForPath(NodeValue[] nodes) { NodeIndexes.reset(nodes.Length); foreach (NodeValue node in nodes) { NodeIndexes.putIfAbsent(node.Id(), NodeIndexes.size()); } int size = NodeIndexes.size(); PackListHeader(size); if (size > 0) { NodeValue node = nodes[0]; foreach (long id in NodeIndexes.keys()) { int i = 1; while (node.Id() != id) { node = nodes[i++]; } node.WriteTo(this); } } }