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


Java Table.rowKeySet方法代码示例

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


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

示例1: 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

示例2: getAllById

import com.google.common.collect.Table; //导入方法依赖的package包/类
@Override
public Map<String, UserPermission> getAllById() {
  Table<String, ResourceType, Response<Map<String, String>>> responseTable = getAllFromRedis();
  if (responseTable == null) {
    return new HashMap<>(0);
  }

  Map<String, UserPermission> allById = new HashMap<>(responseTable.rowKeySet().size());

  RawUserPermission rawUnrestricted = new RawUserPermission(responseTable.row(UNRESTRICTED));
  UserPermission unrestrictedUser = getUserPermission(UNRESTRICTED, rawUnrestricted);

  for (String userId : responseTable.rowKeySet()) {
    RawUserPermission rawUser = new RawUserPermission(responseTable.row(userId));
    UserPermission permission = getUserPermission(userId, rawUser);
    allById.put(userId, permission.merge(unrestrictedUser));
  }
  return allById;
}
 
开发者ID:spinnaker,项目名称:fiat,代码行数:20,代码来源:RedisPermissionsRepository.java

示例3: hasValidValueId

import com.google.common.collect.Table; //导入方法依赖的package包/类
@Override
protected boolean hasValidValueId(final FhAttributeData attribute, final List<Violation> violations)
{
	final Table<Optional<String>, Optional<Locale>, String> values = attribute.getValues();
	for (final Optional<String> optional : values.rowKeySet())
	{
		final String key = optional == null || !optional.isPresent() ? "_absent_" : optional.get();
		if (!key.matches(VALUE_ID_PATTERN))
		{
			rejectValue(attribute, violations,
					"The \"set\" attribute valueId key \"" + key + "\" does not match the appropriate pattern.");
			return false;
		}
	}
	return true;
}
 
开发者ID:fredhopper,项目名称:hybris-connector,代码行数:17,代码来源:SetAttributeValidator.java

示例4: validateValue

import com.google.common.collect.Table; //导入方法依赖的package包/类
@Override
protected void validateValue(final FhAttributeData attribute,
		final List<com.fredhopper.core.connector.index.report.Violation> violations)
{
	final Table<Optional<String>, Optional<Locale>, String> values = attribute.getValues();
	for (final Optional<String> valueId : values.rowKeySet())
	{
		final Map<Optional<Locale>, String> valueMap = values.row(valueId);
		if (CollectionUtils.isEmpty(valueMap) || valueMap.containsKey(Optional.empty()) || valueMap.containsKey(null))
		{
			rejectValue(attribute, violations, "The \"set\" attribute Locale key must be set.");
			return;
		}
		if (valueMap.containsValue(null) || valueMap.containsValue(""))
		{
			rejectValue(attribute, violations, "The \"set\" attribute value must not be blank.");
			return;
		}
	}
}
 
开发者ID:fredhopper,项目名称:hybris-connector,代码行数:21,代码来源:SetAttributeValidator.java

示例5: hasValidValueId

import com.google.common.collect.Table; //导入方法依赖的package包/类
@Override
protected boolean hasValidValueId(final FhAttributeData attribute, final List<Violation> violations)
{
	final Table<Optional<String>, Optional<Locale>, String> values = attribute.getValues();
	for (final Optional<String> optional : values.rowKeySet())
	{
		final String key = optional == null || !optional.isPresent() ? "_absent_" : optional.get();
		if (!key.matches(VALUE_ID_PATTERN))
		{
			rejectValue(attribute, violations,
					"The \"list\" attribute valueId key \"" + key + "\" does not match the appropriate pattern.");
			return false;
		}
	}
	return true;
}
 
开发者ID:fredhopper,项目名称:hybris-connector,代码行数:17,代码来源:ListAttributeValidator.java

示例6: validateValue

import com.google.common.collect.Table; //导入方法依赖的package包/类
@Override
protected void validateValue(final FhAttributeData attribute, final List<Violation> violations)
{
	final Table<Optional<String>, Optional<Locale>, String> values = attribute.getValues();
	for (final Optional<String> valueId : values.rowKeySet())
	{
		final Map<Optional<Locale>, String> valueMap = values.row(valueId);
		if (CollectionUtils.isEmpty(valueMap) || valueMap.keySet().size() != 1 || valueMap.containsKey(Optional.empty())
				|| valueMap.containsKey(null))
		{
			rejectValue(attribute, violations, "The \"list\" attribute value unique Locale key must be set.");
			return;
		}
		if (valueMap.containsValue(null) || valueMap.containsValue(""))
		{
			rejectValue(attribute, violations, "The \"list\" attribute value must not be blank.");
			return;
		}
	}
}
 
开发者ID:fredhopper,项目名称:hybris-connector,代码行数:21,代码来源:ListAttributeValidator.java

示例7: formatData

import com.google.common.collect.Table; //导入方法依赖的package包/类
private static List<Medicion> formatData(
        Table<Calendar, String, Object> tableNO2,
        Table<Calendar, String, Object> tableSO2,
        Table<Calendar, String, Object> tableCO,
        Table<Calendar, String, Object> tableO3,
        Table<Calendar, String, Object> tableTOL,
        Table<Calendar, String, Object> tableBEN,
        Table<Calendar, String, Object> tablePM25,
        Table<Calendar, String, Object> tablePM10) {

    List<Medicion> mediciones = new ArrayList<>();
    //

    Calendar savedTime = Calendar.getInstance(TimeZone.getTimeZone("CET"));
    for(int i = 0 ; i < tableNO2.rowKeySet().size(); i++) {

        List<Calendar> listNO2 = new ArrayList<>(tableNO2.rowKeySet());
        Calendar time = listNO2.get(i);

        Medicion medicion = new Medicion(isPureMadrid());
        medicion.setMeasuredAt(time.getTime());
        medicion.setSavedAtHour(Calendar.getInstance().getTime());

        // Parse each Compuesto
        medicion.put(NO2,formatValues(time,tableNO2));
        medicion.put(CO,formatValues(time,tableCO));
        medicion.put(SO2,formatValues(time,tableSO2));
        medicion.put(BEN,formatValues(time,tableBEN));
        medicion.put(O3,formatValues(time,tableO3));
        medicion.put(PM10,formatValues(time,tablePM10));
        medicion.put(PM2_5,formatValues(time,tablePM25));
        medicion.put(TOL,formatValues(time,tableTOL));

        //
        mediciones.add(medicion);
        savedTime.add(Calendar.MILLISECOND,1);
    }
    return mediciones;
}
 
开发者ID:medialab-prado,项目名称:puremadrid,代码行数:40,代码来源:Parser.java

示例8: tableToCsv

import com.google.common.collect.Table; //导入方法依赖的package包/类
/**
 * Converts Guava table to a CSV table
 *
 * @param table                   table
 * @param csvFormat               CSV format
 * @param missingValuePlaceholder print if a value is missing (empty string by default)
 * @param <T>                     object type (string)
 * @return table
 * @throws IOException exception
 */
public static <T> String tableToCsv(Table<String, String, T> table, CSVFormat csvFormat,
        String missingValuePlaceholder)
        throws IOException
{
    StringWriter sw = new StringWriter();
    CSVPrinter printer = new CSVPrinter(sw, csvFormat);

    List<String> firstRow = new ArrayList<>();
    firstRow.add(" ");
    firstRow.addAll(table.columnKeySet());
    printer.printRecord(firstRow);

    for (String rowKey : table.rowKeySet()) {
        printer.print(rowKey);
        for (String columnKey : table.columnKeySet()) {
            T value = table.get(rowKey, columnKey);

            if (value == null) {
                printer.print(missingValuePlaceholder);
            }
            else {
                printer.print(value);
            }
        }
        printer.println();
    }

    printer.close();

    return sw.toString();
}
 
开发者ID:UKPLab,项目名称:argument-reasoning-comprehension-task,代码行数:42,代码来源:TableUtils.java

示例9: fillAccumulationMap

import com.google.common.collect.Table; //导入方法依赖的package包/类
private void fillAccumulationMap(Map<RedisConstant, Map<String, Object>> infoMap,
                                 Table<RedisConstant, String, Long> table) {
    if (table == null || table.isEmpty()) {
        return;
    }
    Map<String, Object> accMap = infoMap.get(RedisConstant.DIFF);
    if (accMap == null) {
        accMap = new LinkedHashMap<String, Object>();
        infoMap.put(RedisConstant.DIFF, accMap);
    }
    for (RedisConstant constant : table.rowKeySet()) {
        Map<String, Long> rowMap = table.row(constant);
        accMap.putAll(rowMap);
    }
}
 
开发者ID:sohutv,项目名称:cachecloud,代码行数:16,代码来源:RedisCenterImpl.java

示例10: printAttributeValueCollection

import com.google.common.collect.Table; //导入方法依赖的package包/类
protected void printAttributeValueCollection(final FhAttributeData source) throws IOException
{

	final Table<Optional<String>, Optional<Locale>, String> values = source.getValues();
	for (final Optional<String> valueId : values.rowKeySet())
	{
		final String attributeValueId = valueId.isPresent() ? valueId.get() : EMPTY_VALUE;
		final Map<Optional<Locale>, String> valueMap = values.row(valueId);
		for (final Entry<Optional<Locale>, String> entry : valueMap.entrySet())
		{
			printLine(source.getItemId(), entry.getKey().get().toString(), source.getAttributeId(), attributeValueId,
					valueMap.get(entry.getKey()));
		}
	}
}
 
开发者ID:fredhopper,项目名称:hybris-connector,代码行数:16,代码来源:AttributeCsvWriter.java

示例11: toTable

import com.google.common.collect.Table; //导入方法依赖的package包/类
@Override
public tech.tablesaw.api.Table toTable() {

    Table<String, String, Integer> sortedTable = sortedTable();

    tech.tablesaw.api.Table t = tech.tablesaw.api.Table.create("Confusion Matrix");
    t.addColumn(new CategoryColumn(""));

    for (String label : sortedTable.rowKeySet()) {
        t.addColumn(new IntColumn(label));
        t.column(0).appendCell("Predicted " + label);
    }

    int n = 0;
    for (String rowLabel : sortedTable.rowKeySet()) {
        int c = 1;
        for (String colLabel : sortedTable.columnKeySet()) {
            Integer value = sortedTable.get(rowLabel, colLabel);
            if (value == null) {
                t.intColumn(c).append(0);
            } else {
                t.intColumn(c).append(value);
                n = n + value;
            }
            c++;
        }
    }
    t.column(0).setName("n = " + n);
    for (int col = 1; col <= sortedTable.columnKeySet().size(); col++) {
        t.column(col).setName("Actual " + t.column(col).name());
    }
    return t;
}
 
开发者ID:jtablesaw,项目名称:tablesaw,代码行数:34,代码来源:CategoryConfusionMatrix.java

示例12: getConceptInventory

import com.google.common.collect.Table; //导入方法依赖的package包/类
/**
 * Get the list of all concepts in Synthea, as a list of CSV strings.
 * @return list of CSV strings
 * @throws Exception if any exception occurs in reading the modules.
 */
public static List<String> getConceptInventory() throws Exception {
  Table<String,String,String> concepts = HashBasedTable.create();

  URL modulesFolder = ClassLoader.getSystemClassLoader().getResource("modules");
  Path path = Paths.get(modulesFolder.toURI());
  Files.walk(path).filter(Files::isReadable).filter(Files::isRegularFile)
      .filter(f -> f.toString().endsWith(".json")).forEach(modulePath -> {
        try (JsonReader reader = new JsonReader(new FileReader(modulePath.toString()))) {
          JsonObject module = new JsonParser().parse(reader).getAsJsonObject();
          inventoryModule(concepts, module);
        } catch (IOException e) {
          throw new RuntimeException("Unable to read modules", e);
        }
      });

  inventoryCodes(concepts, CardiovascularDiseaseModule.getAllCodes());
  inventoryCodes(concepts, DeathModule.getAllCodes());
  inventoryCodes(concepts, EncounterModule.getAllCodes());
  // HealthInsuranceModule has no codes
  inventoryCodes(concepts, Immunizations.getAllCodes());
  inventoryCodes(concepts, LifecycleModule.getAllCodes());
  // QualityOfLifeModule adds no new codes to patients
  
  List<String> conceptList = new ArrayList<>();
  
  for (String system : concepts.rowKeySet()) {
    Map<String,String> codesInSystem = concepts.row(system);
    
    for (String code : codesInSystem.keySet()) {
      String display = codesInSystem.get(code);
      display = display.replaceAll("\\r\\n|\\r|\\n|,", " ").trim();
      StringBuilder output = new StringBuilder();
      output.append(system).append(',')
            .append(code).append(',')
            .append(display).append(System.lineSeparator());
      
      conceptList.add(output.toString());
    }
  }
  
  return conceptList;
}
 
开发者ID:synthetichealth,项目名称:synthea_java,代码行数:48,代码来源:Concepts.java

示例13: serialize

import com.google.common.collect.Table; //导入方法依赖的package包/类
@Override
public JsonElement serialize(Table src, Type typeOfSrc, JsonSerializationContext context) {
    JsonObject object = new JsonObject();

    //columns
    JsonArray jsonColsArray = new JsonArray();
    jsonColsArray.add("DATE");
    for(Object col:src.columnKeySet()) {
        jsonColsArray.add(col.toString());
    }
    object.add("columns",jsonColsArray);

    //data
    JsonArray jsonRowsArray = new JsonArray();
    Set<Date> rowKeys = src.rowKeySet();

    for(Object rkey: rowKeys){

        JsonArray rowCols = new JsonArray();

        if(rkey instanceof Date)
            rowCols.add(DateUtils.DRONZE_DATE.format(rkey));
        else if(rkey instanceof String)
            rowCols.add(rkey.toString());

        //offset 1 for the date column
        for (int j = 1; j < jsonColsArray.size(); j++) {
            Object o = src.get(rkey, jsonColsArray.get(j).toString().replace("\"",""));
            if(o!=null){
                if (o.getClass() == Integer.class) {
                    rowCols.add((Integer) o);
                }
                else if (o.getClass() == String.class) {
                    rowCols.add(o.toString());
                }
                else if (o.getClass() == Float.class) {
                    rowCols.add((Float)o);
                }
                else if (o.getClass() == Double.class) {
                    rowCols.add((Double)o);
                }
                else if (o.getClass() == BigDecimal.class) {
                    rowCols.add((BigDecimal)o);
                }
                else if (o.getClass() == Date.class) {
                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                    rowCols.add(sdf.format(o));
                }
            } else {
                rowCols.add((String)null);
            }

        }
        jsonRowsArray.add(rowCols);

    }

    object.add("data",jsonRowsArray);

    return object;

}
 
开发者ID:claytantor,项目名称:blueweave,代码行数:63,代码来源:GuavaTableSerializer.java

示例14: groupByModelIndex

import com.google.common.collect.Table; //导入方法依赖的package包/类
/**
 * Return an Multimap with the association between the ASSERT and the level of Quality (GROUP BY Model Index)
 * @param assertList
 * @return
 */
