public static void dumpNodeTable(NodeTable nodeTable, Set<NodeTable> dumpedNodeTables) { if ( dumpedNodeTables.contains(nodeTable) ) return ; Iterator<Pair<NodeId, Node>> iter = nodeTable.all() ; for ( ; iter.hasNext() ; ) { Pair<NodeId, Node> pair = iter.next() ; NodeId nid = pair.car() ; Node n = pair.cdr(); String x = NodeFmtLib.displayStr(n) ; System.out.printf("%016X %s\n", nid.getId(), x) ; } dumpedNodeTables.add(nodeTable) ; }
private void process(Node g, Node s, Node p, Node o) { NodeId sId = nodeTable.getAllocateNodeId(s) ; NodeId pId = nodeTable.getAllocateNodeId(p) ; NodeId oId = nodeTable.getAllocateNodeId(o) ; if ( g != null ) { NodeId gId = nodeTable.getAllocateNodeId(g) ; writerQuads.write(gId.getId()) ; writerQuads.write(sId.getId()) ; writerQuads.write(pId.getId()) ; writerQuads.write(oId.getId()) ; writerQuads.endOfRow() ; if ( stats != null ) stats.record(gId, sId, pId, oId) ; } else { writerTriples.write(sId.getId()) ; writerTriples.write(pId.getId()) ; writerTriples.write(oId.getId()) ; writerTriples.endOfRow() ; if ( stats != null ) stats.record(null, sId, pId, oId) ; } monitor.tick() ; }
public static Record record(RecordFactory factory, Tuple<NodeId> tuple, ColumnMap cMap) { byte[] b = new byte[tuple.len()*NodeId.SIZE] ; for ( int i = 0 ; i < tuple.len() ; i++ ) { int j = cMap.mapSlotIdx(i) ; // i'th Nodeid goes to j'th bytes slot. Bytes.setLong(tuple.get(i).getId(), b,j*SizeOfLong) ; } return factory.create(b) ; } }
@Test public void nodeId_02() { NodeId nodeId = NodeId.create(-1L) ; assertEquals(-1L, nodeId.getId()) ; }
@Test public void nodeId_01() { NodeId nodeId = NodeId.create(37) ; assertEquals(37L, nodeId.getId()) ; }
@Test public void nodeId_02() { NodeId nodeId = NodeId.create(-1L) ; assertEquals(-1L, nodeId.getId()) ; }
@Test public void nodeId_01() { NodeId nodeId = NodeId.create(37) ; assertEquals(37L, nodeId.getId()) ; }