@Override public void close() throws IOException { // all other scanners are closed already for (TripleScanner scanner : scannerHeap) { scanner.close(); } }
private Triple popTriple() throws IOException { // get top scanner TripleScanner scanner = scannerHeap.poll(); // remove next triple Triple next = scanner.pop(); // more triples in this scanner? if (scanner.next()) { // yep, put it back scannerHeap.add(scanner); } else { // nope, we're done with it scanner.close(); } return next; }
@Override public int compare(TripleScanner s1, TripleScanner s2) { return order.comparator().compare(s1.peek(), s2.peek()); }