For sqrt elements, if the contents are collapsed, collapse the sqrt instead.
183059
function (mml) {
      this.UncollapseChild(mml,0);
      if (mml.complexity > this.COLLAPSE.sqrt)
        mml = this.MakeAction(this.Marker(this.MARKER.sqrt),mml);
      return mml;
    }
1061573
def collapse(self, id_user):
        """"""
        c = CmtCOLLAPSED(id_bibrec=self.id_bibrec, id_cmtRECORDCOMMENT=self.id,
                         id_user=id_user)
        db.session.add(c)
        db.session.commit()
1167018
def collapse_indents(indentation):
    """"""
    change_in_level = ind_change(indentation)
    if change_in_level == 0:
        indents = ""
    elif change_in_level < 0:
        indents = closeindent * (-change_in_level)
    else:
        indents = openindent * change_in_level
    return indentation.replace(openindent, "").replace(closeindent, "") + indents
644579
function(e, params) {
      Event.stopEvent(e);
      var tgt = Event.getTarget(e);
      
      if( Dom.hasClass(tgt, 'expanded') || Dom.hasClass(tgt, 'collapsed') ) {
         this.expandElement(tgt);
      }
   }
444801
public void shrinkTo(int newSize) {
    if (newSize < this.size) {
      for (int i = this.size; i > newSize; i--)
        this.elements[i - 1] = null;
      this.size = newSize;
    }
  }
1045422
function collapseTree(treeId) {
	var ul = document.getElementById(treeId);
	if (ul == null) { return false; }
	expandCollapseList(ul,nodeClosedClass);
}
511630
function collapse_all(min_lines) {
  var elts = document.getElementsByTagName("div");
  for (var i=0; i<elts.length; i++) {
    var elt = elts[i];
    var split = elt.id.indexOf("-");
    if (split > 0)
      if (elt.id.substring(split, elt.id.length) == "-expanded")
        if (num_lines(elt.innerHTML) > min_lines)
          collapse(elt.id.substring(0, split));
  }
}
418260
function (element) {
      if (this.config.disabled) return;
      this.GetContainerWidths(element);
      var jax = HUB.getAllJax(element);
      var state = {collapse: [], jax: jax, m: jax.length, i: 0, changed:false};
      return this.collapseState(state);
    }
783109
static int collapse(char[] chars, int len) {
		// collapse
		// After the processing implied by replace, contiguous sequences of
		// #x20's are collapsed to a single #x20, and leading and trailing
		// #x20's are removed.
		replace(chars, len);

		int newLen = len;

		// contiguous sequences of #x20's are collapsed to a single #x20
		if (newLen > 1) {
			int i = 0;
			while (i < (newLen - 1)) {
				char thisChar = chars[i];
				char nextChar = chars[i + 1];
				if (thisChar == ' ' && nextChar == ' ') {
					// eliminate one space
					shiftLeft(chars, i, newLen - i);
					newLen--;
				} else {
					i++;
				}
			}
		}

		// leading and trailing #x20's are removed
		newLen = trimSpaces(chars, newLen);

		return newLen;
	}
1257832
function (node, single, layoutBy) {
    if (!node._private.data.collapsedChildren){
      return;
    }

    //check how the position of the node is changed
    var positionDiff = {
      x: node._private.position.x - node._private.data['position-before-collapse'].x,
      y: node._private.position.y - node._private.data['position-before-collapse'].y
    };

    node.removeData("infoLabel");
    node.removeClass('cy-expand-collapse-collapsed-node');

    node.trigger("expandcollapse.beforeexpand");
    node._private.data.collapsedChildren.restore();
    this.repairEdges(node);
    node._private.data.collapsedChildren = null;

    elementUtilities.moveNodes(positionDiff, node.children());
    node.removeData('position-before-collapse');

    node.trigger("position"); // position not triggered by default when nodes are moved
    node.trigger("expandcollapse.afterexpand");

    // If expand is called just for one node then call end operation to perform layout
    if (single) {
      this.endOperation(layoutBy);
    }
  }
297053
function collapse(values) {
  if (!values || !values.length) return [];
  var length = values.length;

  // Truncate values
  var replica = [];
  for (var i = length; i--;) {
    var sample = strip(values[i]);
    if (!+sample) replica[i] = '0';
    else replica[i] = truncate(values[i]);
  }

  // Collapse values
  var a = replica[0], b = replica[1], c = replica[2], d = replica[3];
  switch (length) {
    case 2: if (a === b) return [a];
    case 3: {
      if (a === b && b === c) return [a];
      if (a === c) return [a, b];
    }
    case 4: {
      if (a === b && b === c && c === d) return [a];
      if (a === c && b === d) return [a, b];
      if (b === d) return [a, b, c];
    }
    default: return values;
  }
}
1370298
private static void collapseIfPossible(FastAdapter fastAdapter) {
        try {
            Class c = Class.forName("com.mikepenz.fastadapter.expandable.ExpandableExtension");
            if (c != null) {
                IAdapterExtension extension = fastAdapter.getExtension(c);
                if (extension != null) {
                    Method method = extension.getClass().getMethod("collapse");
                    method.invoke(extension);
                }
            }
        } catch (Exception ignored) {
            //
        }
    }
716557
def collapse(self):
        
        results = []

        if isinstance(self._items, dict):
            items = self._items.values()

        for values in items:
            if isinstance(values, Collection):
                values = values.all()

            results += values

        return Collection(results)
520918
def collapse(types)
      return types.first if types.size == 1
      return nil if types.empty?
      return String if string?(types)
      return Float if float?(types)
      String
    end
456006
@UiThread
    public void collapseParentRange(int startParentPosition, int parentCount) {
        int endParentPosition = startParentPosition + parentCount;
        for (int i = startParentPosition; i < endParentPosition; i++) {
            collapseParent(i);
        }
    }
178528
def _set_collapse_interval(data, interval):
        
        if interval <= 0:
            return data
        if data and isinstance(data, list):
            for d in data:
                children = d.get("children", None)
                if children and interval > 0:
                    for index, value in enumerate(children):
                        if index % interval == 0:
                            value.update(collapsed="false")
            return data
210297
@UiThread
    protected void collapseView() {
        setExpanded(false);
        onExpansionToggled(true);

        if (mParentViewHolderExpandCollapseListener != null) {
            mParentViewHolderExpandCollapseListener.onParentCollapsed(getAdapterPosition());
        }
    }