public class ServiceCollection extends Object implements Collection, List, Set
Collection
, that can be passed to helper objects (Collaborators).
The Collection.iterator()
method returns an Iterator
iterating
on a cached copy of available service objects. In the case that there are no
available services, the policies act as follows:
Constructor and Description |
---|
ServiceCollection(Dependency dep)
Creates a Service Collection.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
Object obj)
Unsupported method.
|
boolean |
add(Object o)
Unsupported method.
|
boolean |
addAll(Collection c)
Unsupported method.
|
boolean |
addAll(int index,
Collection c)
Unsupported method.
|
void |
clear()
Unsupported method.
|
boolean |
contains(Object o)
Checks if the wrapped dependency has always access to the
given service object.The method allows knowing if the provider returning the
service object has left.
|
boolean |
containsAll(Collection c)
Checks if the wrapped dependencies has always access to the
given service objects.The method allows knowing if providers returning the
service objects have left.
|
Object |
get(int index)
Gets the object stored at the given index.
|
int |
indexOf(Object o)
Gets the index of the given object in the current
collection.
|
boolean |
isEmpty()
Checks if at least one provider matching with the dependency
is available.
|
Iterator |
iterator()
Gets an iterator on the current list of available service objects.
|
int |
lastIndexOf(Object o)
Gets the last index of the given object in the current
collection.
|
ListIterator |
listIterator()
Gets a list iterator on the current list of available service objects.
|
ListIterator |
listIterator(int index)
Unsupported Method.
|
Object |
remove(int index)
Unsupported method.
|
boolean |
remove(Object o)
Unsupported method.
|
boolean |
removeAll(Collection c)
Unsupported method.
|
boolean |
retainAll(Collection c)
Unsupported method.
|
Object |
set(int arg0,
Object arg1)
Unsupported Method.
|
int |
size()
Gets the number of available providers.
|
List |
subList(int fromIndex,
int toIndex)
Returns a sublist from the current list.
|
Object[] |
toArray()
Returns an array containing available service objects.
|
Object[] |
toArray(Object[] a)
Returns an array containing available service objects.
|
public ServiceCollection(Dependency dep)
dep
- the wrapped dependencypublic boolean add(Object o)
add
in interface Collection
add
in interface List
add
in interface Set
o
- an objectCollection.add(java.lang.Object)
public boolean addAll(Collection c)
addAll
in interface Collection
addAll
in interface List
addAll
in interface Set
c
- an objectCollection.addAll(java.util.Collection)
public void add(int index, Object obj)
add
in interface List
index
- an indexobj
- an objectList.add(int, java.lang.Object)
public boolean addAll(int index, Collection c)
addAll
in interface List
index
- an indexc
- an objectList.addAll(int, java.util.Collection)
public void clear()
clear
in interface Collection
clear
in interface List
clear
in interface Set
Collection.clear()
public boolean contains(Object o)
contains
in interface Collection
contains
in interface List
contains
in interface Set
o
- the service objecttrue
if the object is still available,
false
otherwise.Collection.contains(java.lang.Object)
public boolean containsAll(Collection c)
containsAll
in interface Collection
containsAll
in interface List
containsAll
in interface Set
c
- the set of service objecttrue
if the objects are still available,
false
otherwise.Collection.contains(java.lang.Object)
public boolean isEmpty()
isEmpty
in interface Collection
isEmpty
in interface List
isEmpty
in interface Set
true
if one provider or more satisfying the
dependency are available. Otherwise, returns false
Collection.isEmpty()
public Iterator iterator()
iterator
in interface Iterable
iterator
in interface Collection
iterator
in interface List
iterator
in interface Set
Collection.iterator()
public boolean remove(Object o)
remove
in interface Collection
remove
in interface List
remove
in interface Set
o
- a objectCollection.remove(java.lang.Object)
public Object remove(int index)
remove
in interface List
index
- the indexCollection.remove(java.lang.Object)
public boolean removeAll(Collection c)
removeAll
in interface Collection
removeAll
in interface List
removeAll
in interface Set
c
- a set of objectsCollection.removeAll(java.util.Collection)
public boolean retainAll(Collection c)
retainAll
in interface Collection
retainAll
in interface List
retainAll
in interface Set
c
- a set of objectsCollection.retainAll(java.util.Collection)
public int size()
size
in interface Collection
size
in interface List
size
in interface Set
Collection.size()
public Object[] toArray()
toArray
in interface Collection
toArray
in interface List
toArray
in interface Set
Collection.toArray()
public Object[] toArray(Object[] a)
toArray
in interface Collection
toArray
in interface List
toArray
in interface Set
a
- the array into which the elements of this collection
are to be stored, if it is big enough; otherwise, a new array
of the same runtime type is allocated for this purpose.Collection.toArray(java.lang.Object[])
public Object get(int index)
get
in interface List
index
- the indexList.get(int)
public int indexOf(Object o)
indexOf
in interface List
o
- the object-1
if not found.List.indexOf(java.lang.Object)
public int lastIndexOf(Object o)
lastIndexOf
in interface List
o
- the object-1
if not found.List.lastIndexOf(java.lang.Object)
public ListIterator listIterator()
listIterator
in interface List
List.listIterator()
public ListIterator listIterator(int index)
listIterator
in interface List
index
- an indexList.listIterator(int)
public List subList(int fromIndex, int toIndex)
subList
in interface List
fromIndex
- the index of the list beginningtoIndex
- the index of the list endList.subList(int, int)
Copyright © 2012-2013 Adele Team | LIG. All Rights Reserved.