private void setCorrectNextRel(NodeRecord node, RelationshipRecord rel, long nextRel) { if (node.getId() == rel.getFirstNode()) { rel.setFirstNextRel(nextRel); } if (node.getId() == rel.getSecondNode()) { rel.setSecondNextRel(nextRel); } }
private void connectRelationship( NodeRecord firstNode, NodeRecord secondNode, RelationshipRecord rel) { assert firstNode.getNextRel() != rel.getId(); assert secondNode.getNextRel() != rel.getId(); rel.setFirstNextRel(firstNode.getNextRel()); rel.setSecondNextRel(secondNode.getNextRel()); connect(firstNode, rel); connect(secondNode, rel); firstNode.setNextRel(rel.getId()); secondNode.setNextRel(rel.getId()); }
private void connectRelationship( NodeRecord firstNode, NodeRecord secondNode, RelationshipRecord rel, RecordAccess<Long, RelationshipRecord, Void> relRecords, RecordAccess<Long, RelationshipGroupRecord, Integer> relGroupRecords) { // Assertion interpreted: if node is a normal node and we're trying to create a // relationship that we already have as first rel for that node --> error assert firstNode.getNextRel() != rel.getId() || firstNode.isDense(); assert secondNode.getNextRel() != rel.getId() || secondNode.isDense(); if (!firstNode.isDense()) { rel.setFirstNextRel(firstNode.getNextRel()); } if (!secondNode.isDense()) { rel.setSecondNextRel(secondNode.getNextRel()); } if (!firstNode.isDense()) { connect(firstNode, rel, relRecords); } else { connectRelationshipToDenseNode(firstNode, rel, relRecords, relGroupRecords); } if (!secondNode.isDense()) { if (firstNode.getId() != secondNode.getId()) { connect(secondNode, rel, relRecords); } else { rel.setFirstInFirstChain(true); rel.setSecondPrevRel(rel.getFirstPrevRel()); } } else if (firstNode.getId() != secondNode.getId()) { connectRelationshipToDenseNode(secondNode, rel, relRecords, relGroupRecords); } if (!firstNode.isDense()) { firstNode.setNextRel(rel.getId()); } if (!secondNode.isDense()) { secondNode.setNextRel(rel.getId()); } }
@Override void set(RelationshipRecord rel, long id, boolean isFirst) { rel.setSecondNextRel(id); }