private Deferred<Object> addPointInternal(final long timestamp,
      final byte[] value, final short flags) throws IllegalDataException {
    final boolean ms_timestamp = (timestamp & Const.SECOND_MASK) != 0;

    // we only accept unix epoch timestamps in seconds or milliseconds
    if (timestamp < 0 || (ms_timestamp && timestamp > 9999999999999L)) {
      throw new IllegalArgumentException((timestamp < 0 ? "negative " : "bad")
          + " timestamp=" + timestamp
          + " when trying to add value=" + Arrays.toString(value) + " to " + this);
    }

    // always maintain lastTimestamp in milliseconds
    if ((ms_timestamp ? timestamp : timestamp * 1000) <= last_timestamp) {
      throw new IllegalArgumentException("New timestamp=" + timestamp
          + " is less than or equal to previous=" + last_timestamp
          + " when trying to add value=" + Arrays.toString(value)
          + " to " + this);
    }
    last_timestamp = (ms_timestamp ? timestamp : timestamp * 1000);

    long incomingBaseTime;
    if (ms_timestamp) {
      // drop the ms timestamp to seconds to calculate the base timestamp
      incomingBaseTime = 
          ((timestamp / 1000) - ((timestamp / 1000) % Const.MAX_TIMESPAN));
    }
    else {
      incomingBaseTime = (timestamp - (timestamp % Const.MAX_TIMESPAN));
    }

    /**
     * First time we add a point initialize the rows timestamp.
     */
    if (base_time == Long.MIN_VALUE) {
      base_time = incomingBaseTime;
      Bytes.setInt(row_key, (int) base_time, 
          tsdb.metrics.width() + Const.SALT_WIDTH());
    }

    if (incomingBaseTime - base_time >= Const.MAX_TIMESPAN) {
      throw new IllegalDataException(
          "The timestamp is beyond the boundary of this batch of data points");
    }
    if (incomingBaseTime < base_time) {
      throw new IllegalDataException(
          "The timestamp is prior to the boundary of this batch of data points");
    }

    // Java is so stupid with its auto-promotion of int to float.
    final byte[] new_qualifier = Internal.buildQualifier(timestamp, flags);

    // compact this data point with the previously compacted data points.
    append(new_qualifier, value);
    size++;

    /**
     * Satisfies the interface.
     */
    return Deferred.fromResult((Object) null);
  }
private Deferred < Object > addPointInternal ( final long timestamp , final byte [ ] value , final short flags ) throws IllegalDataException { final boolean ms_timestamp = ( timestamp & Const . SECOND_MASK ) != 0 ; if ( timestamp < 0 || ( ms_timestamp && timestamp > 9999999999999L ) ) { throw new IllegalArgumentException ( ( timestamp < 0 ? "negative " : "bad" ) + " timestamp=" + timestamp + " when trying to add value=" + Arrays . toString ( value ) + " to " + this ) ; } if ( ( ms_timestamp ? timestamp : timestamp * 1000 ) <= last_timestamp ) { throw new IllegalArgumentException ( "New timestamp=" + timestamp + " is less than or equal to previous=" + last_timestamp + " when trying to add value=" + Arrays . toString ( value ) + " to " + this ) ; } last_timestamp = ( ms_timestamp ? timestamp : timestamp * 1000 ) ; long incomingBaseTime ; if ( ms_timestamp ) { incomingBaseTime = ( ( timestamp / 1000 ) - ( ( timestamp / 1000 ) % Const . MAX_TIMESPAN ) ) ; } else { incomingBaseTime = ( timestamp - ( timestamp % Const . MAX_TIMESPAN ) ) ; } if ( base_time == Long . MIN_VALUE ) { base_time = incomingBaseTime ; Bytes . setInt ( row_key , ( int ) base_time , tsdb . metrics . width ( ) + Const . SALT_WIDTH ( ) ) ; } if ( incomingBaseTime - base_time >= Const . MAX_TIMESPAN ) { throw new IllegalDataException ( "The timestamp is beyond the boundary of this batch of data points" ) ; } if ( incomingBaseTime < base_time ) { throw new IllegalDataException ( "The timestamp is prior to the boundary of this batch of data points" ) ; } final byte [ ] new_qualifier = Internal . buildQualifier ( timestamp , flags ) ; append ( new_qualifier , value ) ; size ++ ; return Deferred . fromResult ( ( Object ) null ) ; }
Implements {@link #addPoint} by storing a value with a specific flag.

@param timestamp The timestamp to associate with the value.
@param value The value to store.
@param flags Flags to store in the qualifier (size and type of the data point).