// Slow-path append data private void append2slow() { if (sparseLen() > FileVec.DFLT_CHUNK_SIZE) throw new ArrayIndexOutOfBoundsException(sparseLen()); assert _ds == null; if (_ls != null && _ls.length > 0) { if (_id == null) { // check for sparseness int nzs = 0; for (int i = 0; i < _ls.length; ++i) if (_ls[i] != 0 || _xs[i] != 0) ++nzs; if ((nzs + 1) * _sparseRatio < _len) { set_sparse(nzs); assert sparseLen() == 0 || sparseLen() <= _ls.length : "_len = " + sparseLen() + ", _ls.length = " + _ls.length + ", nzs = " + nzs + ", len2 = " + _len; assert _id.length == _ls.length; assert sparseLen() <= _len; return; } } else { // verify we're still sufficiently sparse if ((_sparseRatio * (sparseLen()) >> 1) > _len) cancel_sparse(); else _id = MemoryManager.arrayCopyOf(_id, sparseLen() << 1); } _ls = MemoryManager.arrayCopyOf(_ls, sparseLen() << 1); _xs = MemoryManager.arrayCopyOf(_xs, sparseLen() << 1); } else { alloc_mantissa(4); alloc_exponent(4); if (_id != null) alloc_indices(4); } assert sparseLen() == 0 || sparseLen() < _ls.length : "_len = " + sparseLen() + ", _ls.length = " + _ls.length; assert _id == null || _id.length == _ls.length; assert sparseLen() <= _len; }