Rejiggering.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@2658 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
ray.j.greenwell
2009-12-02 21:30:17 +00:00
parent 3658a26e13
commit 61b3fca73a
@@ -196,7 +196,9 @@ public class ArrayIntSet extends AbstractIntSet
public boolean remove (int value) public boolean remove (int value)
{ {
int index = binarySearch(value); int index = binarySearch(value);
if (index >= 0) { if (index < 0) {
return false;
}
_size--; _size--;
if ((_values.length > DEFAULT_CAPACITY) && (_size < _values.length/8)) { if ((_values.length > DEFAULT_CAPACITY) && (_size < _values.length/8)) {
// if we're using less than 1/8 of our capacity, shrink by half // if we're using less than 1/8 of our capacity, shrink by half
@@ -208,12 +210,10 @@ public class ArrayIntSet extends AbstractIntSet
} else { } else {
// shift entries past the removed one downwards // shift entries past the removed one downwards
System.arraycopy(_values, index+1, _values, index, _size-index); System.arraycopy(_values, index+1, _values, index, _size-index);
_values[_size] = 0; //_values[_size] = 0;
} }
return true; return true;
} }
return false;
}
// from interface IntSet // from interface IntSet
public Interator interator () public Interator interator ()
@@ -239,7 +239,7 @@ public class ArrayIntSet extends AbstractIntSet
// remove() is called twice in a row... // remove() is called twice in a row...
System.arraycopy(_values, _pos, _values, _pos - 1, _size - _pos); System.arraycopy(_values, _pos, _values, _pos - 1, _size - _pos);
_pos--; _pos--;
_values[--_size] = 0; _size--; //_values[--_size] = 0;
} }
protected int _pos; protected int _pos;