public ImmutableBiMap<ModContainer, Object> buildModObjectList()
{
ImmutableBiMap.Builder<ModContainer, Object> builder = ImmutableBiMap.<ModContainer, Object>builder();
for (ModContainer mc : activeModList)
{
if (!mc.isImmutable() && mc.getMod()!=null)
{
builder.put(mc, mc.getMod());
List<String> packages = mc.getOwnedPackages();
for (String pkg : packages)
{
packageOwners.put(pkg, mc);
}
}
if (mc.getMod()==null && !mc.isImmutable() && state!=LoaderState.CONSTRUCTING)
{
FMLLog.severe("There is a severe problem with %s - it appears not to have constructed correctly", mc.getModId());
if (state != LoaderState.CONSTRUCTING)
{
this.errorOccurred(mc, new RuntimeException());
}
}
}
return builder.build();
}
java类com.google.common.collect.ImmutableBiMap的实例源码
LoadController.java 文件源码
项目:Cauldron
阅读 28
收藏 0
点赞 0
评论 0
FilterResourcesStep.java 文件源码
项目:buck-cutom
阅读 17
收藏 0
点赞 0
评论 0
/**
* Creates a command that filters a specified set of directories.
* @param inResDirToOutResDirMap set of {@code res} directories to filter
* @param filterDrawables whether to filter drawables (images)
* @param filterStrings whether to filter non-english strings
* @param whitelistedStringDirs set of directories containing string resource files that must not
* be filtered out.
* @param filteredDirectoryCopier refer {@link FilteredDirectoryCopier}
* @param targetDensities densities we're interested in keeping (e.g. {@code mdpi}, {@code hdpi}
* etc.) Only applicable if filterDrawables is true
* @param drawableFinder refer {@link DrawableFinder}. Only applicable if filterDrawables is true.
* @param imageScaler if not null, use the {@link ImageScaler} to downscale higher-density
* drawables for which we weren't able to find an image file of the proper density (as opposed
* to allowing Android to do it at runtime). Only applicable if filterDrawables. is true.
*/
@VisibleForTesting
FilterResourcesStep(
ImmutableBiMap<Path, Path> inResDirToOutResDirMap,
boolean filterDrawables,
boolean filterStrings,
ImmutableSet<Path> whitelistedStringDirs,
FilteredDirectoryCopier filteredDirectoryCopier,
@Nullable Set<Filters.Density> targetDensities,
@Nullable DrawableFinder drawableFinder,
@Nullable ImageScaler imageScaler) {
Preconditions.checkArgument(filterDrawables || filterStrings);
Preconditions.checkArgument(!filterDrawables ||
(targetDensities != null && drawableFinder != null));
this.inResDirToOutResDirMap = Preconditions.checkNotNull(inResDirToOutResDirMap);
this.filterDrawables = filterDrawables;
this.filterStrings = filterStrings;
this.whitelistedStringDirs = Preconditions.checkNotNull(whitelistedStringDirs);
this.filteredDirectoryCopier = Preconditions.checkNotNull(filteredDirectoryCopier);
this.targetDensities = targetDensities;
this.drawableFinder = drawableFinder;
this.imageScaler = imageScaler;
this.nonEnglishStringFilesBuilder = ImmutableSet.builder();
}
SouthboundMapper.java 文件源码
项目:ovsdb
阅读 15
收藏 0
点赞 0
评论 0
public static List<ProtocolEntry> createMdsalProtocols(Bridge bridge) {
Set<String> protocols = null;
try {
protocols = bridge.getProtocolsColumn().getData();
} catch (SchemaVersionMismatchException e) {
schemaMismatchLog("protocols", "Bridge", e);
}
List<ProtocolEntry> protocolList = new ArrayList<>();
if (protocols != null && protocols.size() > 0) {
ImmutableBiMap<String, Class<? extends OvsdbBridgeProtocolBase>> mapper =
SouthboundConstants.OVSDB_PROTOCOL_MAP.inverse();
for (String protocol : protocols) {
if (protocol != null && mapper.get(protocol) != null) {
protocolList.add(new ProtocolEntryBuilder().setProtocol(mapper.get(protocol)).build());
}
}
}
return protocolList;
}
SouthboundMapper.java 文件源码
项目:ovsdb
阅读 16
收藏 0
点赞 0
评论 0
/**
* Return the MD-SAL QoS type class corresponding to the QoS type {@link Qos}.
*
* @param type the QoS type to match {@link String}
* @return class matching the input QoS type {@link QosTypeBase}
*/
public static Class<? extends QosTypeBase> createQosType(String type) {
Preconditions.checkNotNull(type);
if (type.isEmpty()) {
LOG.info("QoS type not supplied");
return QosTypeBase.class;
} else {
ImmutableBiMap<String, Class<? extends QosTypeBase>> mapper =
SouthboundConstants.QOS_TYPE_MAP.inverse();
if (mapper.get(type) == null) {
LOG.info("QoS type not found in model: {}", type);
return QosTypeBase.class;
} else {
return mapper.get(type);
}
}
}
LogDataConverter.java 文件源码
项目:Pore
阅读 17
收藏 0
点赞 0
评论 0
@SuppressWarnings("rawtypes")
private LogDataConverter() {
converters.put(
ImmutableBiMap.<AbstractDataValue, Byte>builder()
.put(new TreeDataValue(TreeTypes.OAK), (byte) 0)
.put(new TreeDataValue(TreeTypes.SPRUCE), (byte) 1)
.put(new TreeDataValue(TreeTypes.BIRCH), (byte) 2)
.put(new TreeDataValue(TreeTypes.JUNGLE), (byte) 3)
.build(),
(byte) 2
);
applicableTypes.add(TreeData.class);
converters.put(
ImmutableBiMap.<AbstractDataValue, Byte>builder()
.put(new AxisDataValue(Axis.Y), (byte) 0)
.put(new AxisDataValue(Axis.X), (byte) 1)
.put(new AxisDataValue(Axis.Z), (byte) 2)
//TODO: add mapping for data value 3 (not yet in SpongeAPI)
.build(),
(byte) 2
);
applicableTypes.add(AxisData.class);
}
BigMushroomDataConverter.java 文件源码
项目:Pore
阅读 16
收藏 0
点赞 0
评论 0
@SuppressWarnings("rawtypes")
private BigMushroomDataConverter() {
converters.put(
ImmutableBiMap.<AbstractDataValue, Byte>builder()
.put(new BigMushroomDataValue(BigMushroomTypes.ALL_INSIDE), (byte) 0)
.put(new BigMushroomDataValue(BigMushroomTypes.NORTH_WEST), (byte) 1)
.put(new BigMushroomDataValue(BigMushroomTypes.NORTH), (byte) 2)
.put(new BigMushroomDataValue(BigMushroomTypes.NORTH_EAST), (byte) 3)
.put(new BigMushroomDataValue(BigMushroomTypes.WEST), (byte) 4)
.put(new BigMushroomDataValue(BigMushroomTypes.CENTER), (byte) 5)
.put(new BigMushroomDataValue(BigMushroomTypes.EAST), (byte) 6)
.put(new BigMushroomDataValue(BigMushroomTypes.SOUTH_WEST), (byte) 7)
.put(new BigMushroomDataValue(BigMushroomTypes.SOUTH), (byte) 8)
.put(new BigMushroomDataValue(BigMushroomTypes.SOUTH_EAST), (byte) 9)
.put(new BigMushroomDataValue(BigMushroomTypes.STEM), (byte) 10)
.put(new BigMushroomDataValue(BigMushroomTypes.ALL_OUTSIDE), (byte) 14)
.put(new BigMushroomDataValue(BigMushroomTypes.ALL_STEM), (byte) 15)
.build(),
(byte) 4);
applicableTypes.add(BigMushroomData.class);
}
NodeScoreDistributionTest.java 文件源码
项目:jpmml-evaluator
阅读 17
收藏 0
点赞 0
评论 0
@Test
public void getProbability(){
Node node = new Node()
.setScore("ham");
final
BiMap<String, Node> entityRegistry = ImmutableBiMap.of("1", node);
NodeScoreDistribution<Double> classification = new NodeScoreDistribution<Double>(new ValueMap<String, Double>(), node){
@Override
public BiMap<String, Node> getEntityRegistry(){
return entityRegistry;
}
};
classification.put("ham", new DoubleValue(0.75d));
classification.put("spam", new DoubleValue(0.25d));
assertEquals(ImmutableSet.of("ham", "spam"), classification.getCategoryValues());
assertEquals((Double)0.75d, classification.getProbability("ham"));
assertEquals((Double)0.25d, classification.getProbability("spam"));
}
ItemHeroBow.java 文件源码
项目:ZeldaSwordSkills
阅读 24
收藏 0
点赞 0
评论 0
/**
* Adds all custom arrow items to maps - should be done in post-init.
*/
public static void initializeArrows() {
arrowMap.put(Items.arrow, EntityArrowCustom.class);
arrowMap.put(ZSSItems.arrowBomb, EntityArrowBomb.class);
arrowMap.put(ZSSItems.arrowBombFire, EntityArrowBomb.class);
arrowMap.put(ZSSItems.arrowBombWater, EntityArrowBomb.class);
arrowMap.put(ZSSItems.arrowFire, EntityArrowElemental.class);
arrowMap.put(ZSSItems.arrowIce, EntityArrowElemental.class);
arrowMap.put(ZSSItems.arrowLight, EntityArrowElemental.class);
ImmutableBiMap.Builder<Item, BombType> builder = ImmutableBiMap.builder();
builder.put(ZSSItems.arrowBomb, BombType.BOMB_STANDARD);
builder.put(ZSSItems.arrowBombFire, BombType.BOMB_FIRE);
builder.put(ZSSItems.arrowBombWater, BombType.BOMB_WATER);
bombArrowMap = builder.build();
elementalArrowMap.put(ZSSItems.arrowFire, ElementType.FIRE);
elementalArrowMap.put(ZSSItems.arrowIce, ElementType.ICE);
elementalArrowMap.put(ZSSItems.arrowLight, ElementType.LIGHT);
}
LoadController.java 文件源码
项目:RuneCraftery
阅读 23
收藏 0
点赞 0
评论 0
public ImmutableBiMap<ModContainer, Object> buildModObjectList()
{
ImmutableBiMap.Builder<ModContainer, Object> builder = ImmutableBiMap.<ModContainer, Object>builder();
for (ModContainer mc : activeModList)
{
if (!mc.isImmutable() && mc.getMod()!=null)
{
builder.put(mc, mc.getMod());
}
if (mc.getMod()==null && !mc.isImmutable() && state!=LoaderState.CONSTRUCTING)
{
FMLLog.severe("There is a severe problem with %s - it appears not to have constructed correctly", mc.getModId());
if (state != LoaderState.CONSTRUCTING)
{
this.errorOccurred(mc, new RuntimeException());
}
}
}
return builder.build();
}
StructTest.java 文件源码
项目:GitHub
阅读 22
收藏 0
点赞 0
评论 0
@Test
public void structFromConstructorSerializeDeserialize() throws Exception {
ImmutableStructFromConstructor structFromConstructor =
ImmutableStructFromConstructor.of(
2,
Arrays.asList(1, 2),
Optional.of("OPT"),
ImmutableMultiset.of("list", "list"),
ImmutableMultimap.of(1, "1"),
ImmutableListMultimap.of(2, "2"),
ImmutableBiMap.of(1, "2"))
.withIndexSet(ImmutableListMultimap.of(3, "3"));
check(deserialize(serialize(structFromConstructor))).is(structFromConstructor);
}