本文整理匯總了Java中com.google.common.collect.BiMap.entrySet方法的典型用法代碼示例。如果您正苦於以下問題:Java BiMap.entrySet方法的具體用法?Java BiMap.entrySet怎麽用?Java BiMap.entrySet使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.common.collect.BiMap
的用法示例。
在下文中一共展示了BiMap.entrySet方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getUnmappedMethodMapping
import com.google.common.collect.BiMap; //導入方法依賴的package包/類
public Optional<MethodRef> getUnmappedMethodMapping(CtClass targetClass, CtMethod
handleMethod) {
BiMap<MethodRef, MethodRef> methodsInverted = methodRefs.inverse();
String descriptor = InjectorPlugin.removeCallbackDescriptor(handleMethod.getMethodInfo2()
.getDescriptor());
for (Map.Entry<MethodRef, MethodRef> mapping : methodsInverted.entrySet()) {
MethodRef key = mapping.getKey();
if (targetClass.getName().replace('.', '/').equals(key.getOwner()) && handleMethod
.getName
().equals
(key
.getName()) && descriptor.equals(key.getDesc())) {
return Optional.of(mapping.getValue());
}
}
return Optional.empty();
}
示例2: initData
import com.google.common.collect.BiMap; //導入方法依賴的package包/類
public void initData(SparseMatrix dataMatrix) throws LibrecException {
Table<Integer, Integer, Double> dataTable = dataMatrix.getDataTable();
BiMap<String, Integer> userIds = dataModel.getUserMappingData();
BiMap<String, Integer> itemIds = dataModel.getItemMappingData();
SparseMatrix dateTimeDataSet = (SparseMatrix) dataModel.getDatetimeDataSet();
Table<Integer, Integer, Double> dateTimeTable = dateTimeDataSet.getDataTable();
for (Map.Entry<String, Integer> userId : userIds.entrySet()) {
for (Map.Entry<String, Integer> itemId : itemIds.entrySet()) {
Object scValue = dataTable.get(userId.getValue(), itemId.getValue());
Object dtValue = dateTimeTable.get(userId.getValue(), itemId.getValue());
if (scValue != null && dtValue != null) {
Long user_id = Long.parseLong(userId.getKey());
Long movie_id = Long.parseLong(itemId.getKey());
Double score = (Double)scValue;
Double datetime = (Double)dtValue;
Rating rating = new Rating(user_id, movie_id, score);
User user = User.findUser(user_id);
if (user == null) continue;
MovieEx movie = (MovieEx) MovieEx.findMovie(movie_id);
if (movie == null) continue;
try {
user.addMovie(movie, score, datetime);
movie.addUser(user, score, datetime);
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
throw new LibrecException("load rating set error");
}
//rating.save();
Rating.allRatings.add(rating);
}
}
}
}
示例3: getUnmappedFieldMapping
import com.google.common.collect.BiMap; //導入方法依賴的package包/類
public Optional<FieldRef> getUnmappedFieldMapping(CtClass targetClass, CtField handleField) {
BiMap<FieldRef, FieldRef> fieldsInverted = fieldRefs.inverse();
for (Map.Entry<FieldRef, FieldRef> mapping : fieldsInverted.entrySet()) {
FieldRef remapped = mapping.getKey();
if (remapped.getOwner().equals(targetClass.getName().replace('.', '/')) && remapped
.getName().equals
(handleField.getName())) {
return Optional.of(mapping.getValue());
}
}
return Optional.empty();
}
示例4: ClassNamer
import com.google.common.collect.BiMap; //導入方法依賴的package包/類
public ClassNamer(BiMap<ClassEntry,ClassEntry> mappings) {
// convert the identity mappings to name maps
m_sourceNames = Maps.newHashMap();
m_destNames = Maps.newHashMap();
int i = 0;
for (Map.Entry<ClassEntry,ClassEntry> entry : mappings.entrySet()) {
String name = String.format("M%04d", i++);
m_sourceNames.put(entry.getKey().getName(), name);
m_destNames.put(entry.getValue().getName(), name);
}
}
示例5: loadFluidDefaults
import com.google.common.collect.BiMap; //導入方法依賴的package包/類
/**
* Called by forge to load default fluid IDs from the world or from server -> client for syncing
* DO NOT call this and expect useful behaviour.
* @param localFluidIDs
* @param defaultNames
*/
private static void loadFluidDefaults(BiMap<Fluid, Integer> localFluidIDs, Set<String> defaultNames)
{
// If there's an empty set of default names, use the defaults as defined locally
if (defaultNames.isEmpty()) {
defaultNames.addAll(defaultFluidName.values());
}
BiMap<String, Fluid> localFluids = HashBiMap.create(fluids);
for (String defaultName : defaultNames)
{
Fluid fluid = masterFluidReference.get(defaultName);
if (fluid == null) {
String derivedName = defaultName.split(":",2)[1];
String localDefault = defaultFluidName.get(derivedName);
if (localDefault == null) {
FMLLog.getLogger().log(Level.ERROR, "The fluid {} (specified as {}) is missing from this instance - it will be removed", derivedName, defaultName);
continue;
}
fluid = masterFluidReference.get(localDefault);
FMLLog.getLogger().log(Level.ERROR, "The fluid {} specified as default is not present - it will be reverted to default {}", defaultName, localDefault);
}
FMLLog.getLogger().log(Level.DEBUG, "The fluid {} has been selected as the default fluid for {}", defaultName, fluid.getName());
Fluid oldFluid = localFluids.put(fluid.getName(), fluid);
Integer id = localFluidIDs.remove(oldFluid);
localFluidIDs.put(fluid, id);
}
BiMap<Integer, String> localFluidNames = HashBiMap.create();
for (Entry<Fluid, Integer> e : localFluidIDs.entrySet()) {
localFluidNames.put(e.getValue(), e.getKey().getName());
}
fluidIDs = localFluidIDs;
fluids = localFluids;
fluidNames = localFluidNames;
fluidBlocks = null;
for (FluidDelegate fd : delegates.values())
{
fd.rebind();
}
}