/** set key at the given index. Using this method automatically makes the list a named one even if the key is <code>null</code>. Out of range operations are undefined (currently no-ops) @param i index @param value key name */ public void setKeyAt(int i, String value) { if (i < 0) return; if (names==null) names = new Vector(); if (names.size() < size()) names.setSize(size()); if (i < size()) names.set(i, value); }
/** set key at the given index. Using this method automatically makes the list a named one even if the key is <code>null</code>. Out of range operations are undefined (currently no-ops) @param i index @param value key name */ public void setKeyAt(int i, String value) { if (i < 0) return; if (names==null) names = new Vector(); if (names.size() < size()) names.setSize(size()); if (i < size()) names.set(i, value); }
public Object remove(int index) { Object o = super.remove(index); if (names != null) { names.remove(index); if (size()==0) names=null; } return o; }
public Object remove(int index) { Object o = super.remove(index); if (names != null) { names.remove(index); if (size()==0) names=null; } return o; }
public boolean addAll(Collection c) { boolean ch = super.addAll(c); if (names==null) return ch; int l = size(); while (names.size()<l) names.add(null); return ch; }
/** constructs an initialized, named list. The length of the contents vector determines the length of the list. * @param contents - an array of {@link REXP}s to use as contents of this list * @param names - an array of {@link String}s to use as names */ public RList(REXP[] contents, String[] names) { this(contents); if (names!=null && names.length>0) { this.names=new Vector(names.length); int i = 0; while (i < names.length) this.names.add(names[i++]); while (this.names.size()<size()) this.names.add(null); } }
/** constructs an initialized, named list. The size of the contents collection determines the length of the list. * @param contents - a {@link Collection} of {@link REXP}s to use as contents of this list * @param names - an {@link Collection} of {@link String}s to use as names */ public RList(Collection contents, Collection names) { this(contents); if (names!=null && names.size()>0) { this.names=new Vector(names); while (this.names.size()<size()) this.names.add(null); } }
public boolean addAll(Collection c) { boolean ch = super.addAll(c); if (names==null) return ch; int l = size(); while (names.size()<l) names.add(null); return ch; }
/** constructs an initialized, named list. The length of the contents vector determines the length of the list. * @param contents - an array of {@link REXP}s to use as contents of this list * @param names - an array of {@link String}s to use as names */ public RList(REXP[] contents, String[] names) { this(contents); if (names!=null && names.length>0) { this.names=new Vector(names.length); int i = 0; while (i < names.length) this.names.add(names[i++]); while (this.names.size()<size()) this.names.add(null); } }
/** constructs an initialized, named list. The size of the contents collection determines the length of the list. * @param contents - a {@link Collection} of {@link REXP}s to use as contents of this list * @param names - an array of {@link String}s to use as names */ public RList(Collection contents, String[] names) { this(contents); if (names!=null && names.length>0) { this.names=new Vector(names.length); int i = 0; while (i < names.length) this.names.add(names[i++]); while (this.names.size()<size()) this.names.add(null); } }
/** constructs an initialized, named list. The size of the contents collection determines the length of the list. * @param contents - a {@link Collection} of {@link REXP}s to use as contents of this list * @param names - an {@link Collection} of {@link String}s to use as names */ public RList(Collection contents, Collection names) { this(contents); if (names!=null && names.size()>0) { this.names=new Vector(names); while (this.names.size()<size()) this.names.add(null); } }
/** constructs an initialized, named list. The size of the contents collection determines the length of the list. * @param contents - a {@link Collection} of {@link REXP}s to use as contents of this list * @param names - an array of {@link String}s to use as names */ public RList(Collection contents, String[] names) { this(contents); if (names!=null && names.length>0) { this.names=new Vector(names.length); int i = 0; while (i < names.length) this.names.add(names[i++]); while (this.names.size()<size()) this.names.add(null); } }
/** get element at the specified position @param i index @return value at the index or <code>null</code> if the index is out of bounds */ public REXP at(int i) { return (i>=0 && i<size())?(REXP)elementAt(i):null; }
/** get element at the specified position @param i index @return value at the index or <code>null</code> if the index is out of bounds */ public REXP at(int i) { return (i>=0 && i<size())?(REXP)elementAt(i):null; }
public String toDebugString() { StringBuffer sb = new StringBuffer(super.toDebugString()+"{"); int i = 0; while (i < payload.size() && i < maxDebugItems) { if (i>0) sb.append(",\n"); sb.append(payload.at(i).toDebugString()); i++; } if (i < payload.size()) sb.append(",.."); return sb.toString()+"}"; } }
public String toDebugString() { StringBuffer sb = new StringBuffer(super.toDebugString()+"{"); int i = 0; while (i < payload.size() && i < maxDebugItems) { if (i>0) sb.append(",\n"); sb.append(payload.at(i).toDebugString()); i++; } if (i < payload.size()) sb.append(",.."); return sb.toString()+"}"; } }
public boolean remove(Object elem) { int i = indexOf(elem); if (i<0) return false; remove(i); if (size()==0) names=null; return true; }
public boolean remove(Object elem) { int i = indexOf(elem); if (i<0) return false; remove(i); if (size()==0) names=null; return true; }
public String toString() { return "RList"+super.toString()+"{"+(isNamed()?"named,":"")+size()+"}"; } }
public String toString() { return "RList"+super.toString()+"{"+(isNamed()?"named,":"")+size()+"}"; } }