当前位置: 首页>>代码示例>>Java>>正文


Java EnumMap.get方法代码示例

本文整理汇总了Java中java.util.EnumMap.get方法的典型用法代码示例。如果您正苦于以下问题:Java EnumMap.get方法的具体用法?Java EnumMap.get怎么用?Java EnumMap.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.EnumMap的用法示例。


在下文中一共展示了EnumMap.get方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkJdk

import java.util.EnumMap; //导入方法依赖的package包/类
public ProbeResult checkJdk(File jdkPath) {
    if (!jdkPath.exists()) {
        return ProbeResult.failure(InstallType.NO_SUCH_DIRECTORY, "No such directory: " + jdkPath);
    }
    EnumMap<SysProp, String> metadata = cache.getUnchecked(jdkPath);
    String version = metadata.get(SysProp.VERSION);
    if (UNKNOWN.equals(version)) {
        return ProbeResult.failure(InstallType.INVALID_JDK, metadata.get(SysProp.Z_ERROR));
    }
    try {
        JavaVersion.toVersion(version);
    } catch (IllegalArgumentException ex) {
        // if the version string cannot be parsed
        return ProbeResult.failure(InstallType.INVALID_JDK, "Cannot parse version number: " + version);
    }
    if (javaExe(jdkPath, "javac").exists()) {
        return ProbeResult.success(InstallType.IS_JDK, metadata);
    }
    return ProbeResult.success(InstallType.IS_JRE, metadata);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:21,代码来源:JavaInstallationProbe.java

示例2: computeJdkName

import java.util.EnumMap; //导入方法依赖的package包/类
private static String computeJdkName(InstallType result, EnumMap<SysProp, String> metadata) {
    String basename = result == InstallType.IS_JDK ? "JDK" : "JRE";
    String vendor = metadata.get(JavaInstallationProbe.SysProp.VENDOR);
    if (vendor == null) {
        return basename;
    } else {
        vendor = vendor.toLowerCase();
    }
    if (vendor.contains("apple")) {
        return "Apple " + basename;
    } else if (vendor.contains("oracle") || vendor.contains("sun")) {
        String vm = metadata.get(JavaInstallationProbe.SysProp.VM);
        if (vm != null && vm.contains("OpenJDK")) {
            return result == InstallType.IS_JDK ? "OpenJDK" : "OpenJDK JRE";
        }
        return "Oracle " + basename;
    } else if (vendor.contains("ibm")) {
        return "IBM " + basename;
    } else if (vendor.contains("azul systems")) {
        return "Zulu " + basename;
    } else if (vendor.contains("hewlett-packard")) {
        return "HP-UX " + basename;
    }

    return basename;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:27,代码来源:JavaInstallationProbe.java

示例3: getAbsoluteUnitString

import java.util.EnumMap; //导入方法依赖的package包/类
/**
 * Gets the string value from qualitativeUnitMap with fallback based on style.
 */
private String getAbsoluteUnitString(Style style, AbsoluteUnit unit, Direction direction) {
    EnumMap<AbsoluteUnit, EnumMap<Direction, String>> unitMap;
    EnumMap<Direction, String> dirMap;

    do {
        unitMap = qualitativeUnitMap.get(style);
        if (unitMap != null) {
            dirMap = unitMap.get(unit);
            if (dirMap != null) {
                String result = dirMap.get(direction);
                if (result != null) {
                    return result;
                }
            }

        }

        // Consider other styles from alias fallback.
        // Data loading guaranteed no endless loops.
    } while ((style = fallbackCache[style.ordinal()]) != null);
    return null;
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:26,代码来源:RelativeDateTimeFormatter.java

示例4: getRelativeUnitPattern

import java.util.EnumMap; //导入方法依赖的package包/类
private String getRelativeUnitPattern(
        Style style, RelativeUnit unit, int pastFutureIndex, StandardPlural pluralForm) {
    int pluralIndex = pluralForm.ordinal();
    do {
        EnumMap<RelativeUnit, String[][]> unitMap = patternMap.get(style);
        if (unitMap != null) {
            String[][] spfCompiledPatterns = unitMap.get(unit);
            if (spfCompiledPatterns != null) {
                if (spfCompiledPatterns[pastFutureIndex][pluralIndex] != null) {
                    return spfCompiledPatterns[pastFutureIndex][pluralIndex];
                }
            }

        }

        // Consider other styles from alias fallback.
        // Data loading guaranteed no endless loops.
    } while ((style = fallbackCache[style.ordinal()]) != null);
    return null;
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:21,代码来源:RelativeDateTimeFormatter.java

示例5: consumeTimeDetail

import java.util.EnumMap; //导入方法依赖的package包/类
public void consumeTimeDetail(UResource.Key key, UResource.Value value) {
    UResource.Table unitTypesTable = value.getTable();

    EnumMap<RelativeUnit, String[][]> unitPatterns  = styleRelUnitPatterns.get(style);
    if (unitPatterns == null) {
        unitPatterns = new EnumMap<RelativeUnit, String[][]>(RelativeUnit.class);
        styleRelUnitPatterns.put(style, unitPatterns);
    }
    String[][] patterns = unitPatterns.get(unit.relUnit);
    if (patterns == null) {
        patterns = new String[2][StandardPlural.COUNT];
        unitPatterns.put(unit.relUnit, patterns);
    }

    // Stuff the pattern for the correct plural index with a simple formatter.
    for (int i = 0; unitTypesTable.getKeyAndValue(i, key, value); i++) {
        if (value.getType() == ICUResourceBundle.STRING) {
            int pluralIndex = StandardPlural.indexFromString(key.toString());
            if (patterns[pastFutureIndex][pluralIndex] == null) {
                patterns[pastFutureIndex][pluralIndex] =
                        SimpleFormatterImpl.compileToStringMinMaxArguments(
                                value.getString(), sb, 0, 1);
            }
        }
    }
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:27,代码来源:RelativeDateTimeFormatter.java

示例6: handlePlainDirection

import java.util.EnumMap; //导入方法依赖的package包/类
private void handlePlainDirection(UResource.Key key, UResource.Value value) {
    AbsoluteUnit absUnit = unit.absUnit;
    if (absUnit == null) {
        return;  // Not interesting.
    }
    EnumMap<AbsoluteUnit, EnumMap<Direction, String>> unitMap =
            qualitativeUnitMap.get(style);
    if (unitMap == null) {
        unitMap = new EnumMap<AbsoluteUnit, EnumMap<Direction, String>>(AbsoluteUnit.class);
        qualitativeUnitMap.put(style, unitMap);
    }
    EnumMap<Direction,String> dirMap = unitMap.get(absUnit);
    if (dirMap == null) {
        dirMap = new EnumMap<Direction,String>(Direction.class);
        unitMap.put(absUnit, dirMap);
    }
    if (dirMap.get(Direction.PLAIN) == null) {
        dirMap.put(Direction.PLAIN, value.toString());
    }
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:21,代码来源:RelativeDateTimeFormatter.java

示例7: setFormatterIfAbsent

import java.util.EnumMap; //导入方法依赖的package包/类
void setFormatterIfAbsent(int index, UResource.Value value, int minPlaceholders) {
    if (patterns == null) {
        EnumMap<FormatWidth, String[]> styleToPatterns =
                cacheData.unitToStyleToPatterns.get(unit);
        if (styleToPatterns == null) {
            styleToPatterns =
                    new EnumMap<FormatWidth, String[]>(FormatWidth.class);
            cacheData.unitToStyleToPatterns.put(unit, styleToPatterns);
        } else {
            patterns = styleToPatterns.get(width);
        }
        if (patterns == null) {
            patterns = new String[MeasureFormatData.PATTERN_COUNT];
            styleToPatterns.put(width, patterns);
        }
    }
    if (patterns[index] == null) {
        patterns[index] = SimpleFormatterImpl.compileToStringMinMaxArguments(
                value.getString(), sb, minPlaceholders, 1);
    }
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:22,代码来源:MeasureFormat.java

示例8: countEditLogOpTypes

import java.util.EnumMap; //导入方法依赖的package包/类
/**
 * @see #countEditLogOpTypes(File)
 */
public static EnumMap<FSEditLogOpCodes, Holder<Integer>> countEditLogOpTypes(
    EditLogInputStream elis) throws IOException {
  EnumMap<FSEditLogOpCodes, Holder<Integer>> opCounts =
      new EnumMap<FSEditLogOpCodes, Holder<Integer>>(FSEditLogOpCodes.class);
  
  FSEditLogOp op;
  while ((op = elis.readOp()) != null) {
    Holder<Integer> i = opCounts.get(op.opCode);
    if (i == null) {
      i = new Holder<Integer>(0);
      opCounts.put(op.opCode, i);
    }
    i.held++;
  }
  return opCounts;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:FSImageTestUtil.java

示例9: addArtifact

import java.util.EnumMap; //导入方法依赖的package包/类
private static void addArtifact(UsageKind usage, Set<File> directories, EnumMap<UsageKind, List<PublishArtifact>> artifacts, JvmAssembly assembly) {
    List<PublishArtifact> publishArtifacts = artifacts.get(usage);
    for (File dir : directories) {
        DefaultPublishArtifact publishArtifact = new DefaultPublishArtifact("assembly", "", "", "", new Date(dir.lastModified()), dir);
        publishArtifact.builtBy(assembly);
        publishArtifacts.add(publishArtifact);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:JvmLocalLibraryMetaDataAdapter.java

示例10: setDnamIfAbsent

import java.util.EnumMap; //导入方法依赖的package包/类
void setDnamIfAbsent(UResource.Value value) {
    EnumMap<FormatWidth, String> styleToDnam = cacheData.unitToStyleToDnam.get(unit);
    if (styleToDnam == null) {
        styleToDnam = new EnumMap<FormatWidth, String>(FormatWidth.class);
        cacheData.unitToStyleToDnam.put(unit, styleToDnam);
    }
    if (styleToDnam.get(width) == null) {
        styleToDnam.put(width, value.getString());
    }
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:11,代码来源:MeasureFormat.java

示例11: incrOpCount

import java.util.EnumMap; //导入方法依赖的package包/类
private void incrOpCount(FSEditLogOpCodes opCode,
    EnumMap<FSEditLogOpCodes, Holder<Integer>> opCounts, Step step,
    Counter counter) {
  Holder<Integer> holder = opCounts.get(opCode);
  if (holder == null) {
    holder = new Holder<Integer>(1);
    opCounts.put(opCode, holder);
  } else {
    holder.held++;
  }
  counter.increment();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:FSEditLogLoader.java

示例12: test

import java.util.EnumMap; //导入方法依赖的package包/类
public static String test(int i) {
    EnumMap<Enum, String> map = new EnumMap<>(Enum.class);
    map.put(Enum.A, "A");
    map.put(Enum.B, "B");
    map.put(Enum.C, "C");
    return map.get(Enum.values()[i]);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:EnumMap02.java

示例13: configureUsageMetadata

import java.util.EnumMap; //导入方法依赖的package包/类
private static void configureUsageMetadata(UsageKind usage,
                                           Iterable<DependencySpec> dependencies,
                                           EnumMap<UsageKind, Iterable<DependencySpec>> dependenciesPerUsage) {
    Iterable<DependencySpec> dependencySpecs = dependenciesPerUsage.get(usage);
    dependenciesPerUsage.put(usage, Iterables.concat(dependencies, dependencySpecs));
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:7,代码来源:JvmLocalLibraryMetaDataAdapter.java

示例14: consumeTableRelative

import java.util.EnumMap; //导入方法依赖的package包/类
public void consumeTableRelative(UResource.Key key, UResource.Value value) {
    UResource.Table unitTypesTable = value.getTable();
    for (int i = 0; unitTypesTable.getKeyAndValue(i, key, value); i++) {
        if (value.getType() == ICUResourceBundle.STRING) {
            String valueString = value.getString();

            EnumMap<AbsoluteUnit, EnumMap<Direction, String>> absMap = qualitativeUnitMap.get(style);

            if (unit.relUnit == RelativeUnit.SECONDS) {
                if (key.contentEquals("0")) {
                    // Handle Zero seconds for "now".
                    EnumMap<Direction, String> unitStrings = absMap.get(AbsoluteUnit.NOW);
                    if (unitStrings == null) {
                        unitStrings = new EnumMap<Direction, String>(Direction.class);
                        absMap.put(AbsoluteUnit.NOW, unitStrings);
                    }
                    if (unitStrings.get(Direction.PLAIN) == null) {
                        unitStrings.put(Direction.PLAIN, valueString);
                    }
                    continue;
                }
            }
            Direction keyDirection = keyToDirection(key);
            if (keyDirection == null) {
                continue;
            }
            AbsoluteUnit absUnit = unit.absUnit;
            if (absUnit == null) {
                continue;
            }

            if (absMap == null) {
                absMap = new EnumMap<AbsoluteUnit, EnumMap<Direction, String>>(AbsoluteUnit.class);
                qualitativeUnitMap.put(style, absMap);
            }
            EnumMap<Direction, String> dirMap = absMap.get(absUnit);
            if (dirMap == null) {
                dirMap = new EnumMap<Direction, String>(Direction.class);
                absMap.put(absUnit, dirMap);
            }
            if (dirMap.get(keyDirection) == null) {
                // Do not override values already entered.
                dirMap.put(keyDirection, value.getString());
            }
        }
    }
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:48,代码来源:RelativeDateTimeFormatter.java


注:本文中的java.util.EnumMap.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。