@Test(expectedExceptions = IllegalArgumentException.class) public void testAddWrongType() { EdgeTypeStore edgeTypeStore = new EdgeTypeStore(); edgeTypeStore.addType(42); }
public int addType(final Object label) { checkType(label); short id = labelMap.getShort(label); if (id == NULL_SHORT) { if (!garbageQueue.isEmpty()) { id = garbageQueue.firstShort(); garbageQueue.remove(id); } else { id = intToShort(length); if (length >= MAX_SIZE) { throw new RuntimeException("Maximum number of edge types reached at " + MAX_SIZE); } length++; } labelMap.put(label, id); idMap.put(id, label); } return shortToInt(id); }
EdgeTypeStore { public int addType(final Object label) { checkType(label); short id = labelMap.getShort(label); if (id == NULL_SHORT) { if (!garbageQueue.isEmpty()) { id = garbageQueue.firstShort(); garbageQueue.remove(id); } else { id = intToShort(length); if (length >= MAX_SIZE) { throw new RuntimeException("Maximum number of edge types reached at " + MAX_SIZE); } length++; } labelMap.put(label, id); idMap.put(id, label); } return shortToInt(id); } }
EdgeTypeStore { public int addType(final Object label) { checkType(label); short id = labelMap.getShort(label); if (id == NULL_SHORT) { if (!garbageQueue.isEmpty()) { id = garbageQueue.firstShort(); garbageQueue.remove(id); } else { id = intToShort(length); if (length >= MAX_SIZE) { throw new RuntimeException("Maximum number of edge types reached at " + MAX_SIZE); } length++; } labelMap.put(label, id); idMap.put(id, label); } return shortToInt(id); } EdgeTypeStore();  EdgeTypeStore(Configuration config); }
EdgeTypeStore { public int addType(final Object label) { checkType(label); short id = labelMap.getShort(label); if (id == NULL_SHORT) { if (!garbageQueue.isEmpty()) { id = garbageQueue.firstShort(); garbageQueue.remove(id); } else { id = intToShort(length); if (length >= MAX_SIZE) { throw new RuntimeException("Maximum number of edge types reached at " + MAX_SIZE); } length++; } labelMap.put(label, id); idMap.put(id, label); } return shortToInt(id); } EdgeTypeStore();  EdgeTypeStore(Configuration config); int getId(final Object label); Object getLabel(final int id); int addType(final Object label); boolean addType(final Object label, final int id); int removeType(final Object label); Object removeType(final int type); Object[] getLabels(); int[] getIdsAsInts(); boolean contains(final Object label); boolean contains(final int id); void clear(); int size(); int deepHashCode(); boolean deepEquals(Object obj); }
EdgeTypeStore { public int addType(final Object label) { checkType(label); short id = labelMap.getShort(label); if (id == NULL_SHORT) { if (!garbageQueue.isEmpty()) { id = garbageQueue.firstShort(); garbageQueue.remove(id); } else { id = intToShort(length); if (length >= MAX_SIZE) { throw new RuntimeException("Maximum number of edge types reached at " + MAX_SIZE); } length++; } labelMap.put(label, id); idMap.put(id, label); } return shortToInt(id); } EdgeTypeStore();  EdgeTypeStore(Configuration config); int getId(final Object label); Object getLabel(final int id); int addType(final Object label); boolean addType(final Object label, final int id); int removeType(final Object label); Object removeType(final int type); Object[] getLabels(); int[] getIdsAsInts(); boolean contains(final Object label); boolean contains(final int id); void clear(); int size(); int deepHashCode(); boolean deepEquals(Object obj); final static int MAX_SIZE; }