本文整理汇总了Java中com.google.common.collect.HashBasedTable.create方法的典型用法代码示例。如果您正苦于以下问题:Java HashBasedTable.create方法的具体用法?Java HashBasedTable.create怎么用?Java HashBasedTable.create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.HashBasedTable
的用法示例。
在下文中一共展示了HashBasedTable.create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initIFDS
import com.google.common.collect.HashBasedTable; //导入方法依赖的package包/类
private void initIFDS() {
Scene.v().setCallGraph(new CallGraph());
this.jumpFunctions = new JumpFunctions<Unit, FlowAbstraction, IFDSSolver.BinaryDomain>(IFDSSolver.getAllTop());
this.endSum = HashBasedTable.create();
this.inc = HashBasedTable.create();
this.icfg = new JitIcfg(new ArrayList<SootMethod>()) {
@Override
public Set<SootMethod> getCalleesOfCallAt(Unit u) {
if (currentTask != null)
return currentTask.calleesOfCallAt(u);
else // Empty by default (same behaviour as L1)
return new HashSet<SootMethod>();
}
};
this.reporter.setIFDS(icfg, jumpFunctions);
}
示例2: rateMatrix
import com.google.common.collect.HashBasedTable; //导入方法依赖的package包/类
/**
* retrieve a rating matrix from the tensor. Warning: it assumes there is at most one entry for each (user, item)
* pair.
*
* @return a sparse rating matrix
*/
public SparseMatrix rateMatrix() {
Table<Integer, Integer, Double> dataTable = HashBasedTable.create();
Multimap<Integer, Integer> colMap = HashMultimap.create();
for (TensorEntry te : this) {
int u = te.key(userDimension);
int i = te.key(itemDimension);
dataTable.put(u, i, te.get());
colMap.put(i, u);
}
return new SparseMatrix(dimensions[userDimension], dimensions[itemDimension], dataTable, colMap);
}
示例3: register
import com.google.common.collect.HashBasedTable; //导入方法依赖的package包/类
public static void register(final Kryo kryo) {
// register list
final ImmutableListSerializer serializer = new ImmutableListSerializer();
kryo.register(ImmutableList.class, serializer);
kryo.register(ImmutableList.of().getClass(), serializer);
kryo.register(ImmutableList.of(Integer.valueOf(1)).getClass(), serializer);
kryo.register(ImmutableList.of(Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(3)).subList(1, 2).getClass(), serializer);
kryo.register(ImmutableList.of().reverse().getClass(), serializer);
kryo.register(Lists.charactersOf("dremio").getClass(), serializer);
final HashBasedTable baseTable = HashBasedTable.create();
baseTable.put(Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(3));
baseTable.put(Integer.valueOf(4), Integer.valueOf(5), Integer.valueOf(6));
ImmutableTable table = ImmutableTable.copyOf(baseTable);
kryo.register(table.values().getClass(), serializer);
}
示例4: getConfigItemTable
import com.google.common.collect.HashBasedTable; //导入方法依赖的package包/类
/**
* 将配置项构造成一个二维表,[配置名称, Profile ID, 配置项]
*
* @param configItemList
* @return
*/
private Table<String, Integer, List<BuildConfigItem>> getConfigItemTable(List<BuildConfigItem> configItemList) {
Table<String, Integer, List<BuildConfigItem>> configItemTable = HashBasedTable.create();
List<BuildConfigItem> listByNameAndProfile = null;
for (BuildConfigItem configItem : configItemList) {
listByNameAndProfile = configItemTable.get(configItem.getConfigName(), configItem.getProfileId());
if (listByNameAndProfile == null) {
listByNameAndProfile = new ArrayList<>();
configItemTable.put(configItem.getConfigName(), configItem.getProfileId(), listByNameAndProfile);
}
listByNameAndProfile.add(configItem);
}
return configItemTable;
}
示例5: buildPropertyValueTable
import com.google.common.collect.HashBasedTable; //导入方法依赖的package包/类
public void buildPropertyValueTable(Map<Map<IProperty, Comparable>, BlockState.StateImplementation> map)
{
if (this.propertyValueTable != null)
{
throw new IllegalStateException();
}
else
{
Table<IProperty, Comparable, IBlockState> table = HashBasedTable.<IProperty, Comparable, IBlockState>create();
for (IProperty <? extends Comparable > iproperty : this.properties.keySet())
{
for (Comparable comparable : iproperty.getAllowedValues())
{
if (comparable != this.properties.get(iproperty))
{
table.put(iproperty, comparable, map.get(this.getPropertiesWithValue(iproperty, comparable)));
}
}
}
this.propertyValueTable = ImmutableTable.<IProperty, Comparable, IBlockState>copyOf(table);
}
}
示例6: testCreate
import com.google.common.collect.HashBasedTable; //导入方法依赖的package包/类
@Test
public void testCreate() {
HashBasedTable<String, String, String> table = HashBasedTable.create();
table.put("cbooy", "vm", "10.94.97.94");
table.put("cbooy", "name", "haoc");
table.put("hello", "name", "hi");
table.put("hello", "vm", "10999");
System.out.println(table);
// 遍历
table.cellSet().forEach(cell -> {
String columnKey = cell.getColumnKey();
String rowKey = cell.getRowKey();
String value = cell.getValue();
System.out.println(String.format("%s-%s-%s", rowKey, columnKey, value));
});
}
示例7: AverageTraceWeighter
import com.google.common.collect.HashBasedTable; //导入方法依赖的package包/类
/**
* Create a weighter (average values) given the network weights
*
* @param networkWeights
*/
public AverageTraceWeighter(NetworkWeight networkWeights) {
this.networkWeights = networkWeights;
weightTable = HashBasedTable.create();
varianceTable = HashBasedTable.create();
for (Cell<String, String, ClockCycles> cell : networkWeights.asTable().cellSet()) {
String actor = cell.getRowKey();
String action = cell.getColumnKey();
ClockCycles w = cell.getValue();
double avg = w.getMeanClockCycles();
double min = Math.min(w.getMinClockCycles(), avg);
double max = Math.max(avg, w.getMaxClockCycles());
double variance = Math.pow(((max - min) / 6.0), 2);
weightTable.put(actor, action, avg);
varianceTable.put(actor, action, variance);
}
}
示例8: createEspressoTable
import com.google.common.collect.HashBasedTable; //导入方法依赖的package包/类
protected EspressoTable createEspressoTable() {
int num = stategraph.getAllSignals().size();
if(resetname != null) {
num++;
}
int i = 0;
String[] inputs = new String[num];
if(resetname != null) {
inputs[i++] = resetname;
}
for(Signal sig : stategraph.getAllSignals()) {
inputs[i++] = sig.getName();
}
Table<EspressoTerm, String, EspressoValue> table = HashBasedTable.create();
fillTable(num, inputs, table);
return new EspressoTable(inputs, table);
}
示例9: loadChunkMaterial
import com.google.common.collect.HashBasedTable; //导入方法依赖的package包/类
private Table<Integer, Material, Integer> loadChunkMaterial() throws SQLException {
Table<Integer, Material, Integer> target = HashBasedTable.create();
ResultSet resultSet = selectChunkMaterial.executeQuery();
while (resultSet.next()) {
int id = resultSet.getInt("id");
int chunkId = resultSet.getInt("chunk_id");
int materialId = resultSet.getInt("material_id");
int count = resultSet.getInt("count");
identityCache.setChunkMaterialId(chunkId, materialId, id);
identityCache.getMaterial(materialId).ifPresent(material ->
target.put(chunkId, material, count));
}
resultSet.close();
return target;
}
示例10: getAllFromRedis
import com.google.common.collect.HashBasedTable; //导入方法依赖的package包/类
private Table<String, ResourceType, Response<Map<String, String>>> getAllFromRedis(Set<String> userIds) {
if (userIds.size() == 0) {
return HashBasedTable.create();
}
try (Jedis jedis = jedisSource.getJedis()) {
Table<String, ResourceType, Response<Map<String, String>>> responseTable =
ArrayTable.create(userIds, new ArrayIterator<>(ResourceType.values()));
Pipeline p = jedis.pipelined();
for (String userId : userIds) {
for (ResourceType r : ResourceType.values()) {
responseTable.put(userId, r, p.hgetAll(userKey(userId, r)));
}
}
p.sync();
return responseTable;
} catch (Exception e) {
log.error("Storage exception reading all entries.", e);
}
return null;
}
示例11: combineStrandJunctionsMaps
import com.google.common.collect.HashBasedTable; //导入方法依赖的package包/类
/**
* Combine junctions from both strands. Used for Sashimi plot.
* Note: Flanking depth arrays are not combined.
*/
private List<SpliceJunctionFeature> combineStrandJunctionsMaps() {
// Start with all + junctions
Table<Integer, Integer, SpliceJunctionFeature> combinedStartEndJunctionsMap = HashBasedTable.create(posStartEndJunctionsMap);
// Merge in - junctions
for (Table.Cell<Integer, Integer, SpliceJunctionFeature> negJunctionCell : negStartEndJunctionsMap.cellSet()) {
int junctionStart = negJunctionCell.getRowKey();
int junctionEnd = negJunctionCell.getColumnKey();
SpliceJunctionFeature negFeat = negJunctionCell.getValue();
SpliceJunctionFeature junction = combinedStartEndJunctionsMap.get(junctionStart, junctionEnd);
if (junction == null) {
// No existing (+) junction here, just add the (-) one\
combinedStartEndJunctionsMap.put(junctionStart, junctionEnd, negFeat);
} else {
int newJunctionDepth = junction.getJunctionDepth() + negFeat.getJunctionDepth();
junction.setJunctionDepth(newJunctionDepth);
}
}
return new ArrayList<SpliceJunctionFeature>(combinedStartEndJunctionsMap.values());
}
示例12: YarnTwillRunnerService
import com.google.common.collect.HashBasedTable; //导入方法依赖的package包/类
/**
* Creates an instance.
*
* @param config Configuration of the yarn cluster
* @param zkConnect ZooKeeper connection string
* @param locationFactory Factory to create {@link Location} instances that are readable and writable by this service
*/
public YarnTwillRunnerService(YarnConfiguration config, String zkConnect, LocationFactory locationFactory) {
this.yarnConfig = config;
this.locationFactory = locationFactory;
this.zkClientService = getZKClientService(zkConnect);
this.controllers = HashBasedTable.create();
this.serviceDelegate = new AbstractIdleService() {
@Override
protected void startUp() throws Exception {
YarnTwillRunnerService.this.startUp();
}
@Override
protected void shutDown() throws Exception {
YarnTwillRunnerService.this.shutDown();
}
};
}
示例13: NormalDistributionTraceWeighter
import com.google.common.collect.HashBasedTable; //导入方法依赖的package包/类
/**
* Create a normal distribution weighter given the network weights
*
* @param networkWeights
*/
public NormalDistributionTraceWeighter(NetworkWeight networkWeights) {
this.networkWeights = networkWeights;
weightTable = HashBasedTable.create();
varianceTable = HashBasedTable.create();
for (Cell<String, String, ClockCycles> cell : networkWeights.asTable().cellSet()) {
String actor = cell.getRowKey();
String action = cell.getColumnKey();
ClockCycles w = cell.getValue();
double avg = w.getMeanClockCycles();
double min = Math.min(w.getMinClockCycles(), avg);
double max = Math.max(avg, w.getMaxClockCycles());
double weight = (min + 4 * avg + max) / 6.0;
double variance = Math.pow(((max - min) / 6.0), 2);
weightTable.put(actor, action, weight);
varianceTable.put(actor, action, variance);
}
}
示例14: readAllCellImages
import com.google.common.collect.HashBasedTable; //导入方法依赖的package包/类
private static Table<Integer, Integer, ImageData> readAllCellImages(XSSFDrawing drawing, Sheet sheet) {
val images = HashBasedTable.<Integer, Integer, ImageData>create();
for (val shape : drawing.getShapes()) {
if (!(shape instanceof XSSFPicture)) continue;
val picture = (XSSFPicture) shape;
val imageData = createImageData(picture.getPictureData());
val axisRow = computeAxisRowIndex(sheet, picture);
val axisCol = computeAxisColIndex(sheet, picture);
images.put(axisRow, axisCol, imageData);
}
return images;
}
示例15: PatternStatsCalculator
import com.google.common.collect.HashBasedTable; //导入方法依赖的package包/类
public PatternStatsCalculator(final AbstractJavaTreeExtractor treeFormat,
final Set<TreeNode<Integer>> patterns, final File directory) {
this.treeFormat = treeFormat;
this.patterns = HashMultiset.create(patterns);
int currentIdx = 0;
for (final Multiset.Entry<TreeNode<Integer>> rule : this.patterns
.entrySet()) {
patternDictionary.put(rule.getElement(), currentIdx);
patternSizes.put(currentIdx, rule.getElement().getTreeSize());
currentIdx++;
}
allFiles = FileUtils
.listFiles(directory, JavaTokenizer.javaCodeFileFilter,
DirectoryFileFilter.DIRECTORY);
fileSizes = new MapMaker()
.concurrencyLevel(ParallelThreadPool.NUM_THREADS)
.initialCapacity(allFiles.size()).makeMap();
filePatterns = HashBasedTable.create(allFiles.size(),
patterns.size() / 10);
filePatternsCount = HashBasedTable.create(allFiles.size(),
patterns.size() / 1);
}