| bak.pcj.list.AbstractFloatList bak.pcj.adapter.ListToFloatListAdapter
ListToFloatListAdapter | public class ListToFloatListAdapter extends AbstractFloatList (Code) | | This class represents adaptions of Java Collections Framework
lists to primitive lists of float values.
The adapter is implemented as a wrapper around the list.
Thus, changes to the underlying list are reflected by this
list and vice versa.
Adapters from JCF collections to primitive collections will
fail if the JCF collection contains null values or
values of the wrong class. However, adapters are not fast
failing in the case that the underlying collection should
contain illegal values. To implement fast failure would require
every operation to check every element of the underlying
collection before doing anything. Instead validation methods
are provided. They can be called using the assertion facility
in the client code:
ListToFloatListAdapter s;
...
assert s.validate();
or by letting the adapter throw an exception on illegal values:
ListToFloatListAdapter s;
...
s.evalidate(); // Throws an exception on illegal values
Either way, validation must be invoked directly by the client
code.
author: Søren Bak version: 1.2 20-08-2003 23:17 since: 1.0 |
Field Summary | |
protected List | list The underlying list. |
Constructor Summary | |
public | ListToFloatListAdapter(List list) Creates a new adaption of a list to a list of float
values.
Parameters: list - the underlying list. | public | ListToFloatListAdapter(List list, boolean validate) Creates a new adaption of a list to a list of float
values. |
Method Summary | |
public void | add(int index, float v) | public void | evalidate() Validates the list underlying this adapter and throws
an exception if it is invalid. | public float | get(int index) | public FloatListIterator | listIterator(int index) | public float | removeElementAt(int index) | public float | set(int index, float v) | public int | size() | public boolean | validate() Indicates whether the underlying list is valid for
this adapter. |
list | protected List list(Code) | | The underlying list.
|
ListToFloatListAdapter | public ListToFloatListAdapter(List list)(Code) | | Creates a new adaption of a list to a list of float
values.
Parameters: list - the underlying list. This list mustconsist of values of classFloat Float. Otherwise aClassCastException ClassCastExceptionwill be thrown by some methods. throws: NullPointerException - if list is null. |
ListToFloatListAdapter | public ListToFloatListAdapter(List list, boolean validate)(Code) | | Creates a new adaption of a list to a list of float
values. The list to adapt is optionally validated.
Parameters: list - the underlying list. This collection mustconsist of values of classFloat Float. Otherwise aClassCastException ClassCastExceptionwill be thrown by some methods. Parameters: validate - indicates whether list shouldbe checked for illegal values. throws: NullPointerException - if list is null. throws: IllegalStateException - if validate is true andlist contains a null valueor a value that is not of classFloat Float. |
add | public void add(int index, float v)(Code) | | |
evalidate | public void evalidate()(Code) | | Validates the list underlying this adapter and throws
an exception if it is invalid. For the underlying list
to be valid, it can only contain
Float Float values and no null values.
throws: IllegalStateException - if the underlying list is invalid. |
get | public float get(int index)(Code) | | |
removeElementAt | public float removeElementAt(int index)(Code) | | |
set | public float set(int index, float v)(Code) | | |
validate | public boolean validate()(Code) | | Indicates whether the underlying list is valid for
this adapter. For the underlying list to be valid, it
can only contain
Float Float values and no null
values.
true if the underlying list isvalid; returns false otherwise. |
|
|