ServiceList

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javax.tv.service.navigation
Interface ServiceList

    public interface ServiceList

`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.

See Also:
  `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(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

### sortByName

    ServiceList sortByName()

  Generates a new `ServiceList` containing the same elements as the current list, sorted in ascending order by service name.

  Returns:
    A `ServiceList` sorted by service name.
  See Also:
    `Service.getName()`

### sortByNumber

    ServiceList sortByNumber()
                             throws SortNotAvailableException

  Generates a new `ServiceList` containing the same elements as the current list, sorted in ascending order by service number.

  Returns:
    A `ServiceList` sorted by service number.
  Throws:
    `SortNotAvailableException` - If any of the `Service` objects in this `ServiceList` do not implement the `ServiceNumber` interface.
  See Also:
    `ServiceNumber`

### findService

    Service findService(Locator locator)
                        throws InvalidLocatorException

  Reports the `Service` corresponding to the specified locator if it is a member of this list.

  Parameters:
    `locator` - Specifies the `Service` to be searched for.
  Returns:
    The `Service` corresponding to `locator`, or `null` if the `Service` is not a member of this list.
  Throws:
    `InvalidLocatorException` - If `locator` does not reference a valid `Service`.

### filterServices

    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. 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.

  Parameters:
    `filter` - A filter constraining the requested service list, or `null`.
  Returns:
    A `ServiceList` object created based on the specified filtering rules.
  See Also:
    `ServiceFilter.accept(javax.tv.service.Service)`

### createServiceIterator

    ServiceIterator createServiceIterator()

  Generates an iterator on the `Service` elements in this list.

  Returns:
    A `ServiceIterator` on the `Service`s in this list.

### contains

    boolean contains(Service service)

  Tests if the indicated `Service` object is contained in the list.

  Parameters:
    `service` - The `Service` object for which to search.
  Returns:
    `true` if the specified `Service` is member of the list; `false` otherwise.

### indexOf

    int indexOf(Service service)

  Reports the position of the first occurrence of the indicated `Service` object in the list.

  Parameters:
    `service` - The `Service` object for which to search.
  Returns:
    The index of the first occurrence of the `service`, or `-1` if `service` is not contained in the list.

### size

    int size()

  Reports the number of `Service` objects in the list.

  Returns:
    The number of `Service` objects in the list.

### getService

    Service getService(int index)

  Reports the `Service` at the specified index position.

  Parameters:
    `index` - A position in the `ServiceList`.
  Returns:
    The `Service` at the specified index.
  Throws:
    `IndexOutOfBoundsException` - If `index` < 0 or `index` > `size()-1`.

### equals

    boolean equals(Object o)

  Compares the specified object with this `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.

  Overrides:
    `equals` in class `Object`
  Parameters:
    `o` - The object to be compared for equality with this list.
  Returns:
    `true` if the specified object is equal to this list; `false` otherwise.
  See Also:
    `Object.hashCode()`, `Hashtable`

### hashCode

    int hashCode()

  Provides the hash code value for this `ServiceList`. Two `ServiceList` objects that are equal will have the same hash code.

  Overrides:
    `hashCode` in class `Object`
  Returns:
    The hash code value of this `ServiceList`.
  See Also:
    `Object.equals(java.lang.Object)`, `Hashtable`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD