本文整理汇总了Java中com.google.common.collect.Table.row方法的典型用法代码示例。如果您正苦于以下问题:Java Table.row方法的具体用法?Java Table.row怎么用?Java Table.row使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.Table
的用法示例。
在下文中一共展示了Table.row方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: getCommandStatsList
import com.google.common.collect.Table; //导入方法依赖的package包/类
private List<AppCommandStats> getCommandStatsList(long appId, long collectTime,
Table<RedisConstant, String, Long> table) {
Map<String, Long> commandMap = table.row(RedisConstant.Commandstats);
List<AppCommandStats> list = new ArrayList<AppCommandStats>();
if (commandMap == null) {
return list;
}
for (String key : commandMap.keySet()) {
String commandName = key.replace("cmdstat_", "");
long callCount = MapUtils.getLong(commandMap, key, 0L);
if (callCount == 0L) {
continue;
}
AppCommandStats commandStats = new AppCommandStats();
commandStats.setAppId(appId);
commandStats.setCollectTime(collectTime);
commandStats.setCommandName(commandName);
commandStats.setCommandCount(callCount);
commandStats.setModifyTime(new Date());
list.add(commandStats);
}
return list;
}
示例3: 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;
}
}
}
示例4: 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();
final Map<Optional<Locale>, String> valueMap = values.row(Optional.empty());
if (CollectionUtils.isEmpty(valueMap) || valueMap.entrySet().size() != 1 || !valueMap.containsKey(Optional.empty()))
{
rejectValue(attribute, violations, "The \"text\" attribute value cannot be localized.");
return;
}
final String value = valueMap.get(Optional.empty());
if (StringUtils.isBlank(value))
{
rejectValue(attribute, violations, "The \"text\" attribute value must not be blank.");
}
}
示例5: 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;
}
}
}
示例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();
final Map<Optional<Locale>, String> valueMap = values.row(Optional.empty());
if (CollectionUtils.isEmpty(valueMap) || valueMap.containsKey(Optional.empty()) || valueMap.containsKey(null))
{
rejectValue(attribute, violations, "The \"asset\" value's Locale key must be set.");
return;
}
for (final Entry<Optional<Locale>, String> entry : valueMap.entrySet())
{
if (StringUtils.isBlank(entry.getValue()))
{
rejectValue(attribute, violations, "The \"asset\" value must not be blank.");
}
}
}
示例7: 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();
final Map<Optional<Locale>, String> valueMap = values.row(Optional.empty());
if (CollectionUtils.isEmpty(valueMap) || valueMap.entrySet().size() != 1 || !valueMap.containsKey(Optional.empty()))
{
rejectValue(attribute, violations, "The \"float\" attribute value cannot be localized.");
return;
}
final String value = valueMap.get(Optional.empty());
try
{
if (StringUtils.isBlank(value)
|| !(Float.parseFloat(value) > 0 && Double.valueOf(Float.MAX_VALUE).compareTo(Double.valueOf(value)) > 0))
{
rejectValue(attribute, violations, "The \"float\" attribute value is not in the supported value range.");
}
}
catch (final NumberFormatException ex)
{
rejectValue(attribute, violations, "The \"float\" attribute value does not have the appropriate format.");
}
}
示例8: 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();
final Map<Optional<Locale>, String> valueMap = values.row(Optional.empty());
if (CollectionUtils.isEmpty(valueMap) || valueMap.entrySet().size() != 1 || !valueMap.containsKey(Optional.empty()))
{
rejectValue(attribute, violations, "The \"int\" attribute value cannot be localized.");
return;
}
final String value = valueMap.get(Optional.empty());
try
{
if (StringUtils.isBlank(value)
|| !(Integer.parseInt(value) > 0 && Double.valueOf(Integer.MAX_VALUE).compareTo(Double.valueOf(value)) > 0))
{
rejectValue(attribute, violations, "The \"int\" attribute value is not in the supported value range.");
}
}
catch (final NumberFormatException ex)
{
rejectValue(attribute, violations, "The \"int\" attribute value does not have the appropriate format.");
}
}
示例9: main
import com.google.common.collect.Table; //导入方法依赖的package包/类
public static void main(String[] args) {
String[] names = {"Bob", "Alice", "Andy", "Carol", "Ben"};
// Table of names
Table<Character, Integer, String> table = HashBasedTable.create();
// First letter is a row key, length is a column key
for (String name : names) {
table.put(name.charAt(0), name.length(), name);
}
// Value corresponding to the given row and column keys
table.get('A', 5); // -> Alice
table.get('B', 3); // -> Ben
// Set of column keys that have one or more values in the table
table.columnKeySet(); // -> [4, 5, 3]
// View of all mappings that have the given row key
table.row('A'); // -> {4=Andy, 5=Alice}
}
示例10: storeValues
import com.google.common.collect.Table; //导入方法依赖的package包/类
private void storeValues(final Table<String, String, BusinessObjectField> records,
final BusinessObjectInstance objectInstance) {
final Map<String, BusinessObjectField> row =
records.row(objectInstance.getBusinessObjectModel().getName());
if (!row.isEmpty()) {
objectInstance.getBusinessObjectFieldInstances().stream()
.forEachOrdered(field -> storeValue(row, field));
}
}
示例11: 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);
}
}
示例12: 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()));
}
}
}
示例13: 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;
}
示例14: getAllByRoles
import com.google.common.collect.Table; //导入方法依赖的package包/类
@Override
public Map<String, UserPermission> getAllByRoles(List<String> anyRoles) {
if (anyRoles == null) {
return getAllById();
} else if (anyRoles.isEmpty()) {
val unrestricted = get(UNRESTRICTED);
if (unrestricted.isPresent()) {
val map = new HashMap<String, UserPermission>();
map.put(UNRESTRICTED, unrestricted.get());
return map;
}
return new HashMap<>();
}
try (Jedis jedis = jedisSource.getJedis()) {
Pipeline p = jedis.pipelined();
List<Response<Set<String>>> responses = anyRoles
.stream()
.map(role -> p.smembers(roleKey(role)))
.collect(Collectors.toList());
p.sync();
Set<String> dedupedUsernames = responses
.stream()
.flatMap(response -> response.get().stream())
.collect(Collectors.toSet());
dedupedUsernames.add(UNRESTRICTED);
Table<String, ResourceType, Response<Map<String, String>>> responseTable =
getAllFromRedis(dedupedUsernames);
if (responseTable == null) {
return new HashMap<>(0);
}
RawUserPermission rawUnrestricted = new RawUserPermission(responseTable.row(UNRESTRICTED));
UserPermission unrestrictedUser = getUserPermission(UNRESTRICTED, rawUnrestricted);
return dedupedUsernames
.stream()
.map(userId -> {
RawUserPermission rawUser = new RawUserPermission(responseTable.row(userId));
return getUserPermission(userId, rawUser);
})
.collect(Collectors.toMap(UserPermission::getId,
permission -> permission.merge(unrestrictedUser)));
}
}
示例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();
}
}