public static Multimap<QualityLevel, ASSERT> groupByModelIndex(Set<ASSERT> assertList, ModelWeight weight, Table<String, String, Double> modelIndexTable){
	// TODO: Questa potrei passargliela come parametro ?
	//Table<String, String, Double> modelIndexTable = Retriever.getModelWeightTable(weight);
	if (modelIndexTable != null){
		//modelIndexTable = Retriever.getModelIndexTable(assertList, modelIndexTable);
		HashSet<String> negativeModelIndex = Retriever.getNegativeModelIndex();
		// TODO: VEDERE SE TENERE IL SECONDO PARAMETRO IN UN SET
		Multimap<QualityLevel, ASSERT> hierarchy = HashMultimap.create();
		//HashMap<ASSERT, QualityLevel> hierarchy = new HashMap<ASSERT, QualityLevel>(assertList.size());
		HashMap<String, Double> modelIndexes = null;
		Set<String> rowKeys = modelIndexTable.rowKeySet();
		QualityLevel qualityLevel;
		// Calcolo del quality level del singolo ASSERT
		for(ASSERT element : assertList){
			// Prendo tutti gli indici dell'ASSERT in Esame
			modelIndexes = Retriever.getModelIndexes(element);
			if(modelIndexes != null){
				// Calcolo i valori della media
				// Per ogni riga della tabella modelIndexTable(tabella con Pesi - Min - Max)
				double value = 0.0;
				double tempValue = 0.0;
				for(String row : rowKeys){
					if(modelIndexes.containsKey(row)){
						if(negativeModelIndex.contains(row)){
							// Calcolo indice negativo
							value += (1 - Retriever.calcNormalizedIndex(modelIndexes.get(row), modelIndexTable.get(row, "Min"), modelIndexTable.get(row, "Max"), modelIndexTable.get(row, "weight"))) * modelIndexTable.get(row, "weight");
						} else {
							// Calcolo indice positivo
							value += (Retriever.calcNormalizedIndex(modelIndexes.get(row), modelIndexTable.get(row, "Min"), modelIndexTable.get(row, "Max"), modelIndexTable.get(row, "weight"))) * modelIndexTable.get(row, "weight");
						}
					}
				}
				qualityLevel = Retriever.calculateQualityLevel(value);
				if(qualityLevel != null){
					//hierarchy.put(element, qualityLevel);
					hierarchy.put(qualityLevel, element);
					
				} else {
					hierarchy.put(qualityLevel, element);
				}
			} else {
				hierarchy.put(QualityLevel.LOW, element);
			}
		}
		return hierarchy;
		
	}
	return null;		
}
 
开发者ID:SESARLab,项目名称:Assert4SOA-MatchMaker,代码行数:55,代码来源:Retriever.java

示例15: write

import com.google.common.collect.Table; //导入方法依赖的package包/类
public void write() throws IOException {
    Splitter splitter = Splitter.on('.');
    Iterable<String> folders = splitter.split(mPackageName);
    File file = new File(mOutFolder);
    for (String folder : folders) {
        file = new File(file, folder);
    }
    file.mkdirs();
    file = new File(file, SdkConstants.FN_RESOURCE_CLASS);

    Closer closer = Closer.create();
    try {
        BufferedWriter writer = closer.register(Files.newWriter(file, Charsets.UTF_8));

        writer.write("/* AUTO-GENERATED FILE.  DO NOT MODIFY.\n");
        writer.write(" *\n");
        writer.write(" * This class was automatically generated by the\n");
        writer.write(" * aapt tool from the resource data it found.  It\n");
        writer.write(" * should not be modified by hand.\n");
        writer.write(" */\n");

        writer.write("package ");
        writer.write(mPackageName);
        writer.write(";\n\npublic final class R {\n");

        Table<String, String, SymbolEntry> symbols = getAllSymbols();
        Table<String, String, SymbolEntry> values = mValues.getSymbols();

        Set<String> rowSet = symbols.rowKeySet();
        List<String> rowList = Lists.newArrayList(rowSet);
        Collections.sort(rowList);

        for (String row : rowList) {
            writer.write("\tpublic static final class ");
            writer.write(row);
            writer.write(" {\n");

            Map<String, SymbolEntry> rowMap = symbols.row(row);
            Set<String> symbolSet = rowMap.keySet();
            ArrayList<String> symbolList = Lists.newArrayList(symbolSet);
            Collections.sort(symbolList);

            for (String symbolName : symbolList) {
                // get the matching SymbolEntry from the values Table.
                SymbolEntry value = values.get(row, symbolName);
                if (value != null) {
                    writer.write("\t\tpublic static final ");
                    writer.write(value.getType());
                    writer.write(" ");
                    writer.write(value.getName());
                    writer.write(" = ");
                    writer.write(value.getValue());
                    writer.write(";\n");
                }
            }

            writer.write("\t}\n");
        }

        writer.write("}\n");
    } catch (Throwable e) {
        throw closer.rethrow(e);
    } finally {
        closer.close();
    }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:67,代码来源:SymbolWriter.java


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