public class CollectibleCells
extends java.lang.Object
Constructor and Description |
---|
CollectibleCells(java.lang.String name,
int capacity)
initialzes the list with capacity of cells
|
Modifier and Type | Method and Description |
---|---|
void |
acknowledge(long[] state)
acknowledges the request msgs only
|
void |
clear()
clear all cells and reset all marks
|
int |
collect(long milliSec)
collects the next collectible cell and returns its id upon success or -1
otherwise.
|
int |
collect(long milliSec,
int id)
collects the id-th cell and returns the id upon success or -1 otherwise.
|
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 |
size()
returns the number of taken cells in the list
|
int |
take(int id)
takes the empty cell with the id and returns the size upon success or
-1 otherwise.
|
public CollectibleCells(java.lang.String name, int capacity)
public java.lang.String getName()
public int size()
public int getCapacity()
public int getCellStatus(int id)
public int collect(long milliSec, int id)
public int collect(long milliSec)
public int take(int id)
public int queryIDs(int[] ids, int type)
public void acknowledge(long[] state)
public void clear()
protected void finalize()
finalize
in class java.lang.Object