>>>>>> measureUntilFull helper methods
350847
protected int getCenterChild(CacheDataSet cache) {
        if (cache.count() == 0)
            return -1;

        int id = cache.getId(0);
        switch (getGravityInternal()) {
            case TOP:
            case LEFT:
            case FRONT:
            case FILL:
                break;
            case BOTTOM:
            case RIGHT:
            case BACK:
                id = cache.getId(cache.count() - 1);
                break;
            case CENTER:
                int i = cache.count() / 2;
                while (i < cache.count() && i >= 0) {
                    id =  cache.getId(i);
                    if (cache.getStartDataOffset(id) <= 0) {
                        if (cache.getEndDataOffset(id) >= 0) {
                            break;
                        } else {
                            i++;
                        }
                    } else {
                        i--;
                    }
                }
                break;
            default:
                break;
        }

        Log.d(LAYOUT, TAG, "getCenterChild = %d ", id);
        return id;
    }
524715
@Override
	protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
		Drawable drawable = getDrawable();
		if (getDrawable() != null) {
			if (ratioType == RATIO_WIDTH) {
				int width = MeasureSpec.getSize(widthMeasureSpec);
				int height = Math.round(width * (((float) drawable.getIntrinsicHeight()) / ((float) drawable.getIntrinsicWidth())));
				setMeasuredDimension(width, height);
			} else if (ratioType == RATIO_HEIGHT) {
				int height = MeasureSpec.getSize(heightMeasureSpec);
				int width = Math.round(height * ((float) drawable.getIntrinsicWidth()) / ((float) drawable.getIntrinsicHeight()));
				setMeasuredDimension(width, height);
			}
		} else {
			super.onMeasure(widthMeasureSpec, heightMeasureSpec);
		}
	}
54212
def _wrap_measure(individual_state_measure_process, state_measure, loaded_processes): 
    
    def wrapped_measure(state_collection,overriding_parameters=None,loggers=None):
        if loggers == None:
            loggers = funtool.logger.set_default_loggers()
        if loaded_processes != None :
            if state_measure.grouping_selectors != None:
                for grouping_selector_name in state_measure.grouping_selectors:
                    state_collection= funtool.state_collection.add_grouping(state_collection, grouping_selector_name, loaded_processes) 
            states= state_collection.states
            measure_parameters= get_measure_parameters(state_measure, overriding_parameters)
            if 'sort_by' in measure_parameters.keys():
                states= funtool.lib.general.sort_states(states, measure_parameters['sort_by'])
            for state_index,state in enumerate(states):
                step_size= len(states)//20
                if state_index % step_size == 0:
                    loggers.status_logger.warn("{}: {} %".format( datetime.datetime.now(), round((state_index/len(states) * 100 ), 1) ) )
                analysis_collection = funtool.analysis.AnalysisCollection(state,None,{},{})
                if state_measure.analysis_selectors != None:
                    for analysis_selector in state_measure.analysis_selectors:
                        analysis_collection = loaded_processes["analysis_selector"][analysis_selector].process_function(analysis_collection,state_collection)
                if analysis_collection != None:
                    individual_state_measure_process(analysis_collection,state_collection,overriding_parameters)
        return state_collection
    return wrapped_measure
990294
private void checkFull() {
    if (!full && messages.size() >= maxQueueSize) {
      full = true;
      log.debug(String.format("%s - Connection to %s is full", this, context.target()));
    }
  }
912174
function() {
    this._locked = true;
    this._measureVertexes = L.featureGroup().addTo(this._layer);
    this._captureMarker = L.marker(this._map.getCenter(), {
      clickable: true,
      zIndexOffset: this.options.captureZIndex,
      opacity: 0
    }).addTo(this._layer);
    this._setCaptureMarkerIcon();

    this._captureMarker
      .on('mouseout', this._handleMapMouseOut, this)
      .on('dblclick', this._handleMeasureDoubleClick, this)
      .on('click', this._handleMeasureClick, this);

    this._map
      .on('mousemove', this._handleMeasureMove, this)
      .on('mouseout', this._handleMapMouseOut, this)
      .on('move', this._centerCaptureMarker, this)
      .on('resize', this._setCaptureMarkerIcon, this);

    L.DomEvent.on(this._container, 'mouseenter', this._handleMapMouseOut, this);

    this._updateMeasureStartedNoPoints();

    this._map.fire('measurestart', null, false);
  }
910624
def measure
      before = take_time
      yield
      after = take_time
      @repeat += 1
      @times[:repeat] << @repeat
      @times[:scatter] << @scatter
      bs = self.case.batch_size.abs
      if bs and bs > 1
        TIMES.each_with_index { |t, i| @times[t] << (after[i] - before[i]) / bs }
      else
        TIMES.each_with_index { |t, i| @times[t] << after[i] - before[i] }
      end
      @analysis = nil
    end
179454
function calculateFit() {
      // ignore any further processing if we have total lines
      if (lineCount > lineClamp) {
        // move to the next word
        nextWord();
        return;
      }
      // create a text node to measure
      textNode = ctn(text.substr(lineStart, pos - lineStart));
      // place relevant nodes into the measurement element
      appendNodeAndQueueToElement(measure, textNode, pendingQueue);
      // take the measurement
      measureWidth = measure.clientWidth;
      // remove text node from node stack
      if (nodeStack.length) {
        nodeStack[nodeStack.length - 1].removeChild(textNode);
      }
      // have we exceeded allowed line width?
      if (lineWidth <= measureWidth) {
        if(wasNewLine) {
          // we have a long word so it gets a line of it's own
          lineText = text.substr(lineStart, Math.min(pos + 1, text.length) - lineStart);
          // next line start position
          lineStart = Math.min(pos + 1, text.length);
          // move to the next word
          nextWord();
        } else {
          // grab the text until this word
          lineText = text.substr(lineStart, wordStart - lineStart);
          // next line start position
          lineStart = wordStart;
        }
        // create a line element
        line = ce('span');
        // add text to the line element
        appendNodeAndQueueToElement(line, ctn(lineText), pendingQueue);
        // add the line element to the container
        el.appendChild(line);
        // flush the queue
        pendingQueue = [];
        // refresh the stack
        nodeStack = nodeStack.map((node) => node.cloneNode(false));
        // yes, we created a new line
        wasNewLine = true;
        ++lineCount;
      } else {
        // did not create a new line
        wasNewLine = false;
        // move to the next word
        nextWord();
      }
      // clear measurement element
      while (measure.firstChild !== null) {
        measure.removeChild(measure.firstChild);
      }
    }
19873
def measure_string(self, text, fontname, fontsize, encoding=0):
        """"""
        return _fitz.Tools_measure_string(self, text, fontname, fontsize, encoding)
122850
def size_measure_type=(size_measure_type)
      validator = EnumAttributeValidator.new('String', ["Pixels", "Percents", "Millimeters"])
      if size_measure_type.to_i == 0
        unless validator.valid?(size_measure_type)
          raise ArgumentError, "invalid value for 'size_measure_type', must be one of #{validator.allowable_values}."
        end
        @size_measure_type = size_measure_type
      else
        @size_measure_type = validator.allowable_values[size_measure_type.to_i]
      end
    end
815079
private int measureWidth(CmsContextMenuItemWidget item) {

        return item.getOffsetWidth()
            - CmsDomUtil.getCurrentStyleInt(item.getElement(), Style.paddingLeft)
            - CmsDomUtil.getCurrentStyleInt(item.getElement(), Style.paddingRight);
    }
1211288
def measure(self, vid):
        """"""

        from ambry.orm import Column

        if isinstance(vid, PartitionColumn):
            return vid
        elif isinstance(vid, Column):
            return PartitionColumn(vid)
        else:
            return PartitionColumn(self.table.column(vid), self)
89931
function() {
		var i,
			sizeData = this._calculateAbsoluteSizes();

		for( i = 0; i < this.contentItems.length; i++ ) {
			if( sizeData.additionalPixel - i > 0 ) {
				sizeData.itemSizes[ i ]++;
			}

			if( this._isColumn ) {
				this.contentItems[ i ].element.width( sizeData.totalWidth );
				this.contentItems[ i ].element.height( sizeData.itemSizes[ i ] );
			} else {
				this.contentItems[ i ].element.width( sizeData.itemSizes[ i ] );
				this.contentItems[ i ].element.height( sizeData.totalHeight );
			}
		}
	}
920052
def GetSizeHint(self, context=None, **unused_kwargs):
    
    context_state = getattr(context, 'state', {})

    elements_data_size = self.GetByteSize()
    if elements_data_size:
      return elements_data_size

    try:
      elements_data_size = self._CalculateElementsDataSize(context)
    except errors.MappingError:
      pass

    if elements_data_size is None and self._HasElementsTerminator():
      size_hints = context_state.get('size_hints', {})
      size_hint = size_hints.get(self._data_type_definition.name, None)

      elements_data_size = 0

      if size_hint:
        elements_data_size = size_hint.byte_size

      if not size_hint or not size_hint.is_complete:
        elements_data_size += self._element_data_type_definition.GetByteSize()

    return elements_data_size
88348
@Override
    public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        int measuredWidth = MeasureSpec.getSize(widthMeasureSpec);
        int widthMode = MeasureSpec.getMode(widthMeasureSpec);
        int measuredHeight = MeasureSpec.getSize(heightMeasureSpec);
        int heightMode = MeasureSpec.getMode(heightMeasureSpec);
        int minDimension = Math.min(measuredWidth, measuredHeight);

        super.onMeasure(MeasureSpec.makeMeasureSpec(minDimension, widthMode),
                MeasureSpec.makeMeasureSpec(minDimension, heightMode));
    }
724115
function createMeasureTooltip() {
  if (measureTooltipElement) {
    measureTooltipElement.parentNode.removeChild(measureTooltipElement);
  }
  measureTooltipElement = document.createElement('div');
  measureTooltipElement.className = 'ol-tooltip ol-tooltip-measure';
  measureTooltip = new Overlay({
    element: measureTooltipElement,
    offset: [0, -15],
    positioning: 'bottom-center'
  });
  map.addOverlay(measureTooltip);
}
1090865
def measure(config, result, max_retries=10):
  """"""
  url = get_api_path('measurement.json')
  data = {'config': config, 'result': result}
  retries = 0
  while(retries < max_retries):
      try:
          r = requests.post(url, data=json.dumps(data, cls=HCEncoder), headers=get_headers(), timeout=30)
          return r.text
      except requests.exceptions.RequestException:
          e = sys.exc_info()[0]
          print("Error while calling hyperchamber - retrying ", e)
          retries += 1
374781
function measureText (nodes, parentNode) {
  let width = 0
  for (let i = 0; i < nodes.length; i++) {
    const node = nodes[i]
    width += measure(node.textContent, node.nodeType === 1 ? node : parentNode)
  }
  return width
}