|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.ws4d.java.structures.DataStructure
org.ws4d.java.structures.List
org.ws4d.java.structures.LockedList
public class LockedList
Synchronized List Class, uses lockSupport for synchronization.
| Constructor Summary | |
|---|---|
LockedList()
Constructor. |
|
LockedList(List list)
Constructor. |
|
LockedList(List list,
Lockable lock)
Constructor. |
|
| Method Summary | |
|---|---|
void |
add(int index,
java.lang.Object obj)
|
boolean |
add(java.lang.Object obj)
Adds a new object to this data structure. |
boolean |
addAll(DataStructure data)
Adds all objects contained within data to this instance. |
boolean |
addAll(int index,
DataStructure data)
|
void |
clear()
Clears this data structure by removing all content from it. |
boolean |
contains(java.lang.Object obj)
Checks whether obj (or another instance equal to
obj in terms of java.lang.Object.equals(Object)
) is already present within this data structure instance and returns
true only if this is the case. |
boolean |
containsAll(DataStructure data)
Checks whether all items within data are present within this
data structure instance and returns true only if this is the
case. |
boolean |
equals(java.lang.Object o)
|
void |
exclusiveLock()
Acquires an exclusive lock. |
java.lang.Object |
get(int index)
|
int |
hashCode()
|
int |
indexOf(java.lang.Object obj)
|
boolean |
isEmpty()
Checks whether this instance is empty or not. |
Iterator |
iterator()
Manual synchronization of iterator necessary. |
int |
lastIndexOf(java.lang.Object obj)
|
ListIterator |
listIterator()
|
ListIterator |
listIterator(int index)
|
boolean |
releaseExclusiveLock()
Releases an exclusive lock of the current thread. |
void |
releaseSharedLock()
Releases a shared lock of the current thread. |
java.lang.Object |
remove(int index)
|
boolean |
remove(java.lang.Object obj)
Removes obj from this data structure. |
java.lang.Object |
set(int index,
java.lang.Object obj)
|
void |
sharedLock()
Acquires a shared lock. |
int |
size()
Returns the current size of the data structure. |
List |
subList(int fromIndex,
int toIndex)
|
java.lang.Object[] |
toArray()
Returns an array containing all items stored within this data structure. |
java.lang.Object[] |
toArray(java.lang.Object[] object)
Stores all contained items into the passed-in array objects. |
java.lang.String |
toString()
|
boolean |
tryExclusiveLock()
Try to get an exclusive lock immediately. |
boolean |
trySharedLock()
Tries to get a shared lock immediately. |
| Methods inherited from class org.ws4d.java.structures.List |
|---|
getClassShortName |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public LockedList()
public LockedList(List list)
list - List, which should be synchronized
public LockedList(List list,
Lockable lock)
list - List, which should be synchronizedlock - Lock for access synchronization.| Method Detail |
|---|
public void sharedLock()
Lockable
sharedLock in interface Lockablepublic void exclusiveLock()
Lockable
exclusiveLock in interface Lockablepublic void releaseSharedLock()
Lockable
releaseSharedLock in interface Lockablepublic boolean releaseExclusiveLock()
Lockable
releaseExclusiveLock in interface Lockablepublic boolean tryExclusiveLock()
Lockable
tryExclusiveLock in interface Lockabletrue if the lock has been allocated,
false otherwisepublic boolean trySharedLock()
Lockable
trySharedLock in interface Lockabletrue if the lock has been allocated,
false otherwise
public void add(int index,
java.lang.Object obj)
add in class List
public boolean addAll(int index,
DataStructure data)
addAll in class Listpublic java.lang.Object get(int index)
get in class Listpublic int indexOf(java.lang.Object obj)
indexOf in class Listpublic int lastIndexOf(java.lang.Object obj)
lastIndexOf in class Listpublic ListIterator listIterator()
listIterator in class Listpublic ListIterator listIterator(int index)
listIterator in class Listpublic java.lang.Object remove(int index)
remove in class List
public java.lang.Object set(int index,
java.lang.Object obj)
set in class List
public List subList(int fromIndex,
int toIndex)
subList in class Listpublic Iterator iterator()
iterator in class Listpublic int size()
DataStructure
size in class Listpublic boolean contains(java.lang.Object obj)
DataStructureobj (or another instance equal to
obj in terms of java.lang.Object.equals(Object)
) is already present within this data structure instance and returns
true only if this is the case.
contains in class DataStructureobj - the object to check the presence of
true if obj is contained by this
instance, false if notpublic boolean remove(java.lang.Object obj)
DataStructureobj from this data structure. Returns
true if obj was actually present and thus it
was really removed (i.e. this instance was modified by the method call).
remove in class DataStructureobj - the object to remove
true only if obj was actually removedpublic void clear()
DataStructure
clear in class DataStructurepublic boolean add(java.lang.Object obj)
DataStructure
add in class Listobj - the object to add
true if the object was actually added,
false in any other case (e.g. adding an object to a
set which already contains the same object in terms of
java.lang.Object.equals(Object))public boolean addAll(DataStructure data)
DataStructuredata to this instance.
addAll in class Listdata - the objects to add
true if at least one object from data
was actually added, i.e. a modification was made to this
instance, false in any other case (e.g. adding
objects to a set which already contains them in terms of
java.lang.Object.equals(Object))public boolean containsAll(DataStructure data)
DataStructuredata are present within this
data structure instance and returns true only if this is the
case.
containsAll in class DataStructuredata - the items to check the presence of
true if all objects within data are
contained by this instance, false if at least one of
them is notpublic boolean isEmpty()
DataStructure
isEmpty in class DataStructuretrue if this data structure is empty,
false otherwisepublic java.lang.Object[] toArray()
DataStructureDataStructure.size(), i.e. for an empty data
structure an array of length zero is returned (rather than
null).
toArray in class DataStructurenullpublic java.lang.Object[] toArray(java.lang.Object[] object)
DataStructureobjects.
Returns the same array.
The array is expected not to be null and to be of exactly
DataStructure.size() length. Otherwise, either a
java.lang.NullPointerException or an
java.lang.IllegalArgumentException will be thrown.
toArray in class DataStructureobject - the array to store this data structure's content to
objects),
however after having been filled with all objects contained
within this data structure instancepublic int hashCode()
hashCode in class DataStructurepublic boolean equals(java.lang.Object o)
equals in class Listpublic java.lang.String toString()
toString in class DataStructure
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||