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


Java HashBasedTable类代码示例

本文整理汇总了Java中com.google.common.collect.HashBasedTable的典型用法代码示例。如果您正苦于以下问题:Java HashBasedTable类的具体用法?Java HashBasedTable怎么用?Java HashBasedTable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: loadSHRMapping

import com.google.common.collect.HashBasedTable; //导入依赖的package包/类
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;
}
 
开发者ID:synthetichealth,项目名称:synthea_java,代码行数:26,代码来源:FhirStu3.java

示例2: 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);
}
 
开发者ID:secure-software-engineering,项目名称:cheetah,代码行数:17,代码来源:LayeredAnalysis.java

示例3: parseMatrix

import com.google.common.collect.HashBasedTable; //导入依赖的package包/类
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;
}
 
开发者ID:powsybl,项目名称:powsybl-core,代码行数:17,代码来源:MathUtil.java

示例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;
}
 
开发者ID:zouzhirong,项目名称:configx,代码行数:22,代码来源:ConfigRestService.java

示例5: getPlansForDimensions

import com.google.common.collect.HashBasedTable; //导入依赖的package包/类
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);
}
 
开发者ID:ajoabraham,项目名称:hue,代码行数:26,代码来源:PlanGenerator.java

示例6: 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);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:25,代码来源:BlockState.java

示例7: 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);
}
 
开发者ID:xiaojieliu7,项目名称:MicroServiceProject,代码行数:22,代码来源:SparseTensor.java

示例8: MediaTypeClassifierImpl

import com.google.common.collect.HashBasedTable; //导入依赖的package包/类
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();
}
 
开发者ID:OWASP,项目名称:url-classifier,代码行数:23,代码来源:MediaTypeClassifierBuilder.java

示例9: 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));
    });
}
 
开发者ID:cbooy,项目名称:cakes,代码行数:21,代码来源:HashBasedTableDemo.java

示例10: 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);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:17,代码来源:ImmutableCollectionSerializers.java

示例11: buildPropertyValueTable

import com.google.common.collect.HashBasedTable; //导入依赖的package包/类
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);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:27,代码来源:BlockStateContainer.java

示例12: initialize

import com.google.common.collect.HashBasedTable; //导入依赖的package包/类
@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();
  }
}
 
开发者ID:oaqa,项目名称:bioasq,代码行数:17,代码来源:ClassifierPredictor.java

示例13: initialize

import com.google.common.collect.HashBasedTable; //导入依赖的package包/类
@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])));
}
 
开发者ID:oaqa,项目名称:bioasq,代码行数:20,代码来源:CVPredictLoader.java

示例14: 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);
}
 
开发者ID:hpiasg,项目名称:asglogic,代码行数:20,代码来源:TableSynthesis.java

示例15: 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;
}
 
开发者ID:novucs,项目名称:factions-top,代码行数:19,代码来源:ChunkLoader.java


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