File: REXPNull.java

package info (click to toggle)
rjava 1.0-6-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 5,208 kB
  • sloc: javascript: 16,048; java: 13,116; ansic: 5,330; sh: 3,776; xml: 325; makefile: 250; perl: 33
file content (15 lines) | stat: -rw-r--r-- 992 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package org.rosuda.REngine;

/** represents a NULL object in R.
 <p>
 Note: there is a slight asymmetry - in R NULL is represented by a zero-length pairlist. For this reason <code>REXPNull</code> returns <code>true</code> for {@link #isList()} and {@link #asList()} will return an empty list. Nonetheless <code>REXPList</code> of the length 0 will NOT return <code>true</code> in {@link #isNull()} (currently), becasue it is considered a different object in Java. These nuances are still subject to change, because it's not clear how it should be treated. At any rate use <code>REXPNull</code> instead of empty <code>REXPList</code> if NULL is the intended value.
 */
public class REXPNull extends REXP {
	public REXPNull() { super(); }
	public REXPNull(REXPList attr) { super(attr); }
	
	public boolean isNull() { return true; }
	public boolean isList() { return true; } // NULL is a list
	public RList asList() { return new RList(); }
	public Object asNativeJavaObject() { return null; }
}