public class ReservableCells
extends java.lang.Object
Constructor and Description |
---|
ReservableCells(java.lang.String name,
int capacity)
initialzes the list with capacity of cells
|
Modifier and Type | Method and Description |
---|---|
int |
cancel(int id)
cancels the reservation on the id-th cell and returns the size upon
success or -1 otherwise.
|
void |
clear()
clear all cells and reset all marks
|
protected void |
finalize() |
int |
getCapacity() |
int |
getCellStatus(int id)
returns the status of the cell with the id if it is not out of bound
or -1 otherwise
|
java.lang.String |
getName() |
int |
queryIDs(int[] ids,
int type)
loads the ids of the type of cells in the natual order to the given array
|
int |
reserve(long milliSec)
reserves the next empty cell so that it is ready to be occupied
|
int |
reserve(long milliSec,
int id)
reserves the id-th cell and returns the id upon success or -1 otherwise.
|
int |
reserve(long milliSec,
int begin,
int len)
reserves the first empty cell out of len cells starting from begin
|
int |
size()
returns the number of reserved cells
|
public ReservableCells(java.lang.String name, int capacity)
public java.lang.String getName()
public int size()
public int getCapacity()
public int getCellStatus(int id)
public int cancel(int id)
public int reserve(long milliSec, int id)
public int reserve(long milliSec, int begin, int len)
public int reserve(long milliSec)
public int queryIDs(int[] ids, int type)
public void clear()
protected void finalize()
finalize
in class java.lang.Object