|
JSR-927 (Maintenance Release) | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ServiceList
represents an ordered list of
Service
objects based on a specific grouping rule
defined by a ServiceFilter
. The objects in a
ServiceList
are numbered from 0 to size()
-1
.
A ServiceList
is immutable. In other words,
once a ServiceList
instance is created, the elements
in the list and their order will never change. All classes that
implement the ServiceList
interface are required to
maintain this property.
Service
,
ServiceFilter
,
size()
Method Summary | |
boolean |
contains(Service service)
Tests if the indicated Service object is contained
in the list. |
ServiceIterator |
createServiceIterator()
Generates an iterator on the Service elements
in this list. |
boolean |
equals(java.lang.Object o)
Compares the specified object with this ServiceList
for equality. |
ServiceList |
filterServices(ServiceFilter filter)
Creates a new ServiceList object that is a subset of
this list, based on the conditions specified by a
ServiceFilter object. |
Service |
findService(Locator locator)
Reports the Service corresponding to the specified
locator if it is a member of this list. |
Service |
getService(int index)
Reports the Service at the specified index position. |
int |
hashCode()
Provides the hash code value for this ServiceList . |
int |
indexOf(Service service)
Reports the position of the first occurrence of the indicated Service object in the list. |
int |
size()
Reports the number of Service objects in the list. |
ServiceList |
sortByName()
Generates a new ServiceList containing the
same elements as the current list, sorted in ascending
order by service name. |
ServiceList |
sortByNumber()
Generates a new ServiceList containing the
same elements as the current list, sorted in ascending
order by service number. |
Method Detail |
public ServiceList sortByName()
ServiceList
containing the
same elements as the current list, sorted in ascending
order by service name. The sort order is implementation dependent,
but should be sensible when presented to a user.
ServiceList
sorted by service name.Service.getName()
public ServiceList sortByNumber() throws SortNotAvailableException
ServiceList
containing the
same elements as the current list, sorted in ascending
order by service number.
ServiceList
sorted by service number.
SortNotAvailableException
- If any of the
Service
objects in this ServiceList
do not implement the ServiceNumber
interface.ServiceNumber
public Service findService(Locator locator) throws InvalidLocatorException
Service
corresponding to the specified
locator if it is a member of this list.
locator
- Specifies the Service
to be searched for.
Service
corresponding to
locator
, or null
if the
Service
is not a member of this list.
InvalidLocatorException
- If locator
does not
reference a valid Service
.public ServiceList filterServices(ServiceFilter filter)
ServiceList
object that is a subset of
this list, based on the conditions specified by a
ServiceFilter
object. This method may be used to
generate increasingly specialized lists of Service
objects based on multiple filtering criteria. If the filter is
null
, the resulting ServiceList
will be
a duplicate of this list.
Note that the accept
method of the given
ServiceFilter
will be invoked for each
Service
to be filtered using the same application
thread that invokes this method.
filter
- A filter constraining the requested service list,
or null
.
ServiceList
object created based on the
specified filtering rules.ServiceFilter.accept(javax.tv.service.Service)
public ServiceIterator createServiceIterator()
Service
elements
in this list.
ServiceIterator
on the
Service
s in this list.public boolean contains(Service service)
Service
object is contained
in the list.
service
- The Service
object for which to search.
true
if the specified Service
is member of the list; false
otherwise.public int indexOf(Service service)
Service
object in the list.
service
- The Service
object for which to search.
service
, or -1
if service
is not contained in the list.public int size()
Service
objects in the list.
Service
objects in the list.public Service getService(int index)
Service
at the specified index position.
index
- A position in the ServiceList
.
Service
at the specified index.
java.lang.IndexOutOfBoundsException
- If index
< 0 or
index
> size()-1
.public boolean equals(java.lang.Object o)
ServiceList
for equality. Returns true
if and only if the
specified object is also a ServiceList
, both lists
have the same size, and all corresponding pairs of elements in
the two lists are equal. (Two elements e1 and e2 are equal if
(e1==null ? e2==null : e1.equals(e2)).) In other words, two lists
are defined to be equal if they contain the same elements in the
same order.
o
- The object to be compared for equality with this list.
true
if the specified object is equal to
this list; false
otherwise.public int hashCode()
ServiceList
.
Two ServiceList
objects that are equal will have
the same hash code.
ServiceList
.
|
JSR-927 (Maintenance Release) | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |