示例#1
0
 protected String lookupName(RList f) {
   if (f.getNames() != null) {
     RAbstractStringVector names = f.getNames();
     for (int i = 0; i < names.getLength(); i++) {
       if (names.getDataAt(i).equals("name")) {
         String name = RRuntime.asString(f.getDataAt(i));
         return name != null ? name : UNKNOWN_EXTERNAL_BUILTIN;
       }
     }
   }
   return UNKNOWN_EXTERNAL_BUILTIN;
 }
 public String getDataAt(int index) {
   if (levels == null || levels.getLength() == 0) {
     return RRuntime.STRING_NA;
   } else {
     int val = ((RIntVector) vector).getDataAt(index);
     if (!vector.isComplete() && RRuntime.isNA(val)) {
       return RRuntime.STRING_NA;
     } else {
       String l = levels.getDataAt(val - 1);
       if (!levels.isComplete() && RRuntime.isNA(l)) {
         return "NA"; // for comparison
       } else {
         return l;
       }
     }
   }
 }