/** * Returns a bitmap containing row numbers of all cells matching the given int * * @param value This is a 'key' from the index perspective, meaning it is a value from the standpoint of the column */ public Selection get(byte value) { Selection selection = new BitmapBackedSelection(); IntArrayList list = index.get(value); if (list != null) { addAllToSelection(list, selection); } return selection; }
public Selection lessThan(byte value) { Selection selection = new BitmapBackedSelection(); Byte2ObjectSortedMap<IntArrayList> head = index.headMap(value); // we add 1 to get values equal to the arg for (IntArrayList keys : head.values()) { addAllToSelection(keys, selection); } return selection; } }
private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException { s.defaultReadObject(); /* * The storedComparator is now correctly set, but we must restore on-the-fly the * actualComparator. */ setActualComparator(); allocatePaths(); if (count != 0) { tree = readTree(s, count, null, null); Entry<V> e; e = tree; while (e.left() != null) e = e.left(); firstEntry = e; e = tree; while (e.right() != null) e = e.right(); lastEntry = e; } } }
/** * Creates a new tree map copying a given map. * * @param m * a type-specific map to be copied into the new tree map. */ public Byte2ObjectAVLTreeMap(final Byte2ObjectMap<? extends V> m) { this(); putAll(m); } /**
/** * Returns the entry corresponding to the given key, if it is in the tree; * {@code null}, otherwise. * * @param k * the key to search for. * @return the corresponding entry, or {@code null} if no entry with the given * key exists. */ final Entry<V> findKey(final byte k) { Entry<V> e = tree; int cmp; while (e != null && (cmp = compare(k, e.key)) != 0) e = cmp < 0 ? e.left() : e.right(); return e; } /**
@Override public boolean containsKey(final byte k) { return findKey(k) != null; } @Override
@Override public V put(final byte k, final V v) { Entry<V> e = add(k); final V oldValue = e.value; e.value = v; return oldValue; } /**
@Override public void clear() { Byte2ObjectAVLTreeMap.this.clear(); } };
/** * Creates a new tree map using the elements of two parallel arrays and the * given comparator. * * @param k * the array of keys of the new tree map. * @param v * the array of corresponding values in the new tree map. * @param c * a (possibly type-specific) comparator. * @throws IllegalArgumentException * if {@code k} and {@code v} have different lengths. */ public Byte2ObjectAVLTreeMap(final byte[] k, final V v[], final Comparator<? super Byte> c) { this(c); if (k.length != v.length) throw new IllegalArgumentException( "The key array and the value array have different lengths (" + k.length + " and " + v.length + ")"); for (int i = 0; i < k.length; i++) this.put(k[i], v[i]); } /**
c.values = null; c.entries = null; c.allocatePaths(); if (count != 0) {
/** * Creates a new tree map copying a given map. * * @param m * a {@link Map} to be copied into the new tree map. */ public Byte2ObjectAVLTreeMap(final Map<? extends Byte, ? extends V> m) { this(); putAll(m); } /**
/** * Locates a key. * * @param k * a key. * @return the last entry on a search for the given key; this will be the given * key, if it present; otherwise, it will be either the smallest greater * key or the greatest smaller key. */ final Entry<V> locateKey(final byte k) { Entry<V> e = tree, last = tree; int cmp = 0; while (e != null && (cmp = compare(k, e.key)) != 0) { last = e; e = cmp < 0 ? e.left() : e.right(); } return cmp == 0 ? e : last; } /**
@Override public V get(final byte k) { final Entry<V> e = findKey(k); return e == null ? defRetValue : e.value; } @Override
public Selection atMost(byte value) { Selection selection = new BitmapBackedSelection(); Byte2ObjectSortedMap<IntArrayList> head = index.headMap((byte) (value + 1)); // we add 1 to get values equal to the arg for (IntArrayList keys : head.values()) { addAllToSelection(keys, selection); } return selection; }
/** * Creates a new tree map copying a given sorted map (and its * {@link Comparator}). * * @param m * a {@link SortedMap} to be copied into the new tree map. */ public Byte2ObjectAVLTreeMap(final SortedMap<Byte, V> m) { this(m.comparator()); putAll(m); } /**
int cmp, i = 0; while (true) { if ((cmp = compare(k, p.key)) == 0) { return p;
/** * Returns a bitmap containing row numbers of all cells matching the given int * * @param value This is a 'key' from the index perspective, meaning it is a value from the standpoint of the column */ public Selection get(byte value) { Selection selection = new BitmapBackedSelection(); IntArrayList list = index.get(value); if (list != null) { addAllToSelection(list, selection); } return selection; }
public Selection atMost(byte value) { Selection selection = new BitmapBackedSelection(); Byte2ObjectSortedMap<IntArrayList> head = index.headMap((byte) (value + 1)); // we add 1 to get values equal to the arg for (IntArrayList keys : head.values()) { addAllToSelection(keys, selection); } return selection; }
/** * Creates a new tree map copying a given sorted map (and its * {@link Comparator}). * * @param m * a type-specific sorted map to be copied into the new tree map. */ public Byte2ObjectAVLTreeMap(final Byte2ObjectSortedMap<V> m) { this(m.comparator()); putAll(m); } /**