|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gishur.core.ListView
A ListView
object permits (restricted) read access to a list.
If a method, for example, has to receive any sort of list structure as input,
the exact type of the structure must be known if ListView
is not used,
because BasicList
does not allow any access to its data.
If a structure overrides the method BasicList.getListView()
and returns
a ListView
object, read access to that structure can be granted.
ListView
can determine different restrictions to the read access.
A properly functioning ListView
object can only be created from the
structure, belonging to the ListView
- if it implements BasicList.getListView()
correctly. ListView
performs requests to the
structure using the Owner
interface.
The read access functions
correspond mainly to the functions of SimpleList
. If the underlying
structure has restricted a function, ListView
generates a ListException
, when this function is accessed; a ListException
is also
thrown when trying an illegal instanciation.
BasicList
,
SimpleList
Field Summary | |
static int |
ALLOW_COMPARITORS
Permits the use of comparitor objects for searching etc. |
static int |
ALLOW_CONVERSIONS
Permits copying of selected data to other structures |
static int |
ALLOW_FIND
Permits search for certain objects (dependant on SHOW_KEYS etc.) |
static int |
ALLOW_NAVIGATION
Permits complete navigation:
|
static int |
ALLOW_NEXTPREV
Permits navigation between the list elements |
static int |
ALLOW_STATISTICS
Permits access to 'statistics' likethe number of objects contained in the structure |
static int |
FULL_READ_ACCESS
Full read access |
static int |
LISTVIEW_ACCESS
Constant for access to the BasicList object |
static int |
NO_ACCESS
No access at all |
static int |
SHOW_FIRST
Access to the first ListItem |
static int |
SHOW_ITEMS
Access to the ListItem s |
static int |
SHOW_KEYS
Access to the keys |
static int |
SHOW_LAST
Access to the last ListItem |
static int |
SHOW_VALUES
Access to the values |
Constructor Summary | |
ListView(BasicList L,
int accessmode)
Constructor. |
Method Summary | |
ListItem |
at(int index)
Returns the ListItem at the index index .
|
boolean |
checkAccess(int access)
Returns true, if all the rights contained within access are
permitted for this ListView object, otherwise this method returns
false. |
boolean |
contains(ListItem item)
Returns true, if the ListItem item is contained in the
list. |
boolean |
contains(java.lang.Object object)
Returns true, if the object object is contained in the list.
|
java.lang.Object[] |
convertKeysToArray()
Inserts the keys of the ListItem s into an array.
|
java.lang.Object[] |
convertValuesToArray()
Inserts the values of the ListItem s into an array.
|
ListItem |
cyclicRelative(ListItem base,
int count)
Returns the ListItem , which is count steps away from
base considering the list as cyclic list (or null ,
if base does not belong to the list). |
java.lang.Object |
cyclicRelativeValue(ListItem base,
int count)
Returns the value of the ListItem , which is count steps
away from base considering the list as cyclic list (or
null , if base does not belong to the list). |
boolean |
empty()
Returns true, if the list is empty required access: ALLOW_STATISTICS |
ListItem |
find(ListItem item)
Searches for the ListItem item and returns it, if it was
found, otherwise null is returned. |
ListItem |
find(java.lang.Object O)
Returns the ListItem containing the object O , i.e. for
which equals(O) returns true. |
ListItem |
find(java.lang.Object O,
ListItem start)
Returns the first ListItem after start containing the
object O , i.e. for which equals(O) returns true. |
ListItem |
findBigger(java.lang.Object key,
Comparitor comparitor)
Searches the list for the smallest ListItem , which is bigger than
key , using the comparitor comparitor . |
ListItem |
findBigger(java.lang.Object key,
Comparitor comparitor,
ListItem start)
Searches the list for the smallest ListItem , which is bigger than
key , using the comparitor comparitor . |
ListItem |
findClass(java.lang.Class C)
Returns the first ListItem containing an object of the class
C . |
ListItem |
findClass(java.lang.Class C,
ListItem start)
Returns the first ListItem after start containing an
object of the class C . |
ListItem |
findClass(java.lang.Class C,
ListItem start,
int i)
Returns the ith ListItem after start
containing an object of the class C . |
ListItem |
findSmaller(java.lang.Object key,
Comparitor comparitor)
Searches the list for the biggest ListItem , which is smaller than
key , using the comparitor comparitor . |
ListItem |
findSmaller(java.lang.Object key,
Comparitor comparitor,
ListItem start)
Searches the list for the biggest ListItem , which is smaller than
key , using the comparitor comparitor . |
ListItem |
first()
Returns the first ListItem of the list.
|
java.lang.Object |
firstKey()
Returns the first key stored within the list. |
java.lang.Object |
firstValue()
Returns the first value stored within the list. |
int |
getAccessMode()
Returns the access mode constant of the ListView . |
int |
getDistance(ListItem i,
ListItem j)
Returns the distance of the two ListItem s i und
j within the list. |
int |
getIndex(ListItem i)
Calculates the index of the Listitem i within the list,
counting from the first element. |
java.lang.Object |
getKeyAt(int index)
Returns the key stored in the ListItem at the index index .
|
java.lang.Object |
getValueAt(int index)
Returns the value stored in the ListItem at the index
index . |
java.lang.Object |
key(ListItem item)
Returns the key of the ListItem item . |
java.util.Enumeration |
keys()
Returns an enomerator object, that enumerates all the keys of the list elements. |
ListItem |
last()
Returns the last ListItem of the list.
|
java.lang.Object |
lastKey()
Returns the last key stored within the list. |
java.lang.Object |
lastValue()
Returns the last value stored within the list. |
int |
length()
Returns the number of elements stored within the list. |
ListItem |
max(Comparitor comparitor)
Searches for the biggest ListItem according to the order defined by
the comparitor comparitor required access: SHOW_ITEMS and SHOW_KEYS and ALLOW_FIND and ALLOW_COMPARITORS |
ListItem |
min(Comparitor comparitor)
Searches for the smallest ListItem according to the order defined by
the comparitor comparitor required access: SHOW_ITEMS and SHOW_KEYS and ALLOW_FIND and ALLOW_COMPARITORS |
ListItem |
next(ListItem i)
Returns the next ListItem after i in the list.
|
ListItem |
next(ListItem base,
int count)
Returns the ListItem , which is count
(count>0 ) steps away from base in forward
direction (or null , if base does not belong to the
list). |
BasicList |
owner()
Returns the structure shown by ListView . |
ListItem |
prev(ListItem i)
Returns the ListItem previous to i in the list.
|
ListItem |
prev(ListItem base,
int count)
Returns the ListItem , which is count steps away from
base in backward direction (or null , if
base does not belong to the list). |
ListItem |
relative(ListItem base,
int count)
Returns the ListItem , which is count steps away from
base (or null , if base does not belong
to the list). |
java.lang.Object |
relativeValue(ListItem base,
int count)
Returns the value of the ListItem , which is count steps
away from base (or null , if base does
not belong to the list). |
java.lang.String |
toString()
Overrides Object.toString() . |
java.lang.Object |
value(ListItem item)
Returns the value of the ListItem item . |
java.util.Enumeration |
values()
Returns an enomerator object, that enumerates all the values of the list elements. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int LISTVIEW_ACCESS
public static final int NO_ACCESS
public static final int FULL_READ_ACCESS
public static final int SHOW_KEYS
public static final int SHOW_VALUES
public static final int SHOW_ITEMS
ListItem
spublic static final int SHOW_FIRST
ListItem
public static final int SHOW_LAST
ListItem
public static final int ALLOW_FIND
SHOW_KEYS
etc.)public static final int ALLOW_STATISTICS
public static final int ALLOW_NEXTPREV
public static final int ALLOW_COMPARITORS
public static final int ALLOW_CONVERSIONS
public static final int ALLOW_NAVIGATION
ALLOW_NEXTPREV
| ALLOW_STATISTICS
| SHOW_FIRST
| SHOW_LAST
| SHOW_ITEMS
Constructor Detail |
public ListView(BasicList L, int accessmode)
ListView
object for the list L
with the access mode accessmode
. The list object is asked for
permission, using BasicList.requestAccess(int, java.lang.Object, java.lang.Object)
. The access type is the
constant LISTVIEW_ACCESS
. If access is not granted, a ListException
is thrown.Method Detail |
public final BasicList owner()
ListView
.BasicList
objectpublic final int getAccessMode()
ListView
.public final boolean checkAccess(int access)
access
are
permitted for this ListView
object, otherwise this method returns
false.access
- rights to be checked fortrue
, if permitted, else false
.public java.lang.String toString()
Object.toString()
.toString
in class java.lang.Object
Object.toString()
public int length()
ALLOW_STATISTICS
ListItem
spublic boolean empty()
ALLOW_STATISTICS
public ListItem first()
ListItem
of the list.
SHOW_FIRST
and SHOW_ITEMS
ListItem
of the listpublic ListItem last()
ListItem
of the list.
SHOW_LAST
and SHOW_ITEMS
ListItem
of the listpublic java.lang.Object firstKey()
ListException
is generated.
SHOW_FIRST
and SHOW_KEYS
public java.lang.Object lastKey()
ListException
is generated.
SHOW_LAST
and SHOW_KEYS
public java.lang.Object firstValue()
ListException
is generated.
SHOW_FIRST
and SHOW_VALUES
public java.lang.Object lastValue()
ListException
is generated.
SHOW_LAST
and SHOW_VALUES
public boolean contains(ListItem item)
ListItem
item
is contained in the
list. The test performs in constant runtime.
SHOW_ITEMS
and ALLOW_FIND
item
- ListItem
to be testedpublic boolean contains(java.lang.Object object)
object
is contained in the list.
SHOW_KEYS
and ALLOW_FIND
object
- to be searched forpublic int getIndex(ListItem i)
i
within the list,
counting from the first element. If i
is not contained in
the list, -1
is returned.
SHOW_ITEMS
and ALLOW_NEXTPREV
i
- ListItem
, the index of which will be calculatedpublic int getDistance(ListItem i, ListItem j)
ListItem
s i
und
j
within the list. A positive return value indicates, that
j
can be reached from i
by searching forward, a
negative value means, that j
can be reached from i
by searching backward. If i
or j
is not contained in
the list or if they are unreachable from each other for any other reason,
Integer.MAX_VALUE is returned. SHOW_ITEMS
and ALLOW_NEXTPREV
i,j
- ListItem
s, the distance of which will be calculated.public java.lang.Object key(ListItem item)
ListItem
item
. If
item
is not contained within the list a ListException
is
generated. SHOW_ITEMS
and SHOW_KEYS
and ALLOW_FIND
item
public java.lang.Object value(ListItem item)
ListItem
item
. If
item
is not contained within the list a ListException
is
generated. SHOW_ITEMS
and SHOW_KEYS
and ALLOW_FIND
item
public ListItem next(ListItem i)
ListItem
after i
in the list.
If i==null
, the first item of the list is returned.
If i
is not contained in the list, the return value is
null
. SHOW_ITEMS
and ALLOW_NEXTPREV
i
- ListItem
from the listListItem
after ipublic ListItem next(ListItem base, int count)
ListItem
, which is count
(count>0
) steps away from base
in forward
direction (or null
, if base
does not belong to the
list). If base==null
, base
is set to the first list
element. SHOW_ITEMS
and ALLOW_NEXTPREV
base
- ListItem
to start withcount
- (positive) distanceListItem
count steps in forward direction from
base
public ListItem relative(ListItem base, int count)
ListItem
, which is count
steps away from
base
(or null
, if base
does not belong
to the list). If base==null
, base
is set to the
first list element. SHOW_ITEMS
and ALLOW_NEXTPREV
base
- ListItem
to start withcount
- distanceListItem
in distance count from base
public java.lang.Object relativeValue(ListItem base, int count)
ListItem
, which is count
steps
away from base
(or null
, if base
does
not belong to the list). If base==null
, base
is set
to the first list element. SHOW_VALUES
and ALLOW_NEXTPREV
public ListItem cyclicRelative(ListItem base, int count)
ListItem
, which is count
steps away from
base
considering the list as cyclic list (or null
,
if base
does not belong to the list). If base==null
,
base
is set to the first list element. SHOW_ITEMS
and ALLOW_NEXTPREV
public java.lang.Object cyclicRelativeValue(ListItem base, int count)
ListItem
, which is count
steps
away from base
considering the list as cyclic list (or
null
, if base
does not belong to the list). If
base==null
, base
is set to the first list element.
SHOW_VALUES
and ALLOW_NEXTPREV
public ListItem prev(ListItem base, int count)
ListItem
, which is count
steps away from
base
in backward direction (or null
, if
base
does not belong to the list). If base==null
,
base
is set to the last list element. SHOW_ITEMS
and ALLOW_NEXTPREV
base
- ListItem
to start withcount
- (positive) distanceListItem
count steps in backward direction from
base
public ListItem prev(ListItem i)
ListItem
previous to i
in the list.
If i==null
, the last item of the list is returned.
If i
is not contained in the list, the return value is
null
. SHOW_ITEMS
and ALLOW_NEXTPREV
i
- ListItem
from the listListItem
previous to ipublic ListItem at(int index)
ListItem
at the index index
.
SHOW_ITEMS
and ALLOW_NEXTPREV
index
- indexListItem
at index index
public java.lang.Object getValueAt(int index)
ListItem
at the index
index
. SHOW_VALUES
and
ALLOW_NEXTPREV
index
- indexListItem
at index index
public java.lang.Object getKeyAt(int index)
ListItem
at the index index
.
SHOW_KEYS
and ALLOW_NEXTPREV
index
- indexListItem
at index index
public ListItem find(ListItem item)
ListItem
item
and returns it, if it was
found, otherwise null
is returned. The search runs in constant
time. Sucht das ListItem
item in der Liste und liefert es zurück,
falls es SHOW_ITEMS
and ALLOW_FIND
item
- ListItem
to be searched fornull
public ListItem find(java.lang.Object O)
ListItem
containing the object O
, i.e. for
which equals(O)
returns true. The search runs in linear time.
SHOW_ITEMS
and SHOW_KEYS
and
ALLOW_FIND
O
- object to be searched forListItem
or null
public ListItem find(java.lang.Object O, ListItem start)
ListItem
after start
containing the
object O
, i.e. for which equals(O)
returns true. If
srart==null
, the search begins with the first list element. The
search runs in linear time.
SHOW_ITEMS
and SHOW_KEYS
and
ALLOW_FIND
O
- object to be searched forstart
- ListItem
the search begins with.ListItem
or null
public ListItem findClass(java.lang.Class C)
ListItem
containing an object of the class
C
. The search runs in linear time.
SHOW_ITEMS
and SHOW_KEYS
and
ALLOW_FIND
C
- object class to be searched forListItem
or null
public ListItem findClass(java.lang.Class C, ListItem start)
ListItem
after start
containing an
object of the class C
. If srart==null
, the search
begins with the first list element. The search runs in linear time.
SHOW_ITEMS
and SHOW_KEYS
and
ALLOW_FIND
C
- object class to be searched forstart
- ListItem
the search begins with.ListItem
or null
public ListItem findClass(java.lang.Class C, ListItem start, int i)
ith
ListItem
after start
containing an object of the class C
. If srart==null
,
the search begins with the first list element. The search runs in linear time.
SHOW_ITEMS
and SHOW_KEYS
and
ALLOW_FIND
C
- object class to be searched forstart
- ListItem
the search begins with.i
- number of occurencesListItem
or null
public ListItem findBigger(java.lang.Object key, Comparitor comparitor)
ListItem
, which is bigger than
key
, using the comparitor comparitor
. If
key
is a ListItem
the ListItem
s are compared
directly, otherwise the keys are compared. key==null
,
this method is equivalent to max(gishur.core.Comparitor)
(comparitor). comparitor==null
, a default comparitor is used.
SHOW_ITEMS
and SHOW_KEYS
and
ALLOW_FIND
and ALLOW_COMPARITORS
key
- object to be compared tocomparitor
- comparitor objectListItem
, which is bigger than (or equal)
key
Comparitor
public ListItem findBigger(java.lang.Object key, Comparitor comparitor, ListItem start)
ListItem
, which is bigger than
key
, using the comparitor comparitor
. The search
begins with start
.
SHOW_ITEMS
and SHOW_KEYS
and
ALLOW_FIND
and ALLOW_COMPARITORS
key
- object to be compared tocomparitor
- comparitor objectListItem
after start
, which is bigger
than (or equal) key
findBigger(Object, Comparitor)
public ListItem findSmaller(java.lang.Object key, Comparitor comparitor)
ListItem
, which is smaller than
key
, using the comparitor comparitor
. If
key
is a ListItem
the ListItem
s are compared
directly, otherwise the keys are compared. key==null
,
this method is equivalent to min(gishur.core.Comparitor)
(comparitor). comparitor==null
, a default comparitor is used.
SHOW_ITEMS
and SHOW_KEYS
and
ALLOW_FIND
and ALLOW_COMPARITORS
key
- object to be compared tocomparitor
- comparitor objectListItem
, which is smaller than (or equal)
key
Comparitor
public ListItem findSmaller(java.lang.Object key, Comparitor comparitor, ListItem start)
ListItem
, which is smaller than
key
, using the comparitor comparitor
. The search
begins with start
.
SHOW_ITEMS
and SHOW_KEYS
and
ALLOW_FIND
and ALLOW_COMPARITORS
key
- object to be compared tocomparitor
- comparitor objectListItem
after start
, which is smaller
than (or equal) key
findSmaller(Object, Comparitor)
public ListItem min(Comparitor comparitor)
ListItem
according to the order defined by
the comparitor comparitor
SHOW_ITEMS
and SHOW_KEYS
and ALLOW_FIND
and ALLOW_COMPARITORS
comparitor
- comparitor objectListItem
in the listpublic ListItem max(Comparitor comparitor)
ListItem
according to the order defined by
the comparitor comparitor
SHOW_ITEMS
and SHOW_KEYS
and ALLOW_FIND
and ALLOW_COMPARITORS
comparitor
- comparitor objectListItem
in the listpublic java.lang.Object[] convertKeysToArray()
ListItem
s into an array.
If SimpleList was created with the default insert methods, then
convertKeysToArray
and convertValuesToArray
both
return the same array. SHOW_KEYS
and
ALLOW_CONVERSIONS
convertValuesToArray()
public java.lang.Object[] convertValuesToArray()
ListItem
s into an array.
If SimpleList was created with the default insert methods, then
convertKeysToArray
and convertValuesToArray
both
return the same array. SHOW_VALUES
and
ALLOW_CONVERSIONS
convertKeysToArray()
public java.util.Enumeration keys()
keys()
and values()
both return the same enumeration object.
SHOW_KEYS
and ALLOW_CONVERSIONS
values()
public java.util.Enumeration values()
keys()
and values()
both return the same enumeration object.
SHOW_VALUES
and ALLOW_CONVERSIONS
keys()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |