/** Adds string (enum) value to the column. */ public void addStrCol(int colIdx, ValueString str) { if (colIdx >= _ncolumns) return; switch (_phase) { case ONE: ++_colIdx; // If this is a yet unspecified but non-numeric column, attempt a time-parse if (_colTypes[colIdx] == UCOL) { long time = attemptTimeParse(str); if (time != Long.MIN_VALUE) _colTypes[colIdx] = TCOL; } else if (_colTypes[colIdx] == TCOL) { return; } // Now attempt to make this an Enum col Enum e = _enums[colIdx]; if (e == null || e.isKilled()) return; if (_colTypes[colIdx] == UCOL) _colTypes[colIdx] = ECOL; e.addKey(str); ++_invalidValues[ colIdx]; // invalid count in phase0 is in fact number of non-numbers (it is used for // mean computation, is recomputed in 2nd pass) break; case TWO: if (_enums[colIdx] != null) { ++_colIdx; int id = _enums[colIdx].getTokenId(str); // we do not expect any misses here assert 0 <= id && id < _enums[colIdx].size(); switch (_colTypes[colIdx]) { case BYTE: _ab.put1(id); break; case SHORT: _ab.put2((char) id); break; case INT: _ab.put4(id); break; default: assert false : "illegal case: " + _colTypes[colIdx]; } } else if (_colTypes[colIdx] == LONG) { ++_colIdx; // Times are strings with a numeric column type of LONG _ab.put8(attemptTimeParse(str)); } else { addInvalidCol(colIdx); } break; default: assert (false); } }