|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractCollection<E> java.util.AbstractList<E> java.util.Vector org.rosuda.REngine.RList
public class RList
implementation of R-lists
All lists (dotted-pair lists, language lists, expressions and vectors) are regarded as named generic vectors.
Note: This implementation has changed radically in Rserve 0.5!
This class inofficially implements the Map interface. Unfortunately a conflict in the Java iterface classes Map and List doesn't allow us to implement both officially. Most prominently the Map 'remove' method had to be renamed to removeByKey.
Field Summary | |
---|---|
java.util.Vector |
names
|
Fields inherited from class java.util.Vector |
---|
capacityIncrement, elementCount, elementData |
Fields inherited from class java.util.AbstractList |
---|
modCount |
Constructor Summary | |
---|---|
RList()
constructs an empty list |
|
RList(java.util.Collection contents)
constructs an initialized, unnamed list |
|
RList(java.util.Collection contents,
java.util.Collection names)
constructs an initialized, named list. |
|
RList(java.util.Collection contents,
java.lang.String[] names)
constructs an initialized, named list. |
|
RList(int initSize,
boolean hasNames)
|
|
RList(REXP[] contents)
constructs an initialized, unnamed list |
|
RList(REXP[] contents,
java.lang.String[] names)
constructs an initialized, named list. |
Method Summary | |
---|---|
void |
add(int index,
java.lang.Object element)
|
boolean |
add(java.lang.Object element)
|
boolean |
addAll(java.util.Collection c)
|
boolean |
addAll(int index,
java.util.Collection c)
|
void |
addElement(java.lang.Object obj)
|
REXP |
at(int i)
get element at the specified position |
REXP |
at(java.lang.String v)
get xpression given a key |
void |
clear()
|
java.lang.Object |
clone()
|
boolean |
containsKey(java.lang.Object key)
|
boolean |
containsValue(java.lang.Object value)
|
java.util.Set |
entrySet()
NOTE: THIS IS UNIMPLEMENTED and always returns null ! |
java.lang.Object |
get(java.lang.Object key)
|
void |
insertElementAt(java.lang.Object obj,
int index)
|
boolean |
isNamed()
checks whether this list is named or unnamed |
java.lang.String |
keyAt(int i)
return the key (name) at a given index |
java.lang.String[] |
keys()
returns all keys of the list |
java.util.Set |
keySet()
Note: sinde RList is not really a Map, the returned set is only an approximation as it cannot reference duplicate or null names that may exist in the list |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
|
void |
putAll(java.util.Map t)
|
void |
putAll(RList t)
|
java.lang.Object |
remove(int index)
|
boolean |
remove(java.lang.Object elem)
|
boolean |
removeAll(java.util.Collection c)
|
void |
removeAllElements()
|
java.lang.Object |
removeByKey(java.lang.Object key)
|
boolean |
removeElement(java.lang.Object obj)
|
void |
removeElementAt(int index)
|
boolean |
retainAll(java.util.Collection c)
|
void |
setKeyAt(int i,
java.lang.String value)
set key at the given index. |
java.lang.String |
toString()
|
java.util.Collection |
values()
|
Methods inherited from class java.util.Vector |
---|
capacity, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, isEmpty, lastElement, lastIndexOf, lastIndexOf, removeRange, set, setElementAt, setSize, size, subList, toArray, toArray, trimToSize |
Methods inherited from class java.util.AbstractList |
---|
iterator, listIterator, listIterator |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.List |
---|
contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, set, size, subList, toArray, toArray |
Field Detail |
---|
public java.util.Vector names
Constructor Detail |
---|
public RList()
public RList(REXP[] contents)
contents
- - an array of REXP
s to use as contents of this listpublic RList(int initSize, boolean hasNames)
public RList(java.util.Collection contents)
contents
- - a Collection
of REXP
s to use as contents of this listpublic RList(REXP[] contents, java.lang.String[] names)
contents
- - an array of REXP
s to use as contents of this listnames
- - an array of String
s to use as namespublic RList(java.util.Collection contents, java.lang.String[] names)
contents
- - a Collection
of REXP
s to use as contents of this listnames
- - an array of String
s to use as namespublic RList(java.util.Collection contents, java.util.Collection names)
contents
- - a Collection
of REXP
s to use as contents of this listnames
- - an Collection
of String
s to use as namesMethod Detail |
---|
public boolean isNamed()
true
if this list is named, false
otherwisepublic REXP at(java.lang.String v)
v
- key
null
if the list is unnamed or key not foundpublic REXP at(int i)
i
- index
null
if the index is out of boundspublic java.lang.String keyAt(int i)
i
- index
null
is the list is unnamed or the index is out of rangepublic void setKeyAt(int i, java.lang.String value)
null
. Out of range operations are undefined (currently no-ops)
i
- indexvalue
- key namepublic java.lang.String[] keys()
null
if list unnamedpublic void add(int index, java.lang.Object element)
add
in interface java.util.List
add
in class java.util.Vector
public boolean add(java.lang.Object element)
add
in interface java.util.Collection
add
in interface java.util.List
add
in class java.util.Vector
public boolean addAll(java.util.Collection c)
addAll
in interface java.util.Collection
addAll
in interface java.util.List
addAll
in class java.util.Vector
public boolean addAll(int index, java.util.Collection c)
addAll
in interface java.util.List
addAll
in class java.util.Vector
public void clear()
clear
in interface java.util.Collection
clear
in interface java.util.List
clear
in class java.util.Vector
public java.lang.Object clone()
clone
in class java.util.Vector
public java.lang.Object remove(int index)
remove
in interface java.util.List
remove
in class java.util.Vector
public boolean remove(java.lang.Object elem)
remove
in interface java.util.Collection
remove
in interface java.util.List
remove
in class java.util.Vector
public boolean removeAll(java.util.Collection c)
removeAll
in interface java.util.Collection
removeAll
in interface java.util.List
removeAll
in class java.util.Vector
public boolean retainAll(java.util.Collection c)
retainAll
in interface java.util.Collection
retainAll
in interface java.util.List
retainAll
in class java.util.Vector
public void removeAllElements()
removeAllElements
in class java.util.Vector
public void insertElementAt(java.lang.Object obj, int index)
insertElementAt
in class java.util.Vector
public void addElement(java.lang.Object obj)
addElement
in class java.util.Vector
public void removeElementAt(int index)
removeElementAt
in class java.util.Vector
public boolean removeElement(java.lang.Object obj)
removeElement
in class java.util.Vector
public boolean containsKey(java.lang.Object key)
public boolean containsValue(java.lang.Object value)
public java.util.Set entrySet()
null
! Due to the fact that R lists are not proper maps we canot maintain a set-view of the list
public java.lang.Object get(java.lang.Object key)
public java.util.Set keySet()
public java.lang.Object put(java.lang.Object key, java.lang.Object value)
public void putAll(java.util.Map t)
public void putAll(RList t)
public java.lang.Object removeByKey(java.lang.Object key)
public java.util.Collection values()
public java.lang.String toString()
toString
in class java.util.Vector
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |