當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。