|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.enough.polish.content.storage.StorageIndex
public class StorageIndex
Serves as an index for stored contents
| Field Summary | |
|---|---|
protected ArrayList |
index
the index list |
protected long |
maxCacheSize
the maximum cache size |
| Constructor Summary | |
|---|---|
StorageIndex(long maxCacheSize)
Creates a new StorageIndex instance |
|
| Method Summary | |
|---|---|
void |
addReference(StorageReference reference)
Adds a reference to the index and stores the index |
void |
applyOrder()
Applies the clean order to this index by the use of the internal index array and the compareTo() method |
int |
compare(Object first,
Object second)
Compares two objects. |
long |
getAvailableCacheSize()
Returns the maximum possible number of bytes that can be stored. |
long |
getCacheSize()
Returns the current cache size |
int |
getDisposableIndex()
Returns the index of the first disposable content. |
StorageReference |
getReference(ContentDescriptor descriptor)
Returns the reference for the specified descriptor if it is present in the index |
StorageReference |
getReference(int i)
Returns the reference at position i |
boolean |
isCleanNeeded()
Returns true, if the current cache size is greater than the threshold, otherwise false |
boolean |
isCleanNeeded(int extraBytes)
Returns true, if the current cache size is not enough to store an additional extraBytes bytes, otherwise false |
boolean |
isDisposableTo(StorageReference reference,
StorageReference master)
Returns true, if the reference is disposable to the specified master, otherwise false |
boolean |
isPrepared()
Returns true, if the index is prepared, otherwise false |
protected ArrayList |
load()
Loads the ArrayList representing the index. |
void |
prepare()
Prepares this index by calling load and adding the loaded references to the index |
void |
removeReference(StorageReference reference)
Removes a reference from the index and stores the index |
void |
shutdown()
Called when a content storage is shutdown. |
int |
size()
Returns the number of the references in this index |
protected void |
store(ArrayList index)
Stores the ArrayList representing the index. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected ArrayList index
protected final long maxCacheSize
| Constructor Detail |
|---|
public StorageIndex(long maxCacheSize)
maxCacheSize - the maximum cache size for this instances| Method Detail |
|---|
public void prepare()
public boolean isPrepared()
public void addReference(StorageReference reference)
reference - the referencepublic void removeReference(StorageReference reference)
reference - the referencepublic int getDisposableIndex()
public StorageReference getReference(int i)
i - the position
public int size()
public long getCacheSize()
public long getAvailableCacheSize()
protected ArrayList load()
protected void store(ArrayList index)
index - the ArrayList representing the indexpublic StorageReference getReference(ContentDescriptor descriptor)
descriptor - the content descriptor
public boolean isCleanNeeded()
public boolean isCleanNeeded(int extraBytes)
extraBytes - the number of extra bytes to store
public int compare(Object first,
Object second)
Comparator
compare in interface Comparatorfirst - the first objectsecond - the object that is compared with o1
public boolean isDisposableTo(StorageReference reference,
StorageReference master)
reference - the referencemaster - the master
public void applyOrder()
public void shutdown()
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||