Пример #1
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.asInteger(id));
   if (d == null) {
     d = new Object[rlen];
     data.put(DBIDUtil.asInteger(id), d);
   }
   T ret = (T) d[index];
   d[index] = value;
   return ret;
 }
Пример #2
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.asInteger(id));
   if (d == null) {
     return null;
   }
   return (T) d[index];
 }
Пример #3
0
 @Override
 public int binarySearch(DBIDRef key) {
   int keyid = DBIDUtil.asInteger(key);
   if (keyid < start) {
     return -1;
   }
   final int off = keyid - start;
   if (off < len) {
     return off;
   }
   return -(len + 1);
 }
Пример #4
0
 @Override
 public boolean remove(DBIDRef id) {
   return data.remove(DBIDUtil.asInteger(id)) != null;
 }