1 package org.rosuda.REngine;
3 /** represents a NULL object in R.
5 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.
7 public class REXPNull extends REXP {
8 public REXPNull() { super(); }
9 public REXPNull(REXPList attr) { super(attr); }
11 public boolean isNull() { return true; }
12 public boolean isList() { return true; } // NULL is a list
13 public RList asList() { return new RList(); }
14 public Object asNativeJavaObject() { return null; }