Skip to content
Snippets Groups Projects
Commit 37e9188e authored by vlorentz's avatar vlorentz Committed by vlorentz
Browse files

Check in constructor instead of size64()

parent 39ed0d17
No related branches found
Tags v6.3.1
No related merge requests found
......@@ -66,6 +66,13 @@ public class NodeIdMap implements Size64 {
this.nodeToSwhMap = ByteMappedBigList.map(raf.getChannel());
}
long byte_size = this.nodeToSwhMap.size64();
if (byte_size % SWHID_BIN_SIZE != 0) {
throw new RuntimeException(
String.format("%s%s has size %d bytes, which is not a multiple of SWHID_BIN_SIZE (%d)", graphPath,
NODE_TO_SWHID, byte_size, SWHID_BIN_SIZE));
}
// SWHID -> node
this.mph = loadMph(graphPath + ".mph");
try (RandomAccessFile mapFile = new RandomAccessFile(new File(graphPath + ".order"), "r")) {
......@@ -190,12 +197,6 @@ public class NodeIdMap implements Size64 {
/** Return the number of nodes in the map. */
@Override
public long size64() {
long byte_size = nodeToSwhMap.size64();
if (byte_size % SWHID_BIN_SIZE != 0) {
throw new RuntimeException(
String.format("%s%s has size %d bytes, which is not a multiple of SWHID_BIN_SIZE (%d)", graphPath,
NODE_TO_SWHID, byte_size, SWHID_BIN_SIZE));
}
return byte_size / SWHID_BIN_SIZE;
return nodeToSwhMap.size64() / SWHID_BIN_SIZE;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment