Function: sortCells

Sorts the given cells according to the order in the cell hierarchy.
Ascending is optional and defaults to true.
776209
function(cells, ascending)
	{
		ascending = (ascending != null) ? ascending : true;
		var lookup = new mxDictionary();
		cells.sort(function(o1, o2)
		{
			var p1 = lookup.get(o1);
			
			if (p1 == null)
			{
				p1 = mxCellPath.create(o1).split(mxCellPath.PATH_SEPARATOR);
				lookup.put(o1, p1);
			}
			
			var p2 = lookup.get(o2);
			
			if (p2 == null)
			{
				p2 = mxCellPath.create(o2).split(mxCellPath.PATH_SEPARATOR);
				lookup.put(o2, p2);
			}
			
			var comp = mxCellPath.compare(p1, p2);
			
			return (comp == 0) ? 0 : (((comp > 0) == ascending) ? 1 : -1);
		});
		
		return cells;
	}
73329
public static IntComparator rowComparator(Column<?> column, Sort.Order order) {
        IntComparator rowComparator = column.rowComparator();
        if (order == Sort.Order.DESCEND) {
            return ReversingIntComparator.reverse(rowComparator);
        } else {
            return rowComparator;
        }
    }
924891
public static void sortDescending(float[] floatArray) {
        int index = 0;
        float value = 0;
        
        for(int i = 1; i < floatArray.length; i++) {
            index = i;
            value = floatArray[index];
            
            while(index > 0 && value > floatArray[index - 1]) {
                floatArray[index] = floatArray[index - 1];
                
                index--;
            }
            
            floatArray[index] = value;
        }
    }
11353
function sortGroups(selector) {
  selector.each((subSelector) => {
    subSelector.nodes.sort((a, b) => {
      // different types cannot be sorted
      if (a.type !== b.type) {
        return 0;
      }

      // sort alphabetically
      return a.value < b.value ? -1 : 1;
    });
  });

  selector.sort((a, b) => (a.nodes.join('') < b.nodes.join('') ? -1 : 1));
}
1298200
def remove(self, order, cells):
        

        self._normalized = False

        order = self._validate_order(order)

        for cell in cells:
            cell = self._validate_cell(order, cell)

            self._compare_operation(order, cell, True, 'remove')
912115
function ObjectSort(array, columns, order)
{
	//Check the columns
	if(typeof columns === 'undefined')
	{
		//Create the columns array
		var columns = [];

		//Add the keys
		for(var key in array[0]){ columns.push(key); }
	}

	//Check if columns is not an array
	else if(Array.isArray(columns) === false)
	{
		//Convert it to array
		columns = [columns];
	}

	//Check the order
	if(typeof order === 'undefined')
	{
		//Create the order array
		var order = [];

		//Add ASC order
		for(var i = 0; i < columns.length; i++){ order.push('ASC'); }
	}

	//Check if order is not an array
	else if(Array.isArray(order) === false)
	{
		//Convert it to array
		order = [order];
	}

	//Else, check for lowercase
	else
	{
		//Add the order to uppercase
		for(var i = 0; i < order.length; i++){ order[i] = order[i].toUpperCase(); }
	}

	//Check the order array length
	if(order.length < columns.length)
	{
		//Complete the order array
		for(var i = order.length; i < columns.length; i++){ order.push('ASC'); }
	}

	//Sort the array
	array.sort(function(left, right){ return Compare(left, right, columns, order); });

	//Return the array
	return array;
}
458505
private static Sort first(String columnName, Sort.Order order) {
        return Sort.on(columnName, order);
    }
576560
def _sort_cols(self, cols, kwargs):
        
        if not cols:
            raise ValueError("should sort by at least one column")
        if len(cols) == 1 and isinstance(cols[0], list):
            cols = cols[0]
        jcols = [_to_java_column(c) for c in cols]
        ascending = kwargs.get('ascending', True)
        if isinstance(ascending, (bool, int)):
            if not ascending:
                jcols = [jc.desc() for jc in jcols]
        elif isinstance(ascending, list):
            jcols = [jc if asc else jc.desc()
                     for asc, jc in zip(ascending, jcols)]
        else:
            raise TypeError("ascending can only be boolean or list, but got %s" % type(ascending))
        return self._jseq(jcols)
