/** Does this set contain a certain object? */ public boolean contains(T o) { int n = map.getMappedIndex(o); if (n == -1) { return false; } return vector.get(n); }
/** * Remove an object from this bit set. * * @param o the object to remove */ public void clear(T o) { int n = map.getMappedIndex(o); if (n == -1) { return; } vector.clear(n); }
/** * Constructor: create an empty set corresponding to a given mapping * * @throws IllegalArgumentException if map is null */ public BitSet(OrdinalSetMapping<T> map) { if (map == null) { throw new IllegalArgumentException("map is null"); } int length = map.getMaximumIndex(); vector = new BitVector(length); this.map = map; }
public Iterator<T> iterator() { return delegate.iterator(); }
public boolean hasMappedIndex(T o) { return delegate.hasMappedIndex(o); }
public T getMappedObject(int n) throws NoSuchElementException { return delegate.getMappedObject(n - offset); }
public int getMappedIndex(T o) { if (delegate.getMappedIndex(o) == -1) { return -1; } return offset + delegate.getMappedIndex(o); }
public int add(T o) { return offset + delegate.add(o); }
public int getSize() { return delegate.getSize(); }
public int getMaximumIndex() { return offset + delegate.getMaximumIndex(); }
/** Add an object to this bit set. */ public void add(T o) { int n = map.getMappedIndex(o); vector.set(n); }