Returns a human readable string representation of the object.
()
| 471 | * Returns a human readable string representation of the object. |
| 472 | */ |
| 473 | @Override |
| 474 | public String toString() { |
| 475 | // The argument passed to StringBuilder is a pretty good estimate of the |
| 476 | // length of the final string based on the row key and number of elements. |
| 477 | final String metric = metricName(); |
| 478 | final StringBuilder buf = new StringBuilder(80 + metric.length() |
| 479 | + row_key.length * 4 + size * 16); |
| 480 | buf.append("BatchedDataPoints(") |
| 481 | .append(row_key == null ? "<null>" : Arrays.toString(row_key)) |
| 482 | .append(" (metric=") |
| 483 | .append(metric) |
| 484 | .append("), base_time=") |
| 485 | .append(base_time) |
| 486 | .append(" (") |
| 487 | .append(base_time > 0 ? new Date(base_time * 1000) : "no date") |
| 488 | .append("), ["); |
| 489 | int q_offset = 0; |
| 490 | int v_offset = 0; |
| 491 | for (int i = 0; i < size; i++) { |
| 492 | buf.append('+').append(Internal.getOffsetFromQualifier(batched_qualifier, q_offset)); |
| 493 | final short flags = Internal.getFlagsFromQualifier(batched_qualifier, q_offset); |
| 494 | if (isInteger(i, q_offset)) { |
| 495 | buf.append(":long(") |
| 496 | .append(Internal.extractIntegerValue(batched_value, v_offset, (byte)flags)); |
| 497 | } |
| 498 | else { |
| 499 | buf.append(":float(") |
| 500 | .append(Internal.extractFloatingPointValue(batched_value, v_offset, (byte)flags)); |
| 501 | } |
| 502 | buf.append(')'); |
| 503 | if (i != size - 1) { |
| 504 | buf.append(", "); |
| 505 | } |
| 506 | v_offset += Internal.getValueLengthFromQualifier(batched_qualifier, q_offset); |
| 507 | q_offset += Internal.getQualifierLength(batched_qualifier, q_offset); |
| 508 | } |
| 509 | buf.append("])"); |
| 510 | return buf.toString(); |
| 511 | } |
| 512 | |
| 513 | public int getQueryIndex() { |
| 514 | throw new UnsupportedOperationException("Not mapped to a query"); |
no test coverage detected