org.rosuda.JRclient
Class RList

java.lang.Object
  extended byorg.rosuda.JRclient.RList

public class RList
extends Object

implementation of R-lists
This is rather preliminary and may change in future since it's not really proper. The point is that the parser tries to interpret lists to be of the form entry=value, where entry is stored in the "head" part, and value is stored in the "body" part. Then using at(String) it is possible to fetch "body" for a specific "head". The terminology used is partly from hash fields - "keys" are the elements in "head" and values are in "body" (see keys()).

On the other hand, R uses lists to store complex internal structures, which are not parsed according to the structure - in that case "head" and "body" have to be evaluated separately according to their meaning in that context.

Version:
$Id: RList.java,v 1.1 2005/10/05 20:20:16 eytanadar Exp $

Field Summary
 REXP body
          xpressions containing head and body.
 REXP head
          xpressions containing head and body.
 REXP tag
          xpressions containing head and body.
 
Constructor Summary
RList()
          constructs an empty list
RList(REXP h, REXP b)
          constructs an initialized list
 
Method Summary
 REXP at(int i)
          get element at the specified position
 REXP at(String v)
          get xpression given a key
 REXP getBody()
          get body xpression (CDR)
 REXP getHead()
          get head xpression (CAR)
 REXP getTag()
          get tag xpression
 String[] keys()
          returns all keys of the list
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

head

public REXP head
xpressions containing head and body. The terminology is a bit misleading - head corresponds to CAR, body to CDR and finally tag is TAG.


body

public REXP body
xpressions containing head and body. The terminology is a bit misleading - head corresponds to CAR, body to CDR and finally tag is TAG.


tag

public REXP tag
xpressions containing head and body. The terminology is a bit misleading - head corresponds to CAR, body to CDR and finally tag is TAG.

Constructor Detail

RList

public RList()
constructs an empty list


RList

public RList(REXP h,
             REXP b)
constructs an initialized list

Parameters:
h - head xpression
b - body xpression
Method Detail

getHead

public REXP getHead()
get head xpression (CAR)

Returns:
head xpression

getBody

public REXP getBody()
get body xpression (CDR)

Returns:
body xpression

getTag

public REXP getTag()
get tag xpression

Returns:
tag xpression

at

public REXP at(String v)
get xpression given a key

Parameters:
v - key
Returns:
xpression which corresponds to the given key or null if list is not standartized or key not found

at

public REXP at(int i)
get element at the specified position

Parameters:
i - index
Returns:
xpression at the index or null if list is not standartized or if index out of bounds

keys

public String[] keys()
returns all keys of the list

Returns:
array containing all keys or null if list is not standartized