gpt4 book ai didi

com.facebook.device.yearclass.YearClass.getRamYear()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-14 17:05:31 25 4
gpt4 key购买 nike

本文整理了Java中com.facebook.device.yearclass.YearClass.getRamYear()方法的一些代码示例,展示了YearClass.getRamYear()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YearClass.getRamYear()方法的具体详情如下:
包路径:com.facebook.device.yearclass.YearClass
类名称:YearClass
方法名:getRamYear

YearClass.getRamYear介绍

[英]Calculates the year class by the amount of RAM the phone has. Evaluations are based off the table below: AmountYear>2GB2014201320122011201020092008
[中]根据手机的内存量计算年份。评估基于下表:金额年>2GB20142014201320122011201020092008

代码示例

代码示例来源:origin: facebook/device-year-class

/**
 * Calculates the "best-in-class year" of the device. This represents the top-end or flagship
 * devices of that year, not the actual release year of the phone. For example, the Galaxy Duos
 * S was released in 2012, but its specs are very similar to the Galaxy S that was released in
 * 2010 as a then top-of-the-line phone, so it is a 2010 device.
 *
 * @return The year when this device would have been considered top-of-the-line.
 */
private static int categorizeByYear2014Method(Context c) {
 ArrayList<Integer> componentYears = new ArrayList<Integer>();
 conditionallyAdd(componentYears, getNumCoresYear());
 conditionallyAdd(componentYears, getClockSpeedYear());
 conditionallyAdd(componentYears, getRamYear(c));
 if (componentYears.isEmpty())
  return CLASS_UNKNOWN;
 Collections.sort(componentYears);
 if ((componentYears.size() & 0x01) == 1) {  // Odd number; pluck the median.
  return componentYears.get(componentYears.size() / 2);
 } else { // Even number. Average the two "center" values.
  int baseIndex = componentYears.size() / 2 - 1;
  // There's an implicit rounding down in here; 2011.5 becomes 2011.
  return componentYears.get(baseIndex) +
    (componentYears.get(baseIndex + 1) - componentYears.get(baseIndex)) / 2;
 }
}

代码示例来源:origin: com.facebook.device.yearclass/yearclass

/**
 * Calculates the "best-in-class year" of the device. This represents the top-end or flagship
 * devices of that year, not the actual release year of the phone. For example, the Galaxy Duos
 * S was released in 2012, but its specs are very similar to the Galaxy S that was released in
 * 2010 as a then top-of-the-line phone, so it is a 2010 device.
 *
 * @return The year when this device would have been considered top-of-the-line.
 */
private static int categorizeByYear2014Method(Context c) {
 ArrayList<Integer> componentYears = new ArrayList<Integer>();
 conditionallyAdd(componentYears, getNumCoresYear());
 conditionallyAdd(componentYears, getClockSpeedYear());
 conditionallyAdd(componentYears, getRamYear(c));
 if (componentYears.isEmpty())
  return CLASS_UNKNOWN;
 Collections.sort(componentYears);
 if ((componentYears.size() & 0x01) == 1) {  // Odd number; pluck the median.
  return componentYears.get(componentYears.size() / 2);
 } else { // Even number. Average the two "center" values.
  int baseIndex = componentYears.size() / 2 - 1;
  // There's an implicit rounding down in here; 2011.5 becomes 2011.
  return componentYears.get(baseIndex) +
    (componentYears.get(baseIndex + 1) - componentYears.get(baseIndex)) / 2;
 }
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com