@Override public short firstShort() { synchronized (sync) { return sortedSet.firstShort(); } } @Override
@Override public ShortComparator comparator() { return sortedSet.comparator(); } @Override
/** * {@inheritDoc} * * @deprecated Please use the corresponding type-specific method instead. */ @Deprecated @Override public Short first() { return sortedSet.first(); } /**
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); }
public boolean addType(final Object label, final int id) { short givenId = intToShort(id); short foundId = labelMap.getShort(label); if (foundId != NULL_SHORT && foundId != givenId) { throw new RuntimeException("This label '" + label + "' is already assigned to a different id"); } else if (idMap.containsKey(givenId)) { if ((label == null && idMap.get(givenId) == null) || idMap.get(givenId).equals(label)) { return false; } else { throw new RuntimeException("This id '" + id + "' is already assigned to a different label"); } } if (garbageQueue.contains(givenId)) { garbageQueue.remove(givenId); labelMap.put(label, givenId); idMap.put(givenId, label); } else { short insertId = intToShort(length++); while (insertId < givenId) { garbageQueue.add(insertId); insertId = intToShort(length++); if (length >= MAX_SIZE) { throw new RuntimeException("Maximum number of edge types reached at " + MAX_SIZE); } } labelMap.put(label, givenId); idMap.put(givenId, label); } return true; }
public int removeType(final Object label) { short id = labelMap.removeShort(label); if (id == NULL_SHORT) { return NULL_TYPE; } idMap.remove(id); garbageQueue.add(id); int intId = shortToInt(id); return intId; }
TableImpl<Edge> edgeTable = store.edgeTable; if (config.getEdgeWeightColumn()) { edgeTable.store.garbageQueue.add(edgeTable.store .intToShort(GraphStoreConfiguration.EDGE_WEIGHT_INDEX)); edgeTable.store.addColumn(new ColumnImpl(edgeTable, GraphStoreConfiguration.EDGE_WEIGHT_COLUMN_ID, } else { edgeTable.removeColumn(GraphStoreConfiguration.EDGE_WEIGHT_COLUMN_ID); edgeTable.store.garbageQueue.remove(edgeTable.store .intToShort(GraphStoreConfiguration.EDGE_WEIGHT_INDEX));
/** * {@inheritDoc} * * @deprecated Please use the corresponding type-specific method instead. */ @Deprecated @Override default ShortSortedSet headSet(final Short to) { return headSet(to.shortValue()); } /**
@Override public ShortBidirectionalIterator iterator(final short from) { return sortedSet.iterator(from); } @Override
public void clear() { labelMap.clear(); idMap.clear(); garbageQueue.clear(); length = 0; // Add null type short id = intToShort(NULL_LABEL); length++; labelMap.put(null, id); idMap.put(id, null); }
/** * {@inheritDoc} * * @deprecated Please use the corresponding type-specific method instead. */ @Deprecated @Override public Short last() { return sortedSet.last(); } /**
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); }
public boolean addType(final Object label, final int id) { short givenId = intToShort(id); short foundId = labelMap.getShort(label); if (foundId != NULL_SHORT && foundId != givenId) { throw new RuntimeException("This label '" + label + "' is already assigned to a different id"); } else if (idMap.containsKey(givenId)) { if ((label == null && idMap.get(givenId) == null) || idMap.get(givenId).equals(label)) { return false; } else { throw new RuntimeException("This id '" + id + "' is already assigned to a different label"); } } if (garbageQueue.contains(givenId)) { garbageQueue.remove(givenId); labelMap.put(label, givenId); idMap.put(givenId, label); } else { short insertId = intToShort(length++); while (insertId < givenId) { garbageQueue.add(insertId); insertId = intToShort(length++); if (length >= MAX_SIZE) { throw new RuntimeException("Maximum number of edge types reached at " + MAX_SIZE); } } labelMap.put(label, givenId); idMap.put(givenId, label); } return true; }
public int removeType(final Object label) { short id = labelMap.removeShort(label); if (id == NULL_SHORT) { return NULL_TYPE; } idMap.remove(id); garbageQueue.add(id); int intId = shortToInt(id); return intId; }
TableImpl<Edge> edgeTable = store.edgeTable; if (config.getEdgeWeightColumn()) { edgeTable.store.garbageQueue.add(edgeTable.store .intToShort(GraphStoreConfiguration.EDGE_WEIGHT_INDEX)); edgeTable.store.addColumn(new ColumnImpl(edgeTable, GraphStoreConfiguration.EDGE_WEIGHT_COLUMN_ID, } else { edgeTable.removeColumn(GraphStoreConfiguration.EDGE_WEIGHT_COLUMN_ID); edgeTable.store.garbageQueue.remove(edgeTable.store .intToShort(GraphStoreConfiguration.EDGE_WEIGHT_INDEX));
@Override public ShortSortedSet headSet(final short to) { return new SynchronizedSortedSet(sortedSet.headSet(to), sync); } @Override
@Override public ShortBidirectionalIterator iterator() { return sortedSet.iterator(); } @Override
garbageQueue.clear(); idMap.clear(); length = 0;
/** * {@inheritDoc} * * @deprecated Please use the corresponding type-specific method instead. */ @Deprecated @Override public Short last() { synchronized (sync) { return sortedSet.last(); } } /**
short id = idMap.getShort(columnImpl.getId()); if (id == NULL_SHORT) { if (!garbageQueue.isEmpty()) { id = garbageQueue.firstShort(); garbageQueue.remove(id); } else { id = intToShort(length);