void add(final Span span) {
    if (tags != null) {
      throw new AssertionError("The set of tags has already been computed"
                               + ", you can't add more Spans to " + this);
    }

    // normalize timestamps to milliseconds for proper comparison
    final long start = (start_time & Const.SECOND_MASK) == 0 ? 
        start_time * 1000 : start_time;
    final long end = (end_time & Const.SECOND_MASK) == 0 ? 
        end_time * 1000 : end_time;

    if (span.size() == 0) {
      // copy annotations that are in the time range
      for (Annotation annot : span.getAnnotations()) {
        long annot_start = annot.getStartTime();
        if ((annot_start & Const.SECOND_MASK) == 0) {
          annot_start *= 1000;
        }
        long annot_end = annot.getStartTime();
        if ((annot_end & Const.SECOND_MASK) == 0) {
          annot_end *= 1000;
        }
        if (annot_end >= start && annot_start <= end) {
          annotations.add(annot);
        }
      }
    } else {
      long first_dp = span.timestamp(0);
      if ((first_dp & Const.SECOND_MASK) == 0) {
        first_dp *= 1000;
      }
      // The following call to timestamp() will throw an
      // IndexOutOfBoundsException if size == 0, which is OK since it would
      // be a programming error.
      long last_dp = span.timestamp(span.size() - 1);
      if ((last_dp & Const.SECOND_MASK) == 0) {
        last_dp *= 1000;
      }
      if (first_dp <= end && last_dp >= start) {
        this.spans.add(span);
        annotations.addAll(span.getAnnotations());
      }
    }
  }
void add ( final Span span ) { if ( tags != null ) { throw new AssertionError ( "The set of tags has already been computed" + ", you can't add more Spans to " + this ) ; } final long start = ( start_time & Const . SECOND_MASK ) == 0 ? start_time * 1000 : start_time ; final long end = ( end_time & Const . SECOND_MASK ) == 0 ? end_time * 1000 : end_time ; if ( span . size ( ) == 0 ) { for ( Annotation annot : span . getAnnotations ( ) ) { long annot_start = annot . getStartTime ( ) ; if ( ( annot_start & Const . SECOND_MASK ) == 0 ) { annot_start *= 1000 ; } long annot_end = annot . getStartTime ( ) ; if ( ( annot_end & Const . SECOND_MASK ) == 0 ) { annot_end *= 1000 ; } if ( annot_end >= start && annot_start <= end ) { annotations . add ( annot ) ; } } } else { long first_dp = span . timestamp ( 0 ) ; if ( ( first_dp & Const . SECOND_MASK ) == 0 ) { first_dp *= 1000 ; } long last_dp = span . timestamp ( span . size ( ) - 1 ) ; if ( ( last_dp & Const . SECOND_MASK ) == 0 ) { last_dp *= 1000 ; } if ( first_dp <= end && last_dp >= start ) { this . spans . add ( span ) ; annotations . addAll ( span . getAnnotations ( ) ) ; } } }
Adds a span to this group, provided that it's in the right time range.
<b>Must not</b> be called once {@link #getTags} or
{@link #getAggregatedTags} has been called on this instance.
@param span The span to add to this group.  If none of the data points
fall within our time range, this method will silently ignore that span.