Beispiel #1
0
 @Override
 public T put(DBIDRef id, T value) {
   if (value == null) {
     return data.remove(DBIDUtil.deref(id));
   }
   return data.put(DBIDUtil.deref(id), value);
 }
Beispiel #2
0
 /**
  * Actual setter.
  *
  * @param id Database ID
  * @param index column index
  * @param value new value
  * @param <T> type
  * @return previous value
  */
 @SuppressWarnings("unchecked")
 protected <T> T set(DBIDRef id, int index, T value) {
   Object[] d = data.get(DBIDUtil.deref(id));
   if (d == null) {
     d = new Object[rlen];
     data.put(DBIDUtil.deref(id), d);
   }
   T ret = (T) d[index];
   d[index] = value;
   return ret;
 }
Beispiel #3
0
 /**
  * Actual getter.
  *
  * @param id Database ID
  * @param index column index
  * @param <T> type
  * @return current value
  */
 @SuppressWarnings("unchecked")
 protected <T> T get(DBIDRef id, int index) {
   Object[] d = data.get(DBIDUtil.deref(id));
   if (d == null) {
     return null;
   }
   return (T) d[index];
 }
Beispiel #4
0
 @Override
 public void initialize() {
   super.initialize();
   List<MkAppEntry> objs = new ArrayList<>(relation.size());
   for (DBIDIter iter = relation.iterDBIDs(); iter.valid(); iter.advance()) {
     DBID id = DBIDUtil.deref(iter);
     final O object = relation.get(id);
     objs.add(createNewLeafEntry(id, object, Double.NaN));
   }
   insertAll(objs);
 }
Beispiel #5
0
  /**
   * Inserts the specified objects into this index. If a bulk load mode is implemented, the objects
   * are inserted in one bulk.
   *
   * @param ids the objects to be inserted
   */
  @Override
  public void insertAll(DBIDs ids) {
    if (ids.isEmpty() || (ids.size() == 1)) {
      return;
    }

    // Make an example leaf
    if (canBulkLoad()) {
      List<SpatialEntry> leafs = new ArrayList<>(ids.size());
      for (DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) {
        leafs.add(createNewLeafEntry(iter));
      }
      bulkLoad(leafs);
    } else {
      for (DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) {
        insert(DBIDUtil.deref(iter));
      }
    }

    doExtraIntegrityChecks();
  }
Beispiel #6
0
 @Override
 public T get(DBIDRef id) {
   return data.get(DBIDUtil.deref(id));
 }
Beispiel #7
0
 /**
  * Create a new leaf entry.
  *
  * @param id Object id
  * @return Spatial leaf entry
  */
 protected SpatialPointLeafEntry createNewLeafEntry(DBIDRef id) {
   return new SpatialPointLeafEntry(DBIDUtil.deref(id), relation.get(id));
 }