public void putAll(Topology<K> k, Iterable<V> vi) { if (vi!=null) for(V v : vi) put(k, v); }
public void put(Topology<K> t, V v) {
+ // XXX hack
+ if (t instanceof Atom) t = ((Atom)t).underlying();
for(Topology<K> ht : h.keySet()) {
if (t.disjoint(ht)) continue;
if (t.containsAll(ht) && ht.containsAll(t)) {
}
}
- public VisitableMap<K,V> optimize() {
+ public VisitableMap<K,V> optimize(final Functor<K,Integer> f) {
ArrayList<Long> min_ = new ArrayList<Long>();
ArrayList<Long> max_ = new ArrayList<Long>();
ArrayList<Object[]> v_ = new ArrayList<Object[]>();
final Object[][] v = new Object[size][]; v_.toArray(v);
return new VisitableMap<K,V>() {
public boolean contains(K k) {
- IntegerTopology.IntegerMappable im = (IntegerTopology.IntegerMappable)k;
- int asint = im.toInt();
+ int asint = f.invoke(k);
for(int i=0; i<size; i++)
if (min[i] <= asint && max[i] >= asint && v[i].length > 0)
return true;
return false;
}
public <B,C> void invoke(K k, Invokable<V,B,C> ivbc, B b, C c) {
- IntegerTopology.IntegerMappable im = (IntegerTopology.IntegerMappable)k;
- int asint = im.toInt();
+ int asint = f.invoke(k);
for(int i=0; i<size; i++) {
if (min[i] <= asint && max[i] >= asint) {
Object[] arr = v[i];