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


Java Table类代码示例

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


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

示例1: loadSHRMapping

import com.google.common.collect.Table; //导入依赖的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: parseMatrix

import com.google.common.collect.Table; //导入依赖的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

示例3: groupByProfile

import com.google.common.collect.Table; //导入依赖的package包/类
/**
 * 根据Profile分组,同名配置,根据Profile的优先级覆盖
 *
 * @param configItemList
 * @param profileIdList
 * @return
 */
private List<BuildConfigItem> groupByProfile(List<BuildConfigItem> configItemList, List<Integer> profileIdList) {
    List<BuildConfigItem> filteredConfigItemList = new ArrayList<>();

    Table<String, Integer, List<BuildConfigItem>> configItemTable = getConfigItemTable(configItemList);

    for (String itemName : configItemTable.rowKeySet()) {
        for (int profileId : profileIdList) {
            List<BuildConfigItem> itemList = configItemTable.get(itemName, profileId);
            if (itemList != null && !itemList.isEmpty()) {
                filteredConfigItemList.addAll(itemList);
                break;
            }
        }
    }

    return filteredConfigItemList;
}
 
开发者ID:zouzhirong,项目名称:configx,代码行数:25,代码来源:ConfigRestService.java

示例4: getConfigItemTable

import com.google.common.collect.Table; //导入依赖的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: buildPropertyValueTable

import com.google.common.collect.Table; //导入依赖的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

示例6: storeExternalCommunicatorMessage

import com.google.common.collect.Table; //导入依赖的package包/类
@Override
public void storeExternalCommunicatorMessage(final ExternalCommunicatorMessage message) {
  final String[] split = message.getTransferId().split("-");
  final Long piID = Long.valueOf(split[PI_ID_INDEX]);
  final Long mfId = Long.valueOf(split[MF_ID_INDEX]);
  final Long sId = Long.valueOf(split[S_ID_INDEX]);

  final ProcessInstance processInstance = processInstanceRepository.findOne(piID);
  final MessageFlow messageFlow = Optional.ofNullable(messageFlowRepository.findOne(mfId))
      .orElseThrow(() -> new IllegalArgumentException(
          "Could not find message flow for MF_ID [" + mfId + "]"));

  final Set<BusinessObjectInstance> businessObjectInstances =
      getBusinessObjectInstances(processInstance, messageFlow.getBusinessObjectModels());

  final Table<String, String, BusinessObjectField> records =
      convertToMap(message.getBusinessObjects());

  businessObjectInstances.stream()
      .forEachOrdered(objectInstance -> storeValues(records, objectInstance));

  final Subject subject = subjectRepository.findOne(sId);
  subject.getSubjectState().setToReceived(messageFlow);
  subjectRepository.save((SubjectImpl) subject);
}
 
开发者ID:stefanstaniAIM,项目名称:IPPR2016,代码行数:26,代码来源:ProcessEngineFeignServiceImpl.java

示例7: getReader

import com.google.common.collect.Table; //导入依赖的package包/类
private ReliableTaildirEventReader getReader(Map<String, String> filePaths,
    Table<String, String, String> headerTable, boolean addByteOffset) {
  ReliableTaildirEventReader reader;
  try {
    reader = new ReliableTaildirEventReader.Builder()
        .filePaths(filePaths)
        .headerTable(headerTable)
        .positionFilePath(posFilePath)
        .skipToEnd(false)
        .addByteOffset(addByteOffset)
        .build();
    reader.updateTailFiles();
  } catch (IOException ioe) {
    throw Throwables.propagate(ioe);
  }
  return reader;
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:18,代码来源:TestTaildirEventReader.java

示例8: rateMatrix

import com.google.common.collect.Table; //导入依赖的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

示例9: assignmentsToTable

import com.google.common.collect.Table; //导入依赖的package包/类
public static Table<String, String, String> assignmentsToTable(
        SortedMap<String, SortedSet<SingleWorkerAssignment<Step2bGoldReasonAnnotator.SentenceLabel>>> assignments)
{
    TreeBasedTable<String, String, String> result = TreeBasedTable.create();

    assignments.forEach((unitID, singleWorkerAssignments) -> {
        singleWorkerAssignments.forEach(sentenceLabelSingleWorkerAssignment -> {
            String workerID = sentenceLabelSingleWorkerAssignment.getWorkerID();
            String label = sentenceLabelSingleWorkerAssignment.getLabel().toString();

            // update the table
            result.put(unitID, workerID, label);
        });
    });

    return result;
}
 
开发者ID:UKPLab,项目名称:argument-reasoning-comprehension-task,代码行数:18,代码来源:Step2dExportReasonSpanAnnotationPilot.java

示例10: MediaTypeClassifierImpl

import com.google.common.collect.Table; //导入依赖的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

示例11: ReliableTaildirEventReader

import com.google.common.collect.Table; //导入依赖的package包/类
/**
 * Create a ReliableTaildirEventReader to watch the given directory. map<serverid.appid.logid, logpath>
 */
private ReliableTaildirEventReader(Map<String, LogPatternInfo> filePaths, Table<String, String, String> headerTable,
        String positionFilePath, boolean skipToEnd, boolean addByteOffset, String os) throws IOException {
    // Sanity checks
    Preconditions.checkNotNull(filePaths);
    Preconditions.checkNotNull(positionFilePath);
    // get operation system info
    if (logger.isDebugEnable()) {
        logger.debug(this, "Initializing {" + ReliableTaildirEventReader.class.getSimpleName()
                + "} with directory={" + filePaths + "}");
    }

    // tailFile
    this.tailFileTable = CacheBuilder.newBuilder().expireAfterWrite(2, TimeUnit.DAYS)
            .<String, LogPatternInfo> build();
    this.headerTable = headerTable;
    this.addByteOffset = addByteOffset;
    this.os = os;
    updatelog(filePaths);
    updateTailFiles(skipToEnd);

    logger.info(this, "tailFileTable: " + tailFileTable.toString());
    logger.info(this, "headerTable: " + headerTable.toString());
    logger.info(this, "Updating position from position file: " + positionFilePath);
    loadPositionFile(positionFilePath);
}
 
开发者ID:uavorg,项目名称:uavstack,代码行数:29,代码来源:ReliableTaildirEventReader.java

示例12: ReliableTaildirEventReader

import com.google.common.collect.Table; //导入依赖的package包/类
/**
 * Create a ReliableTaildirEventReader to watch the given directory. map<serverid.appid.logid, logpath>
 */
private ReliableTaildirEventReader(Map<String, CollectTask> tasks, Table<String, String, String> headerTable,
        boolean skipToEnd, boolean addByteOffset) throws IOException {
    Map<String, LogPatternInfo> filePaths = getFilePaths(tasks);

    // Sanity checks
    Preconditions.checkNotNull(filePaths);
    // get operation system info
    if (log.isDebugEnable()) {
        log.debug(this, "Initializing {" + ReliableTaildirEventReader.class.getSimpleName() + "} with directory={"
                + filePaths + "}");
    }

    // tailFile
    this.tailFileTable = CacheBuilder.newBuilder().expireAfterWrite(2, TimeUnit.DAYS)
            .<String, LogPatternInfo> build();
    this.headerTable = headerTable;
    this.addByteOffset = addByteOffset;
    this.os = JVMToolHelper.isWindows() ? OS_WINDOWS : null;

    updatelog(filePaths);
    updateTailFiles(skipToEnd);

    log.info(this, "tailFileTable: " + tailFileTable.toString());
    log.info(this, "headerTable: " + headerTable.toString());
}
 
开发者ID:uavorg,项目名称:uavstack,代码行数:29,代码来源:ReliableTaildirEventReader.java

示例13: buildPropertyValueTable

import com.google.common.collect.Table; //导入依赖的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

示例14: main

import com.google.common.collect.Table; //导入依赖的package包/类
public static void main(String[] args) {
    TreeBasedTable<Integer, Integer, Integer> table = TreeBasedTable.create();

    table.put(2, 0, 6);
    table.put(3, 2, 4);
    table.put(0, 0, 5);
    table.put(0, 3, 2);
    table.put(4, 1, 2);
    table.put(4, 4, 9);


    CSRSparseMatrix csr = new CSRSparseMatrix(table, 5);

    for (Table.Cell<Integer, Integer, Integer> cell : table.cellSet()) {
        if (csr.get(cell.getRowKey(), cell.getColumnKey()) == cell.getValue()) {
            System.out.println(String.format("%d->%d = %d", cell.getRowKey(), cell.getColumnKey(), cell.getValue()));
        } else {
            System.out.println("ERROR");
        }
    }


}
 
开发者ID:mayabot,项目名称:mynlp,代码行数:24,代码来源:CSRSparseMatrix.java

示例15: main

import com.google.common.collect.Table; //导入依赖的package包/类
public static void main(String[] args)
{
   Table<String, String, String> table = TreeBasedTable.create();

   table.put("Row1", "Column1", "Data1");
   table.put("Row1", "Column2", "Data2");

   table.put("Row2", "Column1", "Data3");
   table.put("Row2", "Column2", "Data4");

   table.put("Row3", "Column1", "Data5");
   table.put("Row3", "Column2", "Data6");
   table.put("Row3", "Column3", "Data7");

   Joiner.MapJoiner mapJoiner = Joiner.on(',').withKeyValueSeparator("="); //Let's a Guava Joiner to illustrate that

   table.rowKeySet().forEach(r -> {
      System.out.println(r + "->" + mapJoiner.join(table.row(r)));
   });
}
 
开发者ID:developerSid,项目名称:AwesomeJavaLibraryExamples,代码行数:21,代码来源:ExampleTable.java


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