1252297
@SuppressWarnings({ "unchecked", "rawtypes" })
    static final <R> Comparator<Cell<R>> comparator() {
        return (Comparator<Cell<R>>) (Comparator) COMPARATOR;
    }
954952
def sort(label, ascending=true)
      i = @labels.index(label)
      raise "No column named" + label.to_s if i.nil?
      order = @data[i].sorted_indices
      order.reverse! unless ascending
      self.sort_by.with_index{|val, i| order.index(i)}
    end
103277
public static void sortDescending(byte[] byteArray) {
        int index = 0;
        byte value = 0;
        
        for(int i = 1; i < byteArray.length; i++) {
            index = i;
            value = byteArray[index];
            
            while(index > 0 && value > byteArray[index - 1]) {
                byteArray[index] = byteArray[index - 1];
                
                index--;
            }
            
            byteArray[index] = value;
        }
    }
583709
function removeMultipleColsByCells($cells) {
  const numberOfCells = $cells.length;
  for (let i = 0; i < numberOfCells; i += 1) {
    const $cellToDelete = $cells.eq(i);
    if ($cellToDelete.length > 0) {
      removeColByCell($cells.eq(i));
    }
  }
}
597283
def sort(self, ranks=None):
        
        ranks = ranks or self.ranks
        self.cards = sort_cards(self.cards, ranks)
1111727
def flattened(self, order=None, include_smaller=True):
        """"""

        if order is None:
            order = self.order
        else:
            order = self._validate_order(order)

        # Start with the cells which are already at this order.
        flat = set(self[order])

        # Look at lower orders and expand them into this set.
        # Based on the "map" algorithm from Appendix A of the
        # MOC recommendation.
        for order_i in range(0, order):
            shift = 2 * (order - order_i)

            for cell in self[order_i]:
                flat.update(range(cell << shift, (cell + 1) << shift))

        # Look at higher orders unless we have been told to exclude
        # them.
        if include_smaller:
            for order_i in range(order + 1, MAX_ORDER + 1):
                shift = 2 * (order_i - order)

                for cell in self[order_i]:
                    flat.add(cell >> shift)

        return flat
979901
private function findCellExpectedAnswer(Cell $cell)
    {
        $best = null;
        foreach ($cell->getChoices() as $choice) {
            /** @var CellChoice $choice */
            if (empty($best) || $best->getScore() < $choice->getScore()) {
                $best = $choice;
            }
        }

        return $best;
    }
915281
function compareCells(a, b) {
  var n = a.length
    , t = a.length - b.length
    , min = Math.min
  if(t) {
    return t
  }
  switch(n) {
    case 0:
      return 0;
    case 1:
      return a[0] - b[0];
    case 2:
      var d = a[0]+a[1]-b[0]-b[1]
      if(d) {
        return d
      }
      return min(a[0],a[1]) - min(b[0],b[1])
    case 3:
      var l1 = a[0]+a[1]
        , m1 = b[0]+b[1]
      d = l1+a[2] - (m1+b[2])
      if(d) {
        return d
      }
      var l0 = min(a[0], a[1])
        , m0 = min(b[0], b[1])
        , d  = min(l0, a[2]) - min(m0, b[2])
      if(d) {
        return d
      }
      return min(l0+a[2], l1) - min(m0+b[2], m1)
    
    //TODO: Maybe optimize n=4 as well?
    
    default:
      var as = a.slice(0)
      as.sort()
      var bs = b.slice(0)
      bs.sort()
      for(var i=0; i<n; ++i) {
        t = as[i] - bs[i]
        if(t) {
          return t
        }
      }
      return 0
  }
}
1111174
private void sortMethodList() {

        // order of execution is base classes first, then the order of
        // processorClasses, reversed for tear downs

        // build up the order:
        final List<Class<?>> hierarchy = new ArrayList<Class<?>>();

        if (initialisationClasses != null) {
            for (int i = initialisationClasses.length; i > 0; i--) {

                hierarchy.addAll(classHierarchyFor(initialisationClasses[i - 1]));
            }
        }
        sortMethodLists(hierarchy);
    }