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);
}
java类com.google.common.collect.HashBasedTable的实例源码
LayeredAnalysis.java 文件源码
项目:cheetah
阅读 33
收藏 0
点赞 0
评论 0
FhirStu3.java 文件源码
项目:synthea_java
阅读 26
收藏 0
点赞 0
评论 0
private static Table<String, String, String> loadSHRMapping() {
if (!USE_SHR_EXTENSIONS) {
// don't bother creating the table unless we need it
return null;
}
Table<String,String,String> mappingTable = HashBasedTable.create();
List<LinkedHashMap<String,String>> csvData;
try {
csvData = SimpleCSV.parse(Utilities.readResource("shr_mapping.csv"));
} catch (IOException e) {
e.printStackTrace();
return null;
}
for (LinkedHashMap<String,String> line : csvData) {
String system = line.get("SYSTEM");
String code = line.get("CODE");
String url = line.get("URL");
mappingTable.put(system, code, url);
}
return mappingTable;
}
MathUtil.java 文件源码
项目:powsybl-core
阅读 42
收藏 0
点赞 0
评论 0
public static Table<String, String, Float> parseMatrix(Reader reader) throws IOException {
Table<String, String, Float> table = HashBasedTable.create();
try (ICsvListReader csvReader = new CsvListReader(reader, CsvPreference.STANDARD_PREFERENCE)) {
List<String> columnHeaders = csvReader.read();
List<String> row;
while ((row = csvReader.read()) != null) {
String rowHeader = row.get(0);
for (int i = 1; i < row.size(); i++) {
String columnHeader = columnHeaders.get(i);
String value = row.get(i);
table.put(rowHeader, columnHeader, value == null ? Float.NaN : Float.parseFloat(value));
}
}
}
return table;
}
ConfigRestService.java 文件源码
项目:configx
阅读 36
收藏 0
点赞 0
评论 0
/**
* 将配置项构造成一个二维表,[配置名称, 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;
}
PlanGenerator.java 文件源码
项目:hue
阅读 52
收藏 0
点赞 0
评论 0
private List<OptimizedPlan> getPlansForDimensions() {
cm.sortForDimensions();
HashBasedTable<Table, Expressible, PlanPath> matrix = cm.getMatrix();
ArrayList<Table> sk = cm.getSortedKeys();
logger.debug(cm.toString());
List<Expressible> dims = matrix.columnKeySet().stream().filter((vn) -> {
return (vn instanceof Dimension);
}).collect(Collectors.toList());
OptimizedPlan op = new OptimizedPlan();
int count = 0;
double cost = 0;
for(Entry<Expressible, PlanPath> v : matrix.row(sk.get(0)).entrySet()){
dims.remove(v.getKey());
op.addPath(v.getValue());
cost += v.getValue().getCost();
count++;
}
op.setPlanCost(cost/count);
op.addDisjointedPlans(getDisjoinPlans(dims,op));
return Lists.newArrayList(op);
}
BlockState.java 文件源码
项目:DecompiledMinecraft
阅读 41
收藏 0
点赞 0
评论 0
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);
}
}
BlockState.java 文件源码
项目:DecompiledMinecraft
阅读 40
收藏 0
点赞 0
评论 0
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);
}
}
BlockState.java 文件源码
项目:BaseClient
阅读 49
收藏 0
点赞 0
评论 0
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);
}
}
BlockState.java 文件源码
项目:BaseClient
阅读 34
收藏 0
点赞 0
评论 0
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);
}
}
SparseTensor.java 文件源码
项目:MicroServiceProject
阅读 46
收藏 0
点赞 0
评论 0
/**
* 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);
}
MediaTypeClassifierBuilder.java 文件源码
项目:url-classifier
阅读 31
收藏 0
点赞 0
评论 0
MediaTypeClassifierImpl(Iterable<? extends MediaType> mts) {
Table<String, String, Set<MediaType>> typeTable =
HashBasedTable.<String, String, Set<MediaType>>create();
for (MediaType mt : mts) {
String type = mt.type();
String subtype = mt.subtype();
Set<MediaType> typeSet = typeTable.get(type, subtype);
if (typeSet == null) {
typeSet = Sets.newLinkedHashSet();
typeTable.put(type, subtype, typeSet);
}
typeSet.add(mt);
}
ImmutableTable.Builder<String, String, ImmutableSet<MediaType>> b =
ImmutableTable.builder();
for (Table.Cell<String, String, Set<MediaType>> cell
: typeTable.cellSet()) {
b.put(cell.getRowKey(), cell.getColumnKey(), ImmutableSet.copyOf(cell.getValue()));
}
this.types = b.build();
}
HashBasedTableDemo.java 文件源码
项目:cakes
阅读 44
收藏 0
点赞 0
评论 0
@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));
});
}
ImmutableCollectionSerializers.java 文件源码
项目:dremio-oss
阅读 33
收藏 0
点赞 0
评论 0
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);
}
BlockStateContainer.java 文件源码
项目:CustomWorldGen
阅读 33
收藏 0
点赞 0
评论 0
public void buildPropertyValueTable(Map < Map < IProperty<?>, Comparable<? >> , BlockStateContainer.StateImplementation > map)
{
if (this.propertyValueTable != null)
{
throw new IllegalStateException();
}
else
{
Table < IProperty<?>, Comparable<?>, IBlockState > table = HashBasedTable. < IProperty<?>, Comparable<?>, IBlockState > create();
for (Entry < IProperty<?>, Comparable<? >> entry : this.properties.entrySet())
{
IProperty<?> iproperty = (IProperty)entry.getKey();
for (Comparable<?> comparable : iproperty.getAllowedValues())
{
if (comparable != entry.getValue())
{
table.put(iproperty, comparable, map.get(this.getPropertiesWithValue(iproperty, comparable)));
}
}
}
this.propertyValueTable = ImmutableTable. < IProperty<?>, Comparable<?>, IBlockState > copyOf(table);
}
}
ClassifierPredictor.java 文件源码
项目:bioasq
阅读 29
收藏 0
点赞 0
评论 0
@Override
public void initialize(UimaContext context) throws ResourceInitializationException {
super.initialize(context);
String candidateProviderName = UimaContextHelper
.getConfigParameterStringValue(context, "candidate-provider");
candidateProvider = ProviderCache.getProvider(candidateProviderName, CandidateProvider.class);
String scorerNames = UimaContextHelper.getConfigParameterStringValue(context, "scorers");
scorers = ProviderCache.getProviders(scorerNames, Scorer.class).stream()
.map(scorer -> (Scorer<? super T>) scorer).collect(toList());
String classifierName = UimaContextHelper.getConfigParameterStringValue(context, "classifier");
classifier = ProviderCache.getProvider(classifierName, ClassifierProvider.class);
if ((featureFilename = UimaContextHelper.getConfigParameterStringValue(context, "feature-file",
null)) != null) {
feat2value = HashBasedTable.create();
}
}
CVPredictLoader.java 文件源码
项目:bioasq
阅读 35
收藏 0
点赞 0
评论 0
@Override
public void initialize(UimaContext context) throws ResourceInitializationException {
super.initialize(context);
String candidateProviderName = UimaContextHelper
.getConfigParameterStringValue(context, "candidate-provider");
candidateProvider = ProviderCache.getProvider(candidateProviderName, CandidateProvider.class);
// load cv
String cvPredictFile = UimaContextHelper.getConfigParameterStringValue(context,
"cv-predict-file");
List<String> lines;
try {
lines = Resources.readLines(getClass().getResource(cvPredictFile), Charsets.UTF_8);
} catch (IOException e) {
throw new ResourceInitializationException(e);
}
qid2uri2score = HashBasedTable.create();
lines.stream().map(line -> line.split("\t"))
.forEach(segs -> qid2uri2score.put(segs[0], segs[1], Double.parseDouble(segs[2])));
}
TableSynthesis.java 文件源码
项目:asglogic
阅读 29
收藏 0
点赞 0
评论 0
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);
}
ChunkLoader.java 文件源码
项目:factions-top
阅读 37
收藏 0
点赞 0
评论 0
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;
}
ChunkLoader.java 文件源码
项目:factions-top
阅读 40
收藏 0
点赞 0
评论 0
private Table<Integer, EntityType, Integer> loadChunkSpawner() throws SQLException {
Table<Integer, EntityType, Integer> target = HashBasedTable.create();
ResultSet resultSet = selectChunkSpawner.executeQuery();
while (resultSet.next()) {
int id = resultSet.getInt("id");
int chunkId = resultSet.getInt("chunk_id");
int spawnerId = resultSet.getInt("spawner_id");
int count = resultSet.getInt("count");
identityCache.setChunkSpawnerId(chunkId, spawnerId, id);
identityCache.getSpawner(spawnerId).ifPresent(spawner ->
target.put(chunkId, spawner, count));
}
resultSet.close();
return target;
}
ChunkLoader.java 文件源码
项目:factions-top
阅读 35
收藏 0
点赞 0
评论 0
private Table<Integer, WorthType, Double> loadChunkWorth() throws SQLException {
Table<Integer, WorthType, Double> target = HashBasedTable.create();
ResultSet resultSet = selectChunkWorth.executeQuery();
while (resultSet.next()) {
int id = resultSet.getInt("id");
int chunkId = resultSet.getInt("chunk_id");
int worthId = resultSet.getInt("worth_id");
double worth = resultSet.getDouble("worth");
identityCache.setChunkWorthId(chunkId, worthId, id);
identityCache.getWorthType(worthId).ifPresent(worthType ->
target.put(chunkId, worthType, worth));
}
resultSet.close();
return target;
}
RedisPermissionsRepository.java 文件源码
项目:fiat
阅读 31
收藏 0
点赞 0
评论 0
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;
}
RunningContainers.java 文件源码
项目:twill
阅读 39
收藏 0
点赞 0
评论 0
RunningContainers(TwillRuntimeSpecification twillRuntimeSpec, String appId, TwillRunResources appMasterResources,
ZKClient zookeeperClient, Location applicationLocation,
Map<String, RuntimeSpecification> runnables,
EventHandler eventHandler) {
containers = HashBasedTable.create();
runnableInstances = Maps.newHashMap();
completedContainerCount = Maps.newHashMap();
startSequence = Lists.newLinkedList();
containerLock = new ReentrantLock();
containerChange = containerLock.newCondition();
resourceReport = new DefaultResourceReport(appId, appMasterResources);
zkClient = zookeeperClient;
containerStats = HashMultimap.create();
this.applicationLocation = applicationLocation;
this.runnableNames = runnables.keySet();
this.logLevels = new TreeMap<>();
this.maxRetries = Maps.newHashMap(twillRuntimeSpec.getMaxRetries());
this.numRetries = Maps.newHashMap();
this.eventHandler = eventHandler;
}
YarnTwillRunnerService.java 文件源码
项目:twill
阅读 47
收藏 0
点赞 0
评论 0
/**
* 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();
}
};
}
ExcelImages.java 文件源码
项目:excel2javabeans
阅读 43
收藏 0
点赞 0
评论 0
private static Table<Integer, Integer, ImageData> readAllCellImages(HSSFPatriarch patriarch, Sheet sheet) {
val images = HashBasedTable.<Integer, Integer, ImageData>create();
val allPictures = sheet.getWorkbook().getAllPictures();
for (val shape : patriarch.getChildren()) {
if (!(shape instanceof HSSFPicture && shape.getAnchor() instanceof HSSFClientAnchor)) continue;
val picture = (HSSFPicture) shape;
val imageData = createImageData(allPictures.get(picture.getPictureIndex() - 1));
val axisRow = computeAxisRowIndex(sheet, picture);
val axisCol = computeAxisColIndex(sheet, picture);
images.put(axisRow, axisCol, imageData);
}
return images;
}
ExcelImages.java 文件源码
项目:excel2javabeans
阅读 37
收藏 0
点赞 0
评论 0
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;
}
GenderProvider.java 文件源码
项目:hybris-connector
阅读 31
收藏 0
点赞 0
评论 0
@Override
protected HashBasedTable<Optional<String>, Optional<Locale>, String> getAttributeValue(final Collection<Locale> locales,
final ProductModel product, final MetaAttributeData metaAttribute)
{
final HashBasedTable<Optional<String>, Optional<Locale>, String> table = HashBasedTable.create();
if (product instanceof ApparelProductModel)
{
final List<Gender> genders = ((ApparelProductModel) product).getGenders();
if (genders != null && !genders.isEmpty())
{
for (final Gender gender : genders)
{
addValues(table, null, gender.getCode(), metaAttribute);
}
}
}
return table;
}
AbstractAttributeProvider.java 文件源码
项目:hybris-connector
阅读 31
收藏 0
点赞 0
评论 0
@Override
public Collection<FhAttributeData> getAttribute(final ProductModel product, final MetaAttributeData metaAttribute,
final Collection<Locale> locales)
{
final HashBasedTable<Optional<String>, Optional<Locale>, String> values = getAttributeValue(locales, product,
metaAttribute);
if (values != null && !values.isEmpty())
{
final FhAttributeData attributeData = new FhAttributeData(metaAttribute.getBaseType());
attributeData.setAttributeId(metaAttribute.getAttributeId());
attributeData.setItemId(getSanitizeIdStrategy().sanitizeId(product.getCode()));
attributeData.setValues(values);
return Arrays.asList(attributeData);
}
return Collections.emptyList();
}
ImageUrlProvider.java 文件源码
项目:hybris-connector
阅读 30
收藏 0
点赞 0
评论 0
@Override
protected HashBasedTable<Optional<String>, Optional<Locale>, String> getAttributeValue(final Collection<Locale> locales,
final ProductModel product, final MetaAttributeData metaAttribute)
{
final HashBasedTable<Optional<String>, Optional<Locale>, String> table = HashBasedTable.create();
final MediaFormatModel mediaFormatModel = getMediaService().getFormat(getMediaFormat());
if (mediaFormatModel != null)
{
final MediaModel media = findMedia(product, mediaFormatModel);
if (media != null)
{
addValues(table, null, media.getURL(), metaAttribute);
}
}
return table;
}
SQLInjectionRepositoryH2.java 文件源码
项目:SQLIDetectionDriver
阅读 58
收藏 0
点赞 0
评论 0
@Override
public Collection<SQLInjectionAnalyzerEntry> getEntries() throws IOException {
failIfClosed();
List<SQLInjectionAnalyzerEntry> uncombinedEntries = getUncombinedEntriesFromDB();
Table<String, String, SQLInjectionAnalyzerEntry> buffer = HashBasedTable.create();
uncombinedEntries.stream()
.forEach((e) -> {
SQLInjectionAnalyzerEntry oldEntry = buffer.get(e.getEntryPoint(), e.getStatement());
if (oldEntry != null) {
oldEntry.mergeStatementCall(e);
} else {
buffer.put(e.getEntryPoint(), e.getStatement(), e);
}
});
return Collections.unmodifiableCollection(buffer.values());
}
ApexStateInternals.java 文件源码
项目:beam
阅读 26
收藏 0
点赞 0
评论 0
@Override
public ApexStateInternals<K> stateInternalsForKey(K key) {
final Slice keyBytes;
try {
keyBytes = (key != null) ? new Slice(CoderUtils.encodeToByteArray(keyCoder, key)) :
new Slice(null);
} catch (CoderException e) {
throw new RuntimeException(e);
}
HashBasedTable<String, String, byte[]> stateTable = perKeyState.get(keyBytes);
if (stateTable == null) {
stateTable = HashBasedTable.create();
perKeyState.put(keyBytes, stateTable);
}
return new ApexStateInternals<>(key, stateTable);
}