|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.millscript.commons.util.list.AbstractIList<V>
public abstract class AbstractIList<V>
| Nested Class Summary | |
|---|---|
static class |
AbstractIList.ListMapletIterator<V>
This class implements an iterator over the maplets in another map. |
static class |
AbstractIList.ListMapletList<V>
|
| Constructor Summary | |
|---|---|
protected |
AbstractIList()
Constructs a new abstract immutable list with a ListDefault
as it's default. |
protected |
AbstractIList(IListDefault<V> def)
Constructs a new abstract immutable list with the specified default action. |
| Method Summary | |
|---|---|
IList<V> |
allButFirst(int num,
boolean share)
Returns a list containing all but the first num elements
held in this list. |
IList<V> |
allButLast(int num,
boolean share)
Returns a list containing all but the last num elements
held in this list. |
IList<V> |
allFirst(int num,
boolean share)
Returns a list containing the first num elements held in
this list. |
IList<V> |
allLast(int num,
boolean share)
Returns a list containing the last num elements held in
this list. |
boolean |
contains(java.lang.Integer key,
V value)
Returns true if this list contains the specified value at
the specified position(one based) in the list. |
boolean |
contains(int key,
V value)
Returns true if this list contains the specified value at
the specified position(one based) in the list. |
boolean |
contains(Maplet<? extends java.lang.Integer,? extends V> entry)
Returns true if this map contains the specified maplet. |
boolean |
contains0(java.lang.Integer key,
V value)
Returns true if this list contains the specified value at
the specified position(zero based) in the list. |
boolean |
contains0(int key,
V value)
Returns true if this list contains the specified value at
the specified position(zero based) in the list. |
boolean |
contains0(Maplet<? extends java.lang.Integer,? extends V> entry)
Returns true if this list contains the specified maplet. |
boolean |
containsAll(IMap<? extends java.lang.Integer,? extends V> map)
Returns true if this map contains all the mappings in the
specified map. |
boolean |
containsKey(int pos)
Returns true if the specified position(one based) is valid
in this list. |
boolean |
containsKey(java.lang.Integer pos)
Returns true if the specified position(one based) is valid
in this list. |
boolean |
containsKey0(int pos)
Returns true if the specified position(zero based) is valid
in this list. |
boolean |
containsKey0(java.lang.Integer pos)
Returns true if the specified position(zero based) is valid
in this list. |
boolean |
containsSlice(int first,
int last)
Returns true if the specified slice is within the bounds
of the list. |
boolean |
containsSlice0(int first,
int last)
Returns true if the specified slice is within the bounds
of the list. |
boolean |
containsValue(V value)
Returns true if this map contains an entry with the
specified value. |
org.millscript.commons.alert.Alert |
decorate(org.millscript.commons.alert.Alert alert)
|
protected abstract V |
doGet(int pos)
Returns the value at the specified position(one based) in the list. |
protected abstract IList<V> |
doSlice(int first,
int last,
boolean share)
Returns a list containing a slice of the elements in this list, starting at first(one based, inclusive) and continuing
last(one based, inclusive). |
boolean |
equals(java.lang.Object obj)
Compares this map with the specified object for equality. |
V |
first()
Returns the first item from this list. |
V |
get(int pos)
Returns the element at the specified position(one based) in this list. |
V |
get(java.lang.Integer pos)
Returns the element at the specified position(one based) in this list. |
V |
get0(int pos)
Returns the element at the specified position(zero based) in this list. |
V |
get0(java.lang.Integer pos)
Returns the element at the specified position(zero based) in this list. |
IListDefault<V> |
getDefault()
Returns the default used by the IMap.get(Object) method when there
is no mapping for a given key. |
int |
hashCode()
Returns the integer hash code for this map. |
int |
indexOf0(V value)
Returns the index(zero based) of the first occurance of the specified object in this list. |
boolean |
isEmtpy()
Returns true if this map has no mappings. |
IList<java.lang.Integer> |
keyList(boolean share)
Returns a List of the keys in this map. |
V |
last()
Returns the last item from this list. |
IList<Maplet<java.lang.Integer,V>> |
mapletList(boolean share)
Returns a List of the maplets in this map. |
void |
setDefault(IListDefault<V> def)
Sets the default for this list. |
void |
setDefault(IMapDefault<java.lang.Integer,V> def)
Sets the default for this map. |
protected IList<Maplet<java.lang.Integer,V>> |
sharedMapletList()
|
protected IList<V> |
sharedValueList()
|
IList<V> |
slice(int first,
int last,
boolean share)
Returns a list containing a slice of the elements in this list, starting at first(one based, inclusive) and continuing
last(one based, inclusive). |
IList<V> |
slice0(int first,
int last,
boolean share)
Returns a list containing a slice of the elements in this list, starting at first(zero based, inclusive) and continuing
last(zero based, inclusive). |
java.lang.Object[] |
toArray()
Returns an array containing all the elements of this list. |
V[] |
toArray(V[] target)
Attempts to store the contents of this list inside the specified array. |
java.lang.String |
toString()
|
IList<V> |
valueList(boolean share)
Returns a List of the values in this map. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.millscript.commons.util.IList |
|---|
indexOf, iterator |
| Methods inherited from interface org.millscript.commons.util.IMap |
|---|
size |
| Constructor Detail |
|---|
protected AbstractIList()
ListDefault
as it's default.
protected AbstractIList(IListDefault<V> def)
def - the default action for this map| Method Detail |
|---|
public IList<V> allButFirst(int num,
boolean share)
IListnum elements
held in this list.
allButFirst in interface IList<V>num - the number of elements to skip from the begining of this
listshare - if true this instances backing store should be
shared with the returned list, otherwise any backing store will be copied.
num elements
held in this listIList.allButFirst(int, boolean)
public IList<V> allButLast(int num,
boolean share)
IListnum elements
held in this list.
allButLast in interface IList<V>num - the number of elements to skip from the end of this listshare - if true this instances backing store should be
shared with the returned list, otherwise any backing store will be copied.
num elements
held in this listIList.allButLast(int, boolean)
public IList<V> allFirst(int num,
boolean share)
IListnum elements held in
this list.
allFirst in interface IList<V>num - the number of elements to slice from the start of this listshare - if true this instances backing store should be
shared with the returned list, otherwise any backing store will be copied.
num elements held in
this listIList.allFirst(int, boolean)
public IList<V> allLast(int num,
boolean share)
IListnum elements held in
this list.
allLast in interface IList<V>num - the number of elements to slice from the end of this listshare - if true this instances backing store should be
shared with the returned list, otherwise any backing store will be copied.
num elements held in
this listIList.allLast(int, boolean)
public boolean contains(int key,
V value)
IListtrue if this list contains the specified value at
the specified position(one based) in the list.
contains in interface IList<V>key - the index(one based) of the object whose presence to testvalue - the value which must match that stored at the specified
position(one based) in the list
true if this list contains the specified value at
the specified position(one based)IList.contains(int, java.lang.Object)
public boolean contains(java.lang.Integer key,
V value)
IListtrue if this list contains the specified value at
the specified position(one based) in the list.
contains in interface IList<V>contains in interface IMap<java.lang.Integer,V>key - the index(one based) of the object whose presence to testvalue - the value which must match that stored at the specified
position(one based) in the list
true if this list contains the specified value at
the specified position(one based)IList.contains(java.lang.Integer, java.lang.Object)public boolean contains(Maplet<? extends java.lang.Integer,? extends V> entry)
IMaptrue if this map contains the specified maplet.
contains in interface IMap<java.lang.Integer,V>entry - the maplet whose presence to test
true if this map contains the specified mapletIMap.contains(org.millscript.commons.util.Maplet)
public boolean contains0(int key,
V value)
IListtrue if this list contains the specified value at
the specified position(zero based) in the list.
contains0 in interface IList<V>key - the index(zero based) of the object whose presence to testvalue - the value which must match that stored at the specified
position(zero based) in the list
true if this list contains the specified value at
the specified position(zero based)IList.contains0(int, java.lang.Object)
public boolean contains0(java.lang.Integer key,
V value)
IListtrue if this list contains the specified value at
the specified position(zero based) in the list.
contains0 in interface IList<V>key - the index(zero based) of the object whose presence to testvalue - the value which must match that stored at the specified
position(zero based) in the list
true if this list contains the specified value at
the specified position(zero based)IList.contains0(java.lang.Integer, java.lang.Object)public boolean contains0(Maplet<? extends java.lang.Integer,? extends V> entry)
IListtrue if this list contains the specified maplet.
The maplet key is the position(zero based) in the list and the maplet
value is the value at the specified position(zero based).
contains0 in interface IList<V>entry - the maplet whose presence to test
true if this list contains the specified mapletIList.contains0(org.millscript.commons.util.Maplet)public boolean containsAll(IMap<? extends java.lang.Integer,? extends V> map)
IMaptrue if this map contains all the mappings in the
specified map.
containsAll in interface IMap<java.lang.Integer,V>true if this map contains the specified mapletIMap.containsAll(org.millscript.commons.util.IMap)public boolean containsKey(int pos)
IListtrue if the specified position(one based) is valid
in this list. The position would be valid if it is suchthat
1 <= pos <= size().
containsKey in interface IList<V>true if the specified position(one based) is valid
in this listIList.containsKey(int)public boolean containsKey(java.lang.Integer pos)
IListtrue if the specified position(one based) is valid
in this list. The position would be valid if it is suchthat
1 <= pos <= size().
containsKey in interface IList<V>containsKey in interface IMap<java.lang.Integer,V>pos - the key whose presence to test
true if the specified position(one based) is valid
in this listIList.containsKey(java.lang.Integer)public boolean containsKey0(int pos)
IListtrue if the specified position(zero based) is valid
in this list. The position would be valid if it is suchthat
0 <= pos < size().
containsKey0 in interface IList<V>true if the specified position(zero based) is valid
in this listIList.containsKey0(int)public boolean containsKey0(java.lang.Integer pos)
IListtrue if the specified position(zero based) is valid
in this list. The position would be valid if it is suchthat
0 <= pos < size().
containsKey0 in interface IList<V>true if the specified position(zero based) is valid
in this listIList.containsKey0(java.lang.Integer)
public boolean containsSlice(int first,
int last)
IListtrue if the specified slice is within the bounds
of the list.
containsSlice in interface IList<V>first - the index(one based) of the first element in the slicelast - the index(one based) of the last element in the slice
true if the specified slice indicies are within
the bounds of this list and false otherwiseIList.containsSlice(int, int)
public boolean containsSlice0(int first,
int last)
IListtrue if the specified slice is within the bounds
of the list.
containsSlice0 in interface IList<V>first - the index(one based) of the first element in the slicelast - the index(one based) of the last element in the slice
true if the specified slice indicies are within
the bounds of this list and false otherwiseIList.containsSlice0(int, int)public boolean containsValue(V value)
IMaptrue if this map contains an entry with the
specified value.
containsValue in interface IMap<java.lang.Integer,V>value - the value whose presence to test
true if this map contains a mapping with the
specified valueIMap.containsValue(java.lang.Object)public org.millscript.commons.alert.Alert decorate(org.millscript.commons.alert.Alert alert)
AlertDecorator.decorate(org.millscript.commons.alert.Alert)protected abstract V doGet(int pos)
get(int) method after the index
has been validated. Hence this method should generally not need to
perform any further validation.
pos - the index(one based) of the value to return
protected abstract IList<V> doSlice(int first,
int last,
boolean share)
first(one based, inclusive) and continuing
last(one based, inclusive). This method is called by the
generic #slice(int, int) method after the indices have been
validated. Hence, this method assumes that the specified indices are
within the bounds of the list and that the first index is less than or
equal to the last index. The case where the first index is greater than
the last is handled elsewhere.
first - the index(one based) of the first element in the slicelast - the index(one based) of the last element in the sliceshare - if true the specified object array will be
shared otherwise the array will be copied.
public boolean equals(java.lang.Object obj)
IMap
equals in interface IMap<java.lang.Integer,V>equals in class java.lang.Objectobj - the object to compare with this map for equality
true if this map and the specified object are
equal and false otherwiseIMap.equals(Object)public V first()
IList
first in interface IList<V>IList.first()public V get(int pos)
IList
get in interface IList<V>pos - index of the element to return(one based)
IList.get(int)public V get(java.lang.Integer pos)
IList
get in interface IList<V>get in interface IMap<java.lang.Integer,V>pos - index of the element to return(one based)
IList.get(java.lang.Integer)public V get0(int pos)
IList
get0 in interface IList<V>pos - index of the element to return(zero based)
IList.get0(int)public V get0(java.lang.Integer pos)
IList
get0 in interface IList<V>pos - index of the element to return(zero based)
IList.get0(java.lang.Integer)public IListDefault<V> getDefault()
IMapIMap.get(Object) method when there
is no mapping for a given key.
getDefault in interface IList<V>getDefault in interface IMap<java.lang.Integer,V>IMap.getDefault()public int hashCode()
IMap
We require a simple sum of Maplet hash codes as different
IMap implementations may have different iteration orders. As a
result the hash code method must return the same hash code regardless of
iteration order.
hashCode in interface IMap<java.lang.Integer,V>hashCode in class java.lang.ObjectIMap.hashCode()public int indexOf0(V value)
IList
indexOf0 in interface IList<V>value - the value to find
IList.indexOf0(java.lang.Object)public boolean isEmtpy()
IMaptrue if this map has no mappings.
isEmtpy in interface IMap<java.lang.Integer,V>true if this map contains no mappingsIMap.isEmtpy()public IList<java.lang.Integer> keyList(boolean share)
IMap
keyList in interface IMap<java.lang.Integer,V>share - if true this instances backing store should be
shared with the returned list, otherwise any backing store will be copied.
IMap.keyList(boolean)public V last()
IList
last in interface IList<V>IList.last()public IList<Maplet<java.lang.Integer,V>> mapletList(boolean share)
IMap
mapletList in interface IMap<java.lang.Integer,V>share - if true this instances backing store should be
shared with the returned list, otherwise any backing store will be copied.
IMap.mapletList(boolean)public void setDefault(IListDefault<V> def)
setDefault in interface IList<V>def - the new defaultIMap.setDefault(org.millscript.commons.util.IMapDefault)public void setDefault(IMapDefault<java.lang.Integer,V> def)
IMap
setDefault in interface IMap<java.lang.Integer,V>def - the new defaultIMap.setDefault(org.millscript.commons.util.IMapDefault)protected IList<Maplet<java.lang.Integer,V>> sharedMapletList()
protected IList<V> sharedValueList()
public IList<V> slice(int first,
int last,
boolean share)
IListfirst(one based, inclusive) and continuing
last(one based, inclusive).
slice in interface IList<V>first - the index(one based) of the first element in the slicelast - the index(one based) of the last element in the sliceshare - if true this instances backing store should be
shared with the returned list, otherwise any backing store will be copied.
IList.slice(int, int, boolean)
public IList<V> slice0(int first,
int last,
boolean share)
IListfirst(zero based, inclusive) and continuing
last(zero based, inclusive).
slice0 in interface IList<V>first - the index(zero based) of the first element in the slicelast - the index(zero based) of the last element in the sliceshare - if true this instances backing store should be
shared with the returned list, otherwise any backing store will be copied.
IList.slice0(int, int, boolean)public java.lang.Object[] toArray()
IList
toArray in interface IList<V>IList.toArray()public V[] toArray(V[] target)
IList
toArray in interface IList<V>target - the array to fill with the elements in this list
org.millscript.commons.util.IList#toArray(null[])public java.lang.String toString()
toString in class java.lang.ObjectObject.toString()public IList<V> valueList(boolean share)
IMap
valueList in interface IMap<java.lang.Integer,V>share - if true this instances backing store should be
shared with the returned list, otherwise any backing store will be copied.
IMap.valueList(boolean)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||