示例#1
0
文件: Frame.java 项目: vmlaker/h2o
 public StringBuilder toString(StringBuilder sb, String[] fs, long idx) {
   Vec vecs[] = vecs();
   for (int c = 0; c < fs.length; c++) {
     Vec vec = vecs[c];
     if (vec.isEnum()) {
       String s = "----------";
       if (!vec.isNA(idx)) {
         int x = (int) vec.at8(idx);
         if (x >= 0 && x < vec._domain.length) s = vec._domain[x];
       }
       sb.append(String.format(fs[c], s));
     } else if (vec.isInt()) {
       if (vec.isNA(idx)) {
         Chunk C = vec.elem2BV(0); // 1st Chunk
         int len = C.pformat_len0(); // Printable width
         for (int i = 0; i < len; i++) sb.append('-');
       } else {
         try {
           sb.append(String.format(fs[c], vec.at8(idx)));
         } catch (IllegalFormatException ife) {
           System.out.println("Format: " + fs[c] + " col=" + c + " not for ints");
           ife.printStackTrace();
         }
       }
     } else {
       sb.append(String.format(fs[c], vec.at(idx)));
       if (vec.isNA(idx)) sb.append(' ');
     }
     sb.append(' '); // Column seperator
   }
   sb.append('\n');
   return sb;
 }
示例#2
0
文件: Frame.java 项目: NidhiMehta/h2o
 @Override
 public String toString() {
   // Across
   String s = "{" + _names[0];
   long bs = _vecs[0].byteSize();
   for (int i = 1; i < _names.length; i++) {
     s += "," + _names[i];
     bs += _vecs[i].byteSize();
   }
   s += "}, " + PrettyPrint.bytes(bs) + "\n";
   // Down
   Vec v0 = firstReadable();
   if (v0 == null) return s;
   int nc = v0.nChunks();
   s += "Chunk starts: {";
   for (int i = 0; i < nc; i++) s += v0.elem2BV(i)._start + ",";
   s += "}";
   return s;
 }