Creates the stats type.

@param statsItems
the stats items
@param sortType
the sort type
@param functionParser
the function parser
@return the string
487959
static String createStatsType(Set<String> statsItems, String sortType,
      MtasFunctionParserFunction functionParser) {
    String statsType = STATS_BASIC;
    for (String statsItem : statsItems) {
      if (STATS_FULL_TYPES.contains(statsItem)) {
        statsType = STATS_FULL;
        break;
      } else if (STATS_ADVANCED_TYPES.contains(statsItem)) {
        statsType = STATS_ADVANCED;
      } else if (statsType != STATS_ADVANCED
          && STATS_BASIC_TYPES.contains(statsItem)) {
        statsType = STATS_BASIC;
      } else {
        Matcher m = fpStatsFunctionItems.matcher(statsItem.trim());
        if (m.find()) {
          if (STATS_FUNCTIONS.contains(m.group(2).trim())) {
            statsType = STATS_FULL;
            break;
          }
        }
      }
    }
    if (sortType != null && STATS_TYPES.contains(sortType)) {
      if (STATS_FULL_TYPES.contains(sortType)) {
        statsType = STATS_FULL;
      } else if (STATS_ADVANCED_TYPES.contains(sortType)) {
        statsType = (statsType == null || statsType != STATS_FULL)
            ? STATS_ADVANCED : statsType;
      }
    }
    return statsType;
  }
1302037
public final MtasDataItemNumberComparator<Long> getCompareValue0() {
    createStats();
    switch (sortType) {
    case CodecUtil.STATS_TYPE_N:
      return new MtasDataItemNumberComparator<>(stats.getN(), sortDirection);
    default:
      return null;
    }
  }
714979
public void sortRowsForIndexByType(int index, DataType dataType)
	{
		Comparator<List<String>> comparator = null;
		
		switch(dataType)
		{
		
			case Long : { comparator = (list1, list2) -> 
				Long.valueOf(list1.get(0)).compareTo(Long.valueOf(list2.get(0))); 
			   }
			break;
			default:
				comparator = (list1, list2) -> 
				list1.get(0).compareTo(list2.get(0));
		}

		sortRows(comparator);
	}
184762
public static Number calStats(String statsString,
            LongSummaryStatistics summaryStatistics) {
        return StatsField.valueOfAlias(statsString).calStats(summaryStatistics);
    }
741289
@Override
  public MtasDataItemNumberComparator<Double> getCompareValue1() {
    createStats();
    switch (sortType) {
    case CodecUtil.STATS_TYPE_SUM:
      return new MtasDataItemNumberComparator<>(stats.getSum(), sortDirection);
    case CodecUtil.STATS_TYPE_MAX:
      return new MtasDataItemNumberComparator<>(stats.getMax(), sortDirection);
    case CodecUtil.STATS_TYPE_MIN:
      return new MtasDataItemNumberComparator<>(stats.getMin(), sortDirection);
    case CodecUtil.STATS_TYPE_SUMSQ:
      return new MtasDataItemNumberComparator<>(stats.getSumsq(),
          sortDirection);
    default:
      return null;
    }
  }
586831
function(type, order, stickFolders, alsoTreeview) {
		this.storage('sortType', (this.sortType = this.sortRules[type] ? type : 'name'));
		this.storage('sortOrder', (this.sortOrder = /asc|desc/.test(order) ? order : 'asc'));
		this.storage('sortStickFolders', (this.sortStickFolders = !!stickFolders) ? 1 : '');
		this.storage('sortAlsoTreeview', (this.sortAlsoTreeview = !!alsoTreeview) ? 1 : '');
		this.trigger('sortchange');
	}
497968
public static Class[] getCollectionType( PropertyDescriptor pd, boolean useGetter )
         throws JSONException {

      Type type;
      if( useGetter ){
         Method m = pd.getReadMethod();
         type = m.getGenericReturnType();
      }else{
         Method m = pd.getWriteMethod();
         Type[] gpts = m.getGenericParameterTypes();

         if( 1 != gpts.length ){
            throw new JSONException( "method " + m + " is not a standard setter" );
         }
         type = gpts[0];
      }

      if( !(type instanceof ParameterizedType) ){
         return null;
         // throw new JSONException("type not instanceof ParameterizedType:
         // "+type.getClass());
      }

      ParameterizedType pType = (ParameterizedType) type;
      Type[] actualTypes = pType.getActualTypeArguments();

      Class[] ret = new Class[actualTypes.length];
      for( int i = 0; i < ret.length; i++ ){
         ret[i] = (Class) actualTypes[i];
      }

      return ret;
   }
1247761
public static final SerIterable sortedMap(final Class<?> keyType, final Class<?> valueType, final List<Class<?>> valueTypeTypes) {
        final SortedMap<Object, Object> map = new TreeMap<>();
        return map(keyType, valueType, valueTypeTypes, map);
    }
1221330
function(field,sortType){
			if(this.gridComp.options.showTree){
				this.treeSortRows(field,sortType);
			}else{
				this.basicSortRows(field,sortType);
			}
			this.gridComp.eidtRowIndex = -1;
		}
891352
function addType(descriptor) {
  if (!(descriptor instanceof fs.Stats)) {
    return descriptor;
  }
  [
    "isFile", "isDirectory", "isBlockDevice", "isCharacterDevice",
    "isSymbolicLink", "isFIFO", "isSocket",
  ].forEach(function(funcName) {
    if (descriptor[funcName]()) {
      descriptor[funcName] = true;
    } else {
      descriptor[funcName] = undefined;
    }
  });
  if (_.isArray(descriptor.content)) {
    descriptor.content.forEach(function(obj) {
      addType(obj);
    });
  }
  return descriptor;
}
969739
public final int getCompareValueType() throws IOException {
    switch (sortType) {
    case CodecUtil.STATS_TYPE_N:
      return 0;
    case CodecUtil.STATS_TYPE_SUM:
      return 1;
    case CodecUtil.STATS_TYPE_MEAN:
      return 2;
    default:
      throw new IOException("sortType " + sortType + " not supported");
    }
  }
586737
@DefaultVisibilityForTesting
  static StatsComponent loadStatsComponent(@Nullable ClassLoader classLoader) {
    try {
      // Call Class.forName with literal string name of the class to help shading tools.
      return Provider.createInstance(
          Class.forName(
              "io.opencensus.impl.stats.StatsComponentImpl", /*initialize=*/ true, classLoader),
          StatsComponent.class);
    } catch (ClassNotFoundException e) {
      logger.log(
          Level.FINE,
          "Couldn't load full implementation for StatsComponent, now trying to load lite "
              + "implementation.",
          e);
    }
    try {
      // Call Class.forName with literal string name of the class to help shading tools.
      return Provider.createInstance(
          Class.forName(
              "io.opencensus.impllite.stats.StatsComponentImplLite",
              /*initialize=*/ true,
              classLoader),
          StatsComponent.class);
    } catch (ClassNotFoundException e) {
      logger.log(
          Level.FINE,
          "Couldn't load lite implementation for StatsComponent, now using "
              + "default implementation for StatsComponent.",
          e);
    }
    return NoopStats.newNoopStatsComponent();
  }
1347378
public function sortBy($sort_by, $sort_type = 'asc')
    {
        if (is_callable($sort_by)) {
            $rslt = call_user_func($sort_by, $this->items->toArray());

            if (!is_array($rslt)) {
                $rslt = array($rslt);
            }

            $this->items = new Collection($rslt);
            return $this;
        }

        // running the sort proccess on the sortable items
        $this->items = $this->items->sort(function ($f, $s) use ($sort_by, $sort_type) {
            $f = $f->$sort_by;
            $s = $s->$sort_by;

            if ($f == $s) {
                return 0;
            }

            if ('asc' == $sort_type) {
                return $f > $s ? 1 : -1;
            }

            return $f < $s ? 1 : -1;
        });

        return $this;
    }
1122124
function getComparator(sortOrder) {
  if (typeof sortOrder === 'function') {
    return sortOrder;
  }

  const comparators = {
    [ASC]: ascendingSort,
    [DESC]: descendingSort,
    [ASC_LENGTH]: lengthSort,
    [DESC_LENGTH]: lengthReverseSort
  };

  return comparators[sortOrder];
}
316975
def sort_stats(stats,
               sortedby='cpu_percent',
               sortedby_secondary='memory_percent',
               reverse=True):
    
    if sortedby is None and sortedby_secondary is None:
        # No need to sort...
        return stats

    # Check if a specific sort should be done
    sort_lambda = _sort_lambda(sortedby=sortedby,
                               sortedby_secondary=sortedby_secondary)

    if sort_lambda is not None:
        # Specific sort
        try:
            stats.sort(key=sort_lambda, reverse=reverse)
        except Exception:
            # If an error is detected, fallback to cpu_percent
            stats.sort(key=lambda process: (weighted(process['cpu_percent']),
                                            weighted(process[sortedby_secondary])),
                       reverse=reverse)
    else:
        # Standard sort
        try:
            stats.sort(key=lambda process: (weighted(process[sortedby]),
                                            weighted(process[sortedby_secondary])),
                       reverse=reverse)
        except (KeyError, TypeError):
            # Fallback to name
            stats.sort(key=lambda process: process['name'] if process['name'] is not None else '~',
                       reverse=False)

    return stats
210424
public JSType createFunctionTypeWithInstanceType(ObjectType instanceType,
      JSType returnType, List<JSType> parameterTypes) {
    Node paramsNode = createParameters(parameterTypes.toArray(new JSType[parameterTypes.size()]));
    return FunctionType.builder(this)
        .withParamsNode(paramsNode)
        .withReturnType(returnType)
        .withTypeOfThis(instanceType)
        .build();
  }
1034065
public FunctionType createFunctionType(
      JSType returnType, JSType... parameterTypes) {
    return createFunctionType(returnType, createParameters(parameterTypes));
  }