Skip to content

Commit

Permalink
Change short to int in Span.java to fix precision loss and support la…
Browse files Browse the repository at this point in the history
…rger

sets

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
  • Loading branch information
Josh Thomas authored and manolama committed Apr 23, 2014
1 parent 5fb30d6 commit ed1febb
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/core/Span.java
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,9 @@ public String toString() {
* @param timestamp A strictly positive 32-bit integer.
* @return A strictly positive index in the {@code rows} array.
*/
private short seekRow(final long timestamp) {
private int seekRow(final long timestamp) {
checkRowOrder();
short row_index = 0;
int row_index = 0;
RowSeq row = null;
final int nrows = rows.size();
for (int i = 0; i < nrows; i++) {
Expand Down Expand Up @@ -378,7 +378,7 @@ Span.Iterator spanIterator() {
final class Iterator implements SeekableView {

/** Index of the {@link RowSeq} we're currently at, in {@code rows}. */
private short row_index;
private int row_index;

/** Iterator on the current row. */
private RowSeq.Iterator current_row;
Expand Down Expand Up @@ -408,7 +408,7 @@ public void remove() {
}

public void seek(final long timestamp) {
short row_index = seekRow(timestamp);
int row_index = seekRow(timestamp);
if (row_index != this.row_index) {
this.row_index = row_index;
current_row = rows.get(row_index).internalIterator();
Expand Down Expand Up @@ -453,7 +453,7 @@ final class DownsamplingIterator
private final Aggregator downsampler;

/** Index of the {@link RowSeq} we're currently at, in {@code rows}. */
private short row_index;
private int row_index;

/** The row we're currently at. */
private RowSeq.Iterator current_row;
Expand Down Expand Up @@ -513,7 +513,7 @@ public DataPoint next() {
// interval turn out to be integers. While we do this, compute the
// average timestamp of all the datapoints in that interval.
long newtime = 0;
final short saved_row_index = row_index;
final int saved_row_index = row_index;
final long saved_state = current_row.saveState();
// Since we know hasNext() returned true, we have at least 1 point.
moveToNext();
Expand Down Expand Up @@ -561,7 +561,7 @@ public void remove() {
// ---------------------- //

public void seek(final long timestamp) {
short row_index = seekRow(timestamp);
int row_index = seekRow(timestamp);
if (row_index != this.row_index) {
//LOG.debug("seek from row #" + this.row_index + " to " + row_index);
this.row_index = row_index;
Expand Down

0 comments on commit ed1febb

Please sign in to comment.