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; }
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; }
public Object removeType(final int type) { checkValidId(type); short id = intToShort(type); Object label = idMap.remove(id); if (label != null) { labelMap.remove(label); garbageQueue.add(id); } return label; }
public Object removeType(final int type) { checkValidId(type); short id = intToShort(type); Object label = idMap.remove(id); if (label != null) { labelMap.remove(label); garbageQueue.add(id); } return label; }
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; }
private EdgeTypeStore deserializeEdgeTypeStore(final DataInput is) throws IOException, ClassNotFoundException { int length = (Integer) deserialize(is); short[] ids = (short[]) deserialize(is); Object[] labels = (Object[]) deserialize(is); short[] garbage = (short[]) deserialize(is); EdgeTypeStore edgeTypeStore = model.store.edgeTypeStore; edgeTypeStore.length = length; for (int i = 0; i < ids.length; i++) { short id = ids[i]; Object label = labels[i]; edgeTypeStore.idMap.put(id, label); edgeTypeStore.labelMap.put(label, id); } for (int i = 0; i < garbage.length; i++) { edgeTypeStore.garbageQueue.add(garbage[i]); } return edgeTypeStore; }
private EdgeTypeStore deserializeEdgeTypeStore(final DataInput is) throws IOException, ClassNotFoundException { int length = (Integer) deserialize(is); short[] ids = (short[]) deserialize(is); Object[] labels = (Object[]) deserialize(is); short[] garbage = (short[]) deserialize(is); EdgeTypeStore edgeTypeStore = model.store.edgeTypeStore; edgeTypeStore.length = length; for (int i = 0; i < ids.length; i++) { short id = ids[i]; Object label = labels[i]; edgeTypeStore.idMap.put(id, label); edgeTypeStore.labelMap.put(label, id); } for (int i = 0; i < garbage.length; i++) { edgeTypeStore.garbageQueue.add(garbage[i]); } return edgeTypeStore; }
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; }
private ColumnStore deserializeColumnStore(final DataInput is, final TableImpl table) throws IOException, ClassNotFoundException { ColumnStore columnStore = table.store; int length = (Integer) deserialize(is); columnStore.length = length; for (int i = 0; i < length; i++) { ColumnImpl col = (ColumnImpl) deserializeColumn(is, table); if (col != null) { columnStore.columns[col.storeId] = col; columnStore.idMap.put(col.id, columnStore.intToShort(col.storeId)); if (columnStore.indexStore != null) { columnStore.indexStore.addColumn(col); } } } short[] garbage = (short[]) deserialize(is); for (int i = 0; i < garbage.length; i++) { columnStore.garbageQueue.add(garbage[i]); } return columnStore; }
private ColumnStore deserializeColumnStore(final DataInput is, final TableImpl table) throws IOException, ClassNotFoundException { ColumnStore columnStore = table.store; int length = (Integer) deserialize(is); columnStore.length = length; for (int i = 0; i < length; i++) { ColumnImpl col = (ColumnImpl) deserializeColumn(is, table); if (col != null) { columnStore.columns[col.storeId] = col; columnStore.idMap.put(col.id, columnStore.intToShort(col.storeId)); if (columnStore.indexStore != null) { columnStore.indexStore.addColumn(col); } } } short[] garbage = (short[]) deserialize(is); for (int i = 0; i < garbage.length; i++) { columnStore.garbageQueue.add(garbage[i]); } return columnStore; }
throw new IllegalArgumentException("The column doesnt exist"); garbageQueue.add(id);
throw new IllegalArgumentException("The column doesnt exist"); garbageQueue.add(id);
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,
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,