List of usage examples for com.google.common.collect BiMap get
V get(Object key);
From source file:com.tiendd.uet.predicting.AbstractRecommender.java
/** * get Recommended List//from w w w.ja v a 2 s . c o m * * @return Recommended List */ public List<RecommendedItem> getRecommendedList() { if (recommendedList != null && recommendedList.size() > 0) { List<RecommendedItem> userItemList = new ArrayList<>(); Iterator<UserItemRatingEntry> recommendedEntryIter = recommendedList.entryIterator(); if (userMappingData != null && userMappingData.size() > 0 && itemMappingData != null && itemMappingData.size() > 0) { BiMap<Integer, String> userMappingInverse = userMappingData.inverse(); BiMap<Integer, String> itemMappingInverse = itemMappingData.inverse(); while (recommendedEntryIter.hasNext()) { UserItemRatingEntry userItemRatingEntry = recommendedEntryIter.next(); if (userItemRatingEntry != null) { String userId = userMappingInverse.get(userItemRatingEntry.getUserIdx()); String itemId = itemMappingInverse.get(userItemRatingEntry.getItemIdx()); if (StringUtils.isNotBlank(userId) && StringUtils.isNotBlank(itemId)) { userItemList.add( new GenericRecommendedItem(userId, itemId, userItemRatingEntry.getValue())); } } } return userItemList; } } return null; }
From source file:com.mycelium.wapi.wallet.bip44.Bip44Account.java
/** * Do a look ahead on the external address chain. If any transactions were * found the external and internal last active addresses are updated, and the * transactions and their parent transactions stored. * * @return true if something was found and the call should be repeated. * @throws com.mycelium.wapi.api.WapiException *///from w w w. j a v a2 s . co m private boolean doDiscovery() throws WapiException { // Ensure that all addresses in the look ahead window have been created ensureAddressIndexes(); // Make look ahead address list List<Address> lookAhead = new ArrayList<Address>( EXTERNAL_FULL_ADDRESS_LOOK_AHEAD_LENGTH + INTERNAL_FULL_ADDRESS_LOOK_AHEAD_LENGTH); final BiMap<Integer, Address> extInverse = _externalAddresses.inverse(); final BiMap<Integer, Address> intInverse = _internalAddresses.inverse(); for (int i = 0; i < EXTERNAL_FULL_ADDRESS_LOOK_AHEAD_LENGTH; i++) { Address externalAddress = extInverse.get(_context.getLastExternalIndexWithActivity() + 1 + i); if (externalAddress != null) lookAhead.add(externalAddress); } for (int i = 0; i < INTERNAL_FULL_ADDRESS_LOOK_AHEAD_LENGTH; i++) { lookAhead.add(intInverse.get(_context.getLastInternalIndexWithActivity() + 1 + i)); } return doDiscoveryForAddresses(lookAhead); }
From source file:net.librec.recommender.content.EFMRecommender.java
@Override public List<RecommendedItem> getRecommendedList() { if (recommendedList != null && recommendedList.size() > 0) { List<RecommendedItem> userItemList = new ArrayList<>(); Iterator<UserItemRatingEntry> recommendedEntryIter = recommendedList.entryIterator(); if (userMappingData != null && userMappingData.size() > 0 && itemMappingData != null && itemMappingData.size() > 0) { BiMap<Integer, String> userMappingInverse = userMappingData.inverse(); BiMap<Integer, String> itemMappingInverse = itemMappingData.inverse(); while (recommendedEntryIter.hasNext()) { UserItemRatingEntry userItemRatingEntry = recommendedEntryIter.next(); if (userItemRatingEntry != null) { String userId = userMappingInverse.get(userItemRatingEntry.getUserIdx()); String itemId = itemMappingInverse.get(userItemRatingEntry.getItemIdx()); if (StringUtils.isNotBlank(userId) && StringUtils.isNotBlank(itemId)) { userItemList.add( new GenericRecommendedItem(userId, itemId, userItemRatingEntry.getValue())); }/*from ww w .j a va2 s . co m*/ } } return userItemList; } } return null; }
From source file:net.librec.data.convertor.ArffDataConvertor.java
/** * Parse @DATA part of the file.//from www . j a v a 2 s . com * * @param rd the reader of the input file. * @throws IOException */ private void dataReader(Reader rd) throws IOException { ArrayList<String> dataLine = new ArrayList<>(); StringBuilder subString = new StringBuilder(); boolean isInQuote = false; boolean isInBracket = false; int c = 0; while ((c = rd.read()) != -1) { char ch = (char) c; // read line by line if (ch == '\n') { if (dataLine.size() != 0) { // check if empty line if (!dataLine.get(0).startsWith("%")) { // check if // annotation line dataLine.add(subString.toString()); // raise error if inconsistent with attribute define if (dataLine.size() != attrTypes.size()) { throw new IOException("Read data error, inconsistent attribute number!"); } // pul column value into columnIds, for one-hot encoding for (int i = 0; i < dataLine.size(); i++) { String col = dataLine.get(i).trim(); String type = attrTypes.get(i); BiMap<String, Integer> colId = columnIds.get(i); switch (type) { case "NUMERIC": case "REAL": case "INTEGER": break; case "STRING": int val = colId.containsKey(col) ? colId.get(col) : colId.size(); colId.put(col, val); break; case "NOMINAL": StringBuilder sb = new StringBuilder(); String[] ss = col.split(","); for (int ns = 0; ns < ss.length; ns++) { String _s = ss[ns].trim(); if (!colId.containsKey(_s)) { throw new IOException("Read data error, inconsistent nominal value!"); } sb.append(_s); if (ns != ss.length - 1) sb.append(","); } col = sb.toString(); break; } dataLine.set(i, col); } instances.add(new ArffInstance(dataLine)); subString = new StringBuilder(); dataLine = new ArrayList<>(); } } } else if (ch == '[' || ch == ']') { isInBracket = !isInBracket; } else if (ch == '\r') { // skip '\r' } else if (ch == '\"') { isInQuote = !isInQuote; } else if (ch == ',' && (!isInQuote && !isInBracket)) { dataLine.add(subString.toString()); subString = new StringBuilder(); } else { subString.append(ch); } } }
From source file:com.wolvereness.overmapped.OverMapped.java
private void process() throws Throwable { validateInput();// ww w.ja v a 2 s . co m final MultiProcessor executor = MultiProcessor.newMultiProcessor(cores - 1, new ThreadFactoryBuilder().setDaemon(true) .setNameFormat(OverMapped.class.getName() + "-processor-%d") .setUncaughtExceptionHandler(this).build()); final Future<?> fileCopy = executor.submit(new Callable<Object>() { @Override public Object call() throws Exception { if (original != null) { if (original.exists()) { original.delete(); } Files.copy(input, original); } return null; } }); final Future<Iterable<?>> mappings = executor.submit(new Callable<Iterable<?>>() { @Override public Iterable<?> call() throws Exception { final Object yaml = new Yaml().load(Files.toString(maps, Charset.forName("UTF8"))); if (yaml instanceof Iterable) return (Iterable<?>) yaml; if (yaml instanceof Map) return ImmutableList.of(yaml); throw new ClassCastException(String.format("%s (%s) implements neither %s nor %s", yaml, yaml == null ? Object.class : yaml.getClass(), Iterable.class, Map.class)); } }); final Map<String, ByteClass> byteClasses = newLinkedHashMap(); final List<Pair<ZipEntry, byte[]>> fileEntries = newArrayList(); readClasses(executor, byteClasses, fileEntries); try { reorderEntries(byteClasses); } catch (final CircularOrderException ex) { final Throwable throwable = new MojoFailureException("Circular class hiearchy detected"); throwable.initCause(ex); throw throwable; } final Multimap<String, String> depends = processDepends(byteClasses); final Multimap<String, String> rdepends = processReverseDepends(depends); final BiMap<String, String> nameMaps = HashBiMap.create(byteClasses.size()); final BiMap<String, String> inverseNameMaps = nameMaps.inverse(); final BiMap<Signature, Signature> signatureMaps = HashBiMap.create(); final BiMap<Signature, Signature> inverseSignatureMaps = signatureMaps.inverse(); final Map<Signature, Integer> flags = newHashMap(); final Remapper inverseMapper = new Remapper() { @Override public String map(final String typeName) { final String name = inverseNameMaps.get(typeName); if (name != null) return name; return typeName; } }; prepareSignatures(byteClasses, rdepends, nameMaps, signatureMaps); final Signature.MutableSignature signature = Signature.newMutableSignature("", "", ""); final Set<String> searchCache = newHashSet(); for (final Object mapping : mappings.get()) { final Map<?, ?> map = (Map<?, ?>) mapping; for (final SubRoutine subRoutine : SubRoutine.SUB_ROUTINES) { try { subRoutine.invoke(this, byteClasses, depends, rdepends, nameMaps, inverseNameMaps, signatureMaps, inverseSignatureMaps, inverseMapper, signature, searchCache, flags, map); } catch (final Exception ex) { final Throwable throwable = new MojoFailureException("Failed to parse mappings in " + mapping); throwable.initCause(ex); throw throwable; } } } try { fileCopy.get(); } catch (final ExecutionException ex) { throw new MojoFailureException(String.format("Could not copy `%s' to `%s'", input, original)); } writeToFile(executor, byteClasses, fileEntries, nameMaps, signatureMaps, flags); executor.shutdown(); final Pair<Thread, Throwable> uncaught = this.uncaught; if (uncaught != null) throw new MojoExecutionException(String.format("Uncaught exception in %s", uncaught.getLeft()), uncaught.getRight()); }
From source file:org.shaf.server.controller.ActionProcessController.java
/** * Launches the process execution,//from www . j a v a2 s .c o m * * @param cmd * the command which launches a process. * @return the view model. * @throws Exception * is the view constructing has failed. */ @RequestMapping(value = "/launch/{cmd}", method = RequestMethod.POST) public ModelAndView onLaunch(@PathVariable String cmd) throws Exception { LOG.debug("CALL: /proc/action/launch/{" + cmd + "}"); // Launching parameters extraction. BiMap<String, String> params = HashBiMap.create(); Enumeration<String> names = REQUEST.getParameterNames(); while (names.hasMoreElements()) { String name = names.nextElement(); String value = REQUEST.getParameter(name); LOG.debug("PARAMS: " + name + "=" + value); if (name.startsWith("radio")) { String group = name.substring(0, name.indexOf('-')); String quantifier = name.substring(name.indexOf('-') + 1); if (quantifier.equals("opt")) { // This is a selected radio button option. if (params.containsKey(name)) { params.inverse().put(params.get(name), value); } else { params.put(value, group + "-arg"); } } else { // This is a selected radio button argument. if (params.inverse().containsKey(name)) { params.put(params.inverse().get(name), value); } else { params.inverse().put(value, group + "-opt"); } } } else { params.put(name, value); } } // Launching parameters cleanup. Iterator<String> keys = params.keySet().iterator(); while (keys.hasNext()) { String key = keys.next(); if (key.startsWith("radio")) { keys.remove(); } else { String value = params.get(key); if (value == null) { params.put(key, ""); } else { if (value.startsWith("radio")) { params.put(key, ""); } } } } StringBuilder args = new StringBuilder(); if (params.containsKey("command-line")) { args.append(params.get("command-line")); } else { for (Map.Entry<String, String> param : params.entrySet()) { if (args.length() > 0) { args.append(' '); } args.append('-'); args.append(param.getKey()); if (!param.getValue().isEmpty()) { args.append(' '); if (param.getValue().contains(" ")) { args.append('\"' + param.getValue() + '\"'); } else { args.append(param.getValue()); } } } } String id = OPER.launchProcess(cmd, args.toString()); return ViewJob.getInfoView().header("job", "Job: " + id).addJobId(id).addJobActiveStatus(true) .addJobFailedStatus(false).addJobOutcome(OPER.getJobOutcome(id)) .info("The job execution in progress."); }
From source file:org.sosy_lab.cpachecker.cpa.octagon.OctagonState.java
/** * This method forgets some information about previously catched variables, this * is necessary for isLessOrEquals, or the union operator, be careful using it * in other ways (Variables removed from the OctState cannot be referenced anymore * by the OctTransferrelation)//from ww w . j a va 2 s . com * @param oct the octagon which has the preferred size, instead of just using * an int, the OctState is the parameter, so we can check if the variables * are matching if not an Exception is thrown * @return */ public Pair<OctagonState, OctagonState> shrinkToFittingSize(OctagonState oct) { int maxEqualIndex = oct.sizeOfVariables() - 1; BiMap<Integer, MemoryLocation> inverseThis = variableToIndexMap.inverse(); BiMap<Integer, MemoryLocation> inverseOther = oct.variableToIndexMap.inverse(); for (int i = maxEqualIndex; i >= 0; i--) { if (!inverseThis.get(i).equals(inverseOther.get(i))) { maxEqualIndex = i - 1; } } OctagonState newState1; if (variableToIndexMap.size() != maxEqualIndex + 1) { BiMap<MemoryLocation, Integer> newMap1 = HashBiMap.<MemoryLocation, Integer>create(variableToIndexMap); Map<MemoryLocation, Type> newTypeMap1 = new HashMap<>(variableToTypeMap); for (int i = variableToIndexMap.size() - 1; i > maxEqualIndex; i--) { newTypeMap1.remove(newMap1.inverse().remove(i)); } Octagon newOct1 = octagonManager.removeDimension(octagon, variableToIndexMap.size() - (maxEqualIndex + 1)); newState1 = new OctagonState(newOct1, newMap1, newTypeMap1, logger, isLoopHead); } else { newState1 = this; } OctagonState newState2; if (oct.variableToIndexMap.size() != maxEqualIndex + 1) { BiMap<MemoryLocation, Integer> newMap2 = HashBiMap .<MemoryLocation, Integer>create(oct.variableToIndexMap); Map<MemoryLocation, Type> newTypeMap2 = new HashMap<>(oct.variableToTypeMap); for (int i = oct.variableToIndexMap.size() - 1; i > maxEqualIndex; i--) { newTypeMap2.remove(newMap2.inverse().remove(i)); } Octagon newOct2 = octagonManager.removeDimension(oct.octagon, oct.variableToIndexMap.size() - (maxEqualIndex + 1)); newState2 = new OctagonState(newOct2, newMap2, newTypeMap2, logger, isLoopHead); } else { newState2 = oct; } return Pair.of(newState1, newState2); }
From source file:org.opencb.opencga.storage.hadoop.variant.converters.HBaseToVariantConverter.java
protected Variant convert(Variant variant, List<VariantTableStudyRow> rows, Map<Integer, Map<Integer, VariantStats>> stats, VariantAnnotation annotation) { if (annotation == null) { annotation = new VariantAnnotation(); annotation.setConsequenceTypes(Collections.emptyList()); }/* w w w .j av a 2s . c om*/ if (failOnEmptyVariants && rows.isEmpty()) { throw new IllegalStateException("No Row columns supplied for row " + variant); } for (VariantTableStudyRow row : rows) { Map<String, String> attributesMap = new HashMap<>(); Integer studyId = row.getStudyId(); QueryResult<StudyConfiguration> queryResult = scm.getStudyConfiguration(studyId, scmOptions); if (queryResult.getResult().isEmpty()) { throw new IllegalStateException("No study found for study ID: " + studyId); } StudyConfiguration studyConfiguration = queryResult.first(); LinkedHashMap<String, Integer> returnedSamplesPosition = getReturnedSamplesPosition(studyConfiguration); if (mutableSamplesPosition) { returnedSamplesPosition = new LinkedHashMap<>(returnedSamplesPosition); } // Do not throw any exception. It may happen that the study is not loaded yet or no samples are required! // if (returnedSamplesPosition.isEmpty()) { // throw new IllegalStateException("No samples found for study!!!"); // } BiMap<String, Integer> loadedSamples = StudyConfiguration.getIndexedSamples(studyConfiguration); List<String> format = Arrays.asList(VariantMerger.GT_KEY, VariantMerger.GENOTYPE_FILTER_KEY); int gtIdx = format.indexOf(VariantMerger.GT_KEY); int ftIdx = format.indexOf(VariantMerger.GENOTYPE_FILTER_KEY); int loadedSamplesSize = loadedSamples.size(); calculatePassCallRates(row, attributesMap, loadedSamplesSize); Integer nSamples = returnedSamplesPosition.size(); @SuppressWarnings("unchecked") List<String>[] samplesDataArray = new List[nSamples]; Set<Integer> sampleWithVariant = new HashSet<>(); BiMap<Integer, String> mapSampleIds = studyConfiguration.getSampleIds().inverse(); for (String genotype : row.getGenotypes()) { sampleWithVariant.addAll(row.getSampleIds(genotype)); if (genotype.equals(VariantTableStudyRow.OTHER)) { continue; // skip OTHER -> see Complex type } for (Integer sampleId : row.getSampleIds(genotype)) { String sampleName = mapSampleIds.get(sampleId); Integer sampleIdx = returnedSamplesPosition.get(sampleName); if (sampleIdx == null) { continue; //Sample may not be required. Ignore this sample. } List<String> lst = Arrays.asList(genotype, VariantMerger.PASS_VALUE); samplesDataArray[sampleIdx] = lst; } } // Load Secondary Index List<VariantProto.AlternateCoordinate> s2cgt = row.getComplexVariant().getSecondaryAlternatesList(); int secondaryAlternatesCount = row.getComplexVariant().getSecondaryAlternatesCount(); List<AlternateCoordinate> secAltArr = new ArrayList<AlternateCoordinate>(secondaryAlternatesCount); if (secondaryAlternatesCount > 0) { for (VariantProto.AlternateCoordinate altcoord : s2cgt) { VariantType vart = VariantType.valueOf(altcoord.getType().name()); String chr = StringUtils.isEmpty(altcoord.getChromosome()) ? variant.getChromosome() : altcoord.getChromosome(); Integer start = altcoord.getStart() == 0 ? variant.getStart() : altcoord.getStart(); Integer end = altcoord.getEnd() == 0 ? variant.getEnd() : altcoord.getEnd(); String reference = StringUtils.isEmpty(altcoord.getReference()) ? "" : altcoord.getReference(); String alternate = StringUtils.isEmpty(altcoord.getAlternate()) ? "" : altcoord.getAlternate(); AlternateCoordinate alt = new AlternateCoordinate(chr, start, end, reference, alternate, vart); secAltArr.add(alt); } } // Load complex genotypes for (Entry<Integer, String> entry : row.getComplexVariant().getSampleToGenotype().entrySet()) { sampleWithVariant.add(entry.getKey()); Integer samplePosition = getSamplePosition(returnedSamplesPosition, mapSampleIds, entry.getKey()); if (samplePosition == null) { continue; //Sample may not be required. Ignore this sample. } String genotype = entry.getValue(); String returnedGenotype; // FIXME: Decide what to do with lists of genotypes if (simpleGenotypes) { returnedGenotype = getSimpleGenotype(genotype); logger.debug("Return simplified genotype: {} -> {}", genotype, returnedGenotype); } else { returnedGenotype = genotype; } samplesDataArray[samplePosition] = Arrays.asList(returnedGenotype, VariantMerger.PASS_VALUE); } // Fill gaps (with HOM_REF) int gapCounter = 0; for (int i = 0; i < samplesDataArray.length; i++) { if (samplesDataArray[i] == null) { ++gapCounter; samplesDataArray[i] = Arrays.asList(VariantTableStudyRow.HOM_REF, VariantMerger.PASS_VALUE); } } // Set pass field int passCount = loadedSamplesSize; for (Entry<String, SampleList> entry : row.getComplexFilter().getFilterNonPass().entrySet()) { String filterString = entry.getKey(); passCount -= entry.getValue().getSampleIdsCount(); for (Integer id : entry.getValue().getSampleIdsList()) { Integer samplePosition = getSamplePosition(returnedSamplesPosition, mapSampleIds, id); if (samplePosition == null) { continue; // Sample may not be required. Ignore this sample. } samplesDataArray[samplePosition].set(ftIdx, filterString); } } // Check pass count if (passCount != row.getPassCount()) { String message = String.format( "Error parsing variant %s. Pass count %s does not match filter fill count: %s using %s loaded samples.", row.toString(), row.getPassCount(), passCount, loadedSamplesSize); wrongVariant(message); } // Check homRef count int homRefCount = loadedSamplesSize; homRefCount -= sampleWithVariant.size(); if (homRefCount != row.getHomRefCount()) { String message = "Wrong number of HomRef samples for variant " + variant + ". Got " + homRefCount + ", expect " + row.getHomRefCount() + ". Samples number: " + samplesDataArray.length + " , "; message += "'" + VariantTableStudyRow.HOM_REF + "':" + row.getHomRefCount() + " , "; for (String studyColumn : VariantTableStudyRow.GENOTYPE_COLUMNS) { message += "'" + studyColumn + "':" + row.getSampleIds(studyColumn) + " , "; } wrongVariant(message); } List<List<String>> samplesData = Arrays.asList(samplesDataArray); StudyEntry studyEntry; if (studyNameAsStudyId) { studyEntry = new StudyEntry(studyConfiguration.getStudyName()); } else { studyEntry = new StudyEntry(Integer.toString(studyConfiguration.getStudyId())); } studyEntry.setSortedSamplesPosition(returnedSamplesPosition); studyEntry.setSamplesData(samplesData); studyEntry.setFormat(format); studyEntry.setFiles(Collections.singletonList(new FileEntry("", "", attributesMap))); studyEntry.setSecondaryAlternates(secAltArr); Map<Integer, VariantStats> convertedStatsMap = stats.get(studyConfiguration.getStudyId()); if (convertedStatsMap != null) { Map<String, VariantStats> statsMap = new HashMap<>(convertedStatsMap.size()); for (Entry<Integer, VariantStats> entry : convertedStatsMap.entrySet()) { String cohortName = studyConfiguration.getCohortIds().inverse().get(entry.getKey()); statsMap.put(cohortName, entry.getValue()); } studyEntry.setStats(statsMap); } variant.addStudyEntry(studyEntry); } variant.setAnnotation(annotation); if (StringUtils.isNotEmpty(annotation.getId())) { variant.setId(annotation.getId()); } else { variant.setId(variant.toString()); } if (failOnEmptyVariants && variant.getStudies().isEmpty()) { throw new IllegalStateException("No Studies registered for variant!!! " + variant); } return variant; }
From source file:com.linkedin.pinot.controller.api.restlet.resources.ServerTableSizeReader.java
public Map<String, List<SegmentSizeInfo>> getSizeDetailsFromServers(BiMap<String, String> serverEndPoints, String table, int timeoutMsec) { List<String> serverUrls = new ArrayList<>(serverEndPoints.size()); BiMap<String, String> endpointsToServers = serverEndPoints.inverse(); for (String endpoint : endpointsToServers.keySet()) { String tableSizeUri = "http://" + endpoint + "/table/" + table + "/size"; serverUrls.add(tableSizeUri);//from www.java2 s .co m } MultiGetRequest mget = new MultiGetRequest(executor, connectionManager); LOGGER.info("Reading segment sizes from servers for table: {}, timeoutMsec: {}", table, timeoutMsec); CompletionService<GetMethod> completionService = mget.execute(serverUrls, timeoutMsec); Map<String, List<SegmentSizeInfo>> serverSegmentSizes = new HashMap<>(serverEndPoints.size()); for (int i = 0; i < serverUrls.size(); i++) { try { GetMethod getMethod = completionService.take().get(); URI uri = getMethod.getURI(); String instance = endpointsToServers.get(uri.getHost() + ":" + uri.getPort()); if (getMethod.getStatusCode() >= 300) { LOGGER.error("Server: {} returned error: {}", instance, getMethod.getStatusCode()); continue; } TableSizeInfo tableSizeInfo = new ObjectMapper().readValue(getMethod.getResponseBodyAsString(), TableSizeInfo.class); serverSegmentSizes.put(instance, tableSizeInfo.segments); } catch (InterruptedException e) { LOGGER.warn("Interrupted exception while reading segment size for table: {}", table, e); } catch (ExecutionException e) { if (Throwables.getRootCause(e) instanceof SocketTimeoutException) { LOGGER.warn("Server request to read table size was timed out for table: {}", table, e); } else if (Throwables.getRootCause(e) instanceof ConnectTimeoutException) { LOGGER.warn("Server request to read table size timed out waiting for connection. table: {}", table, e); } else if (Throwables.getRootCause(e) instanceof ConnectionPoolTimeoutException) { LOGGER.warn( "Server request to read table size timed out on getting a connection from pool, table: {}", table, e); } else { LOGGER.warn("Execution exception while reading segment sizes for table: {}", table, e); } } catch (Exception e) { LOGGER.warn("Error while reading segment sizes for table: {}", table); } } LOGGER.info("Finished reading segment sizes for table: {}", table); return serverSegmentSizes; }
From source file:com.linkedin.pinot.core.startree.OffHeapStarTreeBuilder.java
public GenericRow toGenericRow(DimensionBuffer dimensionKey, MetricBuffer metricsHolder) { GenericRow row = new GenericRow(); Map<String, Object> map = new HashMap<>(); for (int i = 0; i < dimensionNames.size(); i++) { String dimName = dimensionNames.get(i); BiMap<Integer, Object> inverseDictionary = dictionaryMap.get(dimName).inverse(); Object dimValue = inverseDictionary.get(dimensionKey.getDimension(i)); if (dimValue == null) { dimValue = dimensionNameToStarValueMap.get(dimName); }// w w w. java2s. co m map.put(dimName, dimValue); } for (int i = 0; i < numMetrics; i++) { String metName = metricNames.get(i); map.put(metName, metricsHolder.getValueConformToDataType(i)); } row.init(map); return row; }