A simple implementation of BlockList @author Marc Johnson (mjohnson at apache dot org
| 25 | * @author Marc Johnson (mjohnson at apache dot org |
| 26 | */ |
| 27 | abstract class BlockListImpl implements BlockList { |
| 28 | private ListManagedBlock[] _blocks; |
| 29 | private BlockAllocationTableReader _bat; |
| 30 | |
| 31 | protected BlockListImpl() |
| 32 | { |
| 33 | _blocks = new ListManagedBlock[ 0 ]; |
| 34 | _bat = null; |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * provide blocks to manage |
| 39 | * |
| 40 | * @param blocks blocks to be managed |
| 41 | */ |
| 42 | protected void setBlocks(final ListManagedBlock [] blocks) |
| 43 | { |
| 44 | _blocks = blocks; |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * remove the specified block from the list |
| 49 | * |
| 50 | * @param index the index of the specified block; if the index is |
| 51 | * out of range, that's ok |
| 52 | */ |
| 53 | public void zap(final int index) |
| 54 | { |
| 55 | if ((index >= 0) && (index < _blocks.length)) |
| 56 | { |
| 57 | _blocks[ index ] = null; |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * Unit testing method. Gets, without sanity checks or |
| 63 | * removing. |
| 64 | */ |
| 65 | protected ListManagedBlock get(final int index) { |
| 66 | return _blocks[index]; |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * remove and return the specified block from the list |
| 71 | * |
| 72 | * @param index the index of the specified block |
| 73 | * |
| 74 | * @return the specified block |
| 75 | * |
| 76 | * @exception IOException if the index is out of range or has |
| 77 | * already been removed |
| 78 | */ |
| 79 | public ListManagedBlock remove(final int index) |
| 80 | throws IOException |
| 81 | { |
| 82 | ListManagedBlock result = null; |
| 83 | |
| 84 | try |
nothing calls this directly
no outgoing calls
no test coverage detected