gnu.trove.TIntObjectHashMap Java Examples
The following examples show how to use
gnu.trove.TIntObjectHashMap.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FrameIdentificationDecoder.java From semafor-semantic-parser with GNU General Public License v3.0 | 6 votes |
public FrameIdentificationDecoder(TObjectDoubleHashMap<String> paramList, String reg, double l, WordNetRelations mwnr, THashMap<String, THashSet<String>> frameMap, THashMap<String, THashSet<String>> wnRelationCache) { super(paramList,reg,l,mwnr,frameMap); initializeParameterIndexes(); this.mParamList=paramList; mReg=reg; mLambda=l; mWNR=mwnr; mFrameMap=frameMap; totalNumberOfParams=paramList.size(); initializeParameters(); mLookupChart = new TIntObjectHashMap<LogFormula>(); mWnRelationsCache = wnRelationCache; }
Example #2
Source File: PassExecutorService.java From consulo with Apache License 2.0 | 6 votes |
private void checkConsistency(ScheduledPass pass, TIntObjectHashMap<Pair<ScheduledPass, Integer>> id2Visits) { for (ScheduledPass succ : ContainerUtil.concat(pass.mySuccessorsOnCompletion, pass.mySuccessorsOnSubmit)) { int succId = succ.myPass.getId(); Pair<ScheduledPass, Integer> succPair = id2Visits.get(succId); if (succPair == null) { succPair = Pair.create(succ, succ.myRunningPredecessorsCount.get()); id2Visits.put(succId, succPair); } int newPred = succPair.second - 1; id2Visits.put(succId, Pair.create(succ, newPred)); assert newPred >= 0; if (newPred == 0) { checkConsistency(succ, id2Visits); } } }
Example #3
Source File: Win32FsCache.java From consulo with Apache License 2.0 | 6 votes |
@Nullable FileAttributes getAttributes(@Nonnull VirtualFile file) { VirtualFile parent = file.getParent(); int parentId = parent instanceof VirtualFileWithId ? ((VirtualFileWithId)parent).getId() : -((VirtualFileWithId)file).getId(); TIntObjectHashMap<THashMap<String, FileAttributes>> map = getMap(); THashMap<String, FileAttributes> nestedMap = map.get(parentId); String name = file.getName(); FileAttributes attributes = nestedMap != null ? nestedMap.get(name) : null; if (attributes == null) { if (nestedMap != null && !(nestedMap instanceof IncompleteChildrenMap)) { return null; // our info from parent doesn't mention the child in this refresh session } FileInfo info = myKernel.getInfo(file.getPath()); if (info == null) { return null; } attributes = info.toFileAttributes(); if (nestedMap == null) { nestedMap = new IncompleteChildrenMap<>(FileUtil.PATH_HASHING_STRATEGY); map.put(parentId, nestedMap); } nestedMap.put(name, attributes); } return attributes; }
Example #4
Source File: Win32FsCache.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull String[] list(@Nonnull VirtualFile file) { String path = file.getPath(); FileInfo[] fileInfo = myKernel.listChildren(path); if (fileInfo == null || fileInfo.length == 0) { return ArrayUtil.EMPTY_STRING_ARRAY; } String[] names = new String[fileInfo.length]; TIntObjectHashMap<THashMap<String, FileAttributes>> map = getMap(); int parentId = ((VirtualFileWithId)file).getId(); THashMap<String, FileAttributes> nestedMap = map.get(parentId); if (nestedMap == null) { nestedMap = new THashMap<String, FileAttributes>(fileInfo.length, FileUtil.PATH_HASHING_STRATEGY); map.put(parentId, nestedMap); } for (int i = 0, length = fileInfo.length; i < length; i++) { FileInfo info = fileInfo[i]; String name = info.getName(); nestedMap.put(name, info.toFileAttributes()); names[i] = name; } return names; }
Example #5
Source File: RefsModel.java From consulo with Apache License 2.0 | 6 votes |
public RefsModel(@Nonnull Map<VirtualFile, CompressedRefs> refs, @Nonnull Set<Integer> heads, @Nonnull VcsLogStorage hashMap, @Nonnull Map<VirtualFile, VcsLogProvider> providers) { myRefs = refs; myHashMap = hashMap; myBestRefForHead = new TIntObjectHashMap<>(); myRootForHead = new TIntObjectHashMap<>(); for (int head : heads) { CommitId commitId = myHashMap.getCommitId(head); if (commitId != null) { VirtualFile root = commitId.getRoot(); myRootForHead.put(head, root); Optional<VcsRef> bestRef = myRefs.get(root).refsToCommit(head).stream().min(providers.get(root).getReferenceManager().getBranchLayoutComparator()); if (bestRef.isPresent()) { myBestRefForHead.put(head, bestRef.get()); } else { LOG.warn("No references at head " + commitId); } } } }
Example #6
Source File: DuplicatesProfileCache.java From consulo with Apache License 2.0 | 6 votes |
@Nullable public static DuplicatesProfile getProfile(@Nonnull DupInfo dupInfo, int index) { TIntObjectHashMap<DuplicatesProfile> patternCache = ourProfileCache.get(dupInfo); if (patternCache == null) { patternCache = new TIntObjectHashMap<>(); ourProfileCache.put(dupInfo, patternCache); } DuplicatesProfile result = patternCache.get(index); if (result == null) { DuplicatesProfile theProfile = null; for (DuplicatesProfile profile : DuplicatesProfile.EP_NAME.getExtensionList()) { if (profile.isMyDuplicate(dupInfo, index)) { theProfile = profile; break; } } result = theProfile == null ? NULL_PROFILE : theProfile; patternCache.put(index, result); } return result == NULL_PROFILE ? null : result; }
Example #7
Source File: FastFrameIdentifier.java From semafor-semantic-parser with GNU General Public License v3.0 | 6 votes |
public FastFrameIdentifier(TObjectDoubleHashMap<String> paramList, String reg, double l, THashMap<String, THashSet<String>> frameMap, THashMap<String, THashSet<String>> wnRelationCache, THashMap<String,THashSet<String>> hvCorrespondenceMap, Map<String, Set<String>> relatedWordsForWord, Map<String, Map<String, Set<String>>> revisedRelationsMap, Map<String, String> hvLemmas) { super(paramList,reg,l,null,frameMap); initializeParameterIndexes(); this.mParamList=paramList; mReg=reg; mLambda=l; mFrameMap=frameMap; totalNumberOfParams=paramList.size(); initializeParameters(); mLookupChart = new TIntObjectHashMap<LogFormula>(); mHvCorrespondenceMap = hvCorrespondenceMap; mRelatedWordsForWord = relatedWordsForWord; mRevisedRelationsMap = revisedRelationsMap; mHVLemmas = hvLemmas; }
Example #8
Source File: ExpandedSupModel.java From semafor-semantic-parser with GNU General Public License v3.0 | 6 votes |
public static TIntObjectHashMap<String> readAlphabet(String alphabetFile) { TIntObjectHashMap<String> map = new TIntObjectHashMap<String>(); try { String line = null; int count = 0; BufferedReader bReader = new BufferedReader(new FileReader(alphabetFile)); while((line=bReader.readLine())!=null) { if(count==0) { count++; continue; } String[] toks = line.trim().split("\t"); map.put(new Integer(toks[1]),toks[0]); } bReader.close(); } catch(Exception e) { e.printStackTrace(); } return map; }
Example #9
Source File: LRIdentificationModelSingleNode.java From semafor-semantic-parser with GNU General Public License v3.0 | 6 votes |
public LRIdentificationModelSingleNode(TObjectDoubleHashMap<String> paramList, ArrayList<String> frameLines, ArrayList<String> parseLines, String reg, double l, String initParamFile, WordNetRelations mWNR,THashMap<String,THashSet<String>> frameMap, String modelFile, String trainOrTest) { mParamList = paramList; initializeParameterIndexes(); this.mFrameLines = frameLines; mNumExamples = mFrameLines.size(); mFrameMap = frameMap; initializeParameters(); totalNumberOfParams=paramList.size(); this.mParseLines = parseLines; mReg=reg; mLambda=l/mNumExamples; mInitParamFile=initParamFile; this.mWNR=mWNR; resetAllGradients(); mFeatureCache = new THashMap<String,THashMap<String,Double>>(); mModelFile=modelFile; mLookupChart = new TIntObjectHashMap<LogFormula>(); mTrainOrTest = ""+trainOrTest; }
Example #10
Source File: SegmentationScore.java From semafor-semantic-parser with GNU General Public License v3.0 | 6 votes |
public static void getScore(TIntObjectHashMap<Set<String>> goldMap, TIntObjectHashMap<Set<String>> autoMap) { int[] keys = goldMap.keys(); double totalGold = 0.0; double totalAuto = 0.0; double correct = 0.0; for (int i = 0; i < keys.length; i ++) { Set<String> gIdxs = goldMap.get(keys[i]); if (!autoMap.contains(keys[i])) { totalGold += gIdxs.size(); } else { Set<String> aIdxs = autoMap.get(keys[i]); totalGold += gIdxs.size(); totalAuto += aIdxs.size(); for (String a: aIdxs) { if (gIdxs.contains(a)) { correct++; } } } } double precision = (correct/totalAuto); double recall = (correct/totalGold); double f = 2 * (precision * recall) / (precision + recall); System.out.println("P="+precision+" R="+recall+" F="+f); }
Example #11
Source File: SegmentationScore.java From semafor-semantic-parser with GNU General Public License v3.0 | 6 votes |
public static void main(String[] args) { String goldFile = args[0]; String autoFile = args[1]; ArrayList<String> goldLines = ParsePreparation.readSentencesFromFile(goldFile); ArrayList<String> autoLines = ParsePreparation.readSentencesFromFile(autoFile); TIntObjectHashMap<Set<String>> goldMap = new TIntObjectHashMap<Set<String>>(); TIntObjectHashMap<Set<String>> autoMap = new TIntObjectHashMap<Set<String>>(); readMap(goldLines, goldMap); readMap(autoLines, autoMap); getScore(goldMap, autoMap); }
Example #12
Source File: DartVmServiceDebugProcess.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
@NotNull private static TIntObjectHashMap<Pair<Integer, Integer>> createTokenPosToLineAndColumnMap(@NotNull final List<List<Integer>> tokenPosTable) { // Each subarray consists of a line number followed by (tokenPos, columnNumber) pairs // see https://github.com/dart-lang/vm_service_drivers/blob/master/dart/tool/service.md#script final TIntObjectHashMap<Pair<Integer, Integer>> result = new TIntObjectHashMap<>(); for (List<Integer> lineAndPairs : tokenPosTable) { final Iterator<Integer> iterator = lineAndPairs.iterator(); final int line = Math.max(0, iterator.next() - 1); while (iterator.hasNext()) { final int tokenPos = iterator.next(); final int column = Math.max(0, iterator.next() - 1); result.put(tokenPos, Pair.create(line, column)); } } return result; }
Example #13
Source File: HighlightCommand.java From CppTools with Apache License 2.0 | 6 votes |
private static void addOneErrorInfo(String str, TIntObjectHashMap<MessageInfo> indexToErrorInfo) { int firstDelimPos = str.indexOf(Communicator.DELIMITER); int secondDelimPos = str.indexOf(Communicator.DELIMITER, firstDelimPos + 1); int lastDelimPos = str.lastIndexOf(Communicator.DELIMITER); int messageId = Integer.parseInt(str.substring(0, firstDelimPos)); String type = str.substring(firstDelimPos + 1, secondDelimPos); AnalyzeProcessor.MessageType messageType = type.indexOf("WARNING") != -1 ? AnalyzeProcessor.MessageType.Warning : type.equals("INFO") ? AnalyzeProcessor.MessageType.Info : type.equals("INTENTION") ? AnalyzeProcessor.MessageType.Intention : AnalyzeProcessor.MessageType.Error; indexToErrorInfo.put( messageId, new MessageInfo( str.substring(secondDelimPos + 1, lastDelimPos), messageType, getIntFromStringWithDefault(str.substring(lastDelimPos + 1)) ) ); }
Example #14
Source File: DartVmServiceDebugProcess.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
@NotNull private static TIntObjectHashMap<Pair<Integer, Integer>> createTokenPosToLineAndColumnMap(@NotNull final List<List<Integer>> tokenPosTable) { // Each subarray consists of a line number followed by (tokenPos, columnNumber) pairs // see https://github.com/dart-lang/vm_service_drivers/blob/master/dart/tool/service.md#script final TIntObjectHashMap<Pair<Integer, Integer>> result = new TIntObjectHashMap<>(); for (List<Integer> lineAndPairs : tokenPosTable) { final Iterator<Integer> iterator = lineAndPairs.iterator(); final int line = Math.max(0, iterator.next() - 1); while (iterator.hasNext()) { final int tokenPos = iterator.next(); final int column = Math.max(0, iterator.next() - 1); result.put(tokenPos, Pair.create(line, column)); } } return result; }
Example #15
Source File: ObservatoryFile.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Unpacks a position token table into a map from position id to Position. * <p> * <p>See <a href="https://github.com/dart-lang/vm_service_drivers/blob/master/dart/tool/service.md#scrip">docs</a>. */ @NotNull private static TIntObjectHashMap<Position> createPositionMap(@NotNull final List<List<Integer>> table) { final TIntObjectHashMap<Position> result = new TIntObjectHashMap<>(); for (List<Integer> line : table) { // Each line consists of a line number followed by (tokenId, columnNumber) pairs. // Both lines and columns are one-based. final Iterator<Integer> items = line.iterator(); // Convert line number from one-based to zero-based. final int lineNumber = Math.max(0, items.next() - 1); while (items.hasNext()) { final int tokenId = items.next(); // Convert column from one-based to zero-based. final int column = Math.max(0, items.next() - 1); result.put(tokenId, new Position(lineNumber, column)); } } return result; }
Example #16
Source File: ObservatoryFile.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Unpacks a position token table into a map from position id to Position. * <p> * <p>See <a href="https://github.com/dart-lang/vm_service_drivers/blob/master/dart/tool/service.md#scrip">docs</a>. */ @NotNull private static TIntObjectHashMap<Position> createPositionMap(@NotNull final List<List<Integer>> table) { final TIntObjectHashMap<Position> result = new TIntObjectHashMap<>(); for (List<Integer> line : table) { // Each line consists of a line number followed by (tokenId, columnNumber) pairs. // Both lines and columns are one-based. final Iterator<Integer> items = line.iterator(); // Convert line number from one-based to zero-based. final int lineNumber = Math.max(0, items.next() - 1); while (items.hasNext()) { final int tokenId = items.next(); // Convert column from one-based to zero-based. final int column = Math.max(0, items.next() - 1); result.put(tokenId, new Position(lineNumber, column)); } } return result; }
Example #17
Source File: AbstractDataGetter.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull public TIntObjectHashMap<T> preLoadCommitData(@Nonnull TIntHashSet commits) throws VcsException { TIntObjectHashMap<T> result = new TIntObjectHashMap<>(); final MultiMap<VirtualFile, String> rootsAndHashes = MultiMap.create(); commits.forEach(commit -> { CommitId commitId = myHashMap.getCommitId(commit); if (commitId != null) { rootsAndHashes.putValue(commitId.getRoot(), commitId.getHash().asString()); } return true; }); for (Map.Entry<VirtualFile, Collection<String>> entry : rootsAndHashes.entrySet()) { VcsLogProvider logProvider = myLogProviders.get(entry.getKey()); if (logProvider != null) { List<? extends T> details = readDetails(logProvider, entry.getKey(), ContainerUtil.newArrayList(entry.getValue())); for (T data : details) { int index = myHashMap.getCommitIndex(data.getId(), data.getRoot()); result.put(index, data); } saveInCache(result); } else { LOG.error("No log provider for root " + entry.getKey().getPath() + ". All known log providers " + myLogProviders); } } return result; }
Example #18
Source File: LineMarkersPass.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull private static List<LineMarkerInfo<PsiElement>> mergeLineMarkers(@Nonnull List<LineMarkerInfo<PsiElement>> markers, @Nonnull Document document) { List<MergeableLineMarkerInfo<PsiElement>> forMerge = new ArrayList<>(); TIntObjectHashMap<List<MergeableLineMarkerInfo<PsiElement>>> sameLineMarkers = new TIntObjectHashMap<>(); for (int i = markers.size() - 1; i >= 0; i--) { LineMarkerInfo<PsiElement> marker = markers.get(i); if (marker instanceof MergeableLineMarkerInfo) { MergeableLineMarkerInfo<PsiElement> mergeable = (MergeableLineMarkerInfo<PsiElement>)marker; forMerge.add(mergeable); markers.remove(i); int line = document.getLineNumber(marker.startOffset); List<MergeableLineMarkerInfo<PsiElement>> infos = sameLineMarkers.get(line); if (infos == null) { infos = new ArrayList<>(); sameLineMarkers.put(line, infos); } infos.add(mergeable); } } if (forMerge.isEmpty()) return markers; List<LineMarkerInfo<PsiElement>> result = new ArrayList<>(markers); sameLineMarkers.forEachValue(infos -> result.addAll(MergeableLineMarkerInfo.merge(infos))); return result; }
Example #19
Source File: ParameterHintsPassFactory.java From consulo with Apache License 2.0 | 5 votes |
private boolean delayRemoval(Inlay inlay, TIntObjectHashMap<Caret> caretMap) { int offset = inlay.getOffset(); Caret caret = caretMap.get(offset); if (caret == null) return false; char afterCaret = myEditor.getDocument().getImmutableCharSequence().charAt(offset); if (afterCaret != ',' && afterCaret != ')') return false; VisualPosition afterInlayPosition = myEditor.offsetToVisualPosition(offset, true, false); // check whether caret is to the right of inlay if (!caret.getVisualPosition().equals(afterInlayPosition)) return false; return true; }
Example #20
Source File: FileTemplateUtil.java From consulo with Apache License 2.0 | 5 votes |
public static Pattern getTemplatePattern(@Nonnull FileTemplate template, @Nonnull Project project, @Nonnull TIntObjectHashMap<String> offsetToProperty) { String templateText = template.getText().trim(); String regex = templateToRegex(templateText, offsetToProperty, project); regex = StringUtil.replace(regex, "with", "(?:with|by)"); regex = ".*(" + regex + ").*"; return Pattern.compile(regex, Pattern.DOTALL); }
Example #21
Source File: FileTemplateUtil.java From consulo with Apache License 2.0 | 5 votes |
private static String templateToRegex(String text, TIntObjectHashMap<String> offsetToProperty, Project project) { List<Object> properties = ContainerUtil.newArrayList(FileTemplateManager.getInstance(project).getDefaultProperties().keySet()); properties.add(FileTemplate.ATTRIBUTE_PACKAGE_NAME); String regex = escapeRegexChars(text); // first group is a whole file header int groupNumber = 1; for (Object property : properties) { String name = property.toString(); String escaped = escapeRegexChars("${" + name + "}"); boolean first = true; for (int i = regex.indexOf(escaped); i != -1 && i < regex.length(); i = regex.indexOf(escaped, i + 1)) { String replacement = first ? "([^\\n]*)" : "\\" + groupNumber; int delta = escaped.length() - replacement.length(); int[] offs = offsetToProperty.keys(); for (int off : offs) { if (off > i) { String prop = offsetToProperty.remove(off); offsetToProperty.put(off - delta, prop); } } offsetToProperty.put(i, name); regex = regex.substring(0, i) + replacement + regex.substring(i + escaped.length()); if (first) { groupNumber++; first = false; } } } return regex; }
Example #22
Source File: HighlightCommand.java From CppTools with Apache License 2.0 | 5 votes |
private RangeHighlighter addOverrideOrOverridenMarker(Editor editor, TIntObjectHashMap<RangeHighlighter> rangeMarkerMap, int hFrom, int hTo, int symbolId, int symNo, THashSet<RangeHighlighter> myHighlighters, THashSet<RangeHighlighter> invalidMarkersSet ) { // final int len = hTo - hFrom; final Document document = editor.getDocument(); hFrom = document.getLineStartOffset(document.getLineNumber(hFrom)); final RangeHighlighter rangeHighlighter = processHighlighter(hFrom, hFrom, symbolId, HighlightUtils.EMPTY_ATTRS, editor, rangeMarkerMap, myHighlighters, invalidMarkersSet); ((HighlightUtils.MyGutterIconRenderer)rangeHighlighter.getGutterIconRenderer()).addData(symNo); return rangeHighlighter; }
Example #23
Source File: HighlightCommand.java From CppTools with Apache License 2.0 | 5 votes |
private static RangeHighlighter processHighlighter(int hFrom, int hTo, int colorIndex, TextAttributes attrs, Editor editor, TIntObjectHashMap<RangeHighlighter> lastOffsetToMarkersMap, THashSet<RangeHighlighter> highlightersSet, THashSet<RangeHighlighter> invalidMarkersSet ) { RangeHighlighter rangeHighlighter = lastOffsetToMarkersMap.get(hFrom); if (rangeHighlighter == null || rangeHighlighter.getEndOffset() != hTo || rangeHighlighter.getTextAttributes() != attrs ) { highlightersSet.add( rangeHighlighter = HighlightUtils.createRangeMarker( editor, hFrom, hTo, colorIndex, attrs ) ); lastOffsetToMarkersMap.put(hFrom, rangeHighlighter); } else { highlightersSet.add(rangeHighlighter); invalidMarkersSet.remove(rangeHighlighter); } return rangeHighlighter; }
Example #24
Source File: Win32FsCache.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull private TIntObjectHashMap<THashMap<String, FileAttributes>> getMap() { TIntObjectHashMap<THashMap<String, FileAttributes>> map = com.intellij.reference.SoftReference.dereference(myCache); if (map == null) { map = new TIntObjectHashMap<THashMap<String, FileAttributes>>(); myCache = new SoftReference<TIntObjectHashMap<THashMap<String, FileAttributes>>>(map); } return map; }
Example #25
Source File: GenericIndex.java From jatecs with GNU General Public License v3.0 | 5 votes |
public GenericIndex(IFeatureDB featuresDB, IDocumentDB documentsDB, ICategoryDB categoriesDB, IDomainDB domainDB, IContentDB contentDB, IWeightingDB weightingDB, IClassificationDB classificationDB) { super(); _name = "generic"; _categoriesDB = categoriesDB; _classificationDB = classificationDB; _contentDB = contentDB; _weightingDB = weightingDB; _documentsDB = documentsDB; _domainDB = domainDB; _featuresDB = featuresDB; _featCatDocCountMap = new TIntObjectHashMap<TShortIntHashMap>(); _cachingEnabled = true; }
Example #26
Source File: BlockRangesMap.java From consulo with Apache License 2.0 | 5 votes |
private static TIntObjectHashMap<LeafBlockWrapper> buildTextRangeToInfoMap(final LeafBlockWrapper first) { final TIntObjectHashMap<LeafBlockWrapper> result = new TIntObjectHashMap<>(); LeafBlockWrapper current = first; while (current != null) { result.put(current.getStartOffset(), current); current = current.getNextBlock(); } return result; }
Example #27
Source File: ExpandedSupModel.java From semafor-semantic-parser with GNU General Public License v3.0 | 5 votes |
public static void main(String[] args) { String supmodel = args[0]; String supalphabet = args[1]; String ssalphabet = args[2]; String outmodel = args[3]; TIntObjectHashMap<String> supAlphabet = readAlphabet(supalphabet); TObjectIntHashMap<String> rSupAlphabet = getReverseMap(supAlphabet); TIntObjectHashMap<String> ssAlphabet = readAlphabet(ssalphabet); int supsize = supAlphabet.size(); int sssize = ssAlphabet.size(); double[] supmodelarr = readDoubleArray(supmodel, supsize+1); double[] ssmodelarr = new double[sssize+1]; ssmodelarr[0] = supmodelarr[0]; for (int i = 1; i < sssize+1; i++) { String feat = ssAlphabet.get(i); if (rSupAlphabet.contains(feat)) { int index = rSupAlphabet.get(feat); ssmodelarr[i] = supmodelarr[index]; } else { ssmodelarr[i] = 1.0; } } writeArray(ssmodelarr, outmodel); }
Example #28
Source File: FlutterWidgetPerf.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 5 votes |
private FilePerfInfo buildSummaryStats(TextEditor fileEditor) { final String path = fileEditor.getFile().getPath(); final FilePerfInfo fileStats = new FilePerfInfo(); for (PerfReportKind kind : PerfReportKind.values()) { final StatsForReportKind forKind = stats.get(kind); if (forKind == null) { continue; } final TIntObjectHashMap<SlidingWindowStats> data = forKind.data; for (Location location : locationsPerFile.get(path)) { final SlidingWindowStats entry = data.get(location.id); if (entry == null) { continue; } final TextRange range = location.textRange; if (range == null) { continue; } fileStats.add( range, new SummaryStats( kind, new SlidingWindowStatsSummary(entry, forKind.lastStartTime, location), location.name ) ); } } return fileStats; }
Example #29
Source File: CodeAttribute.java From whyline with MIT License | 5 votes |
private void resolveTargets(Instruction[] instructionsByByteIndex) throws AnalysisException { // We wait until we know how many instructions there are, since based on empirical data from a profiler, only 10% of // instructions are jumped to with a branch. incomingBranchesByInstructionIndex = new TIntObjectHashMap<SortedSet<Branch>>((int)(instructions.length * .1)); for(Instruction inst : instructions) if(inst instanceof Branch) ((Branch)inst).resolveTargets(instructionsByByteIndex); // Now trim the map to save space. incomingBranchesByInstructionIndex.trimToSize(); }
Example #30
Source File: ProjectDataLoader.java From consulo with Apache License 2.0 | 5 votes |
private static String expand(DataInputStream in, final TIntObjectHashMap dict) throws IOException { return CoverageIOUtil.processWithDictionary(CoverageIOUtil.readUTFFast(in), new CoverageIOUtil.Consumer() { protected String consume(String type) { final int typeIdx; try { typeIdx = Integer.parseInt(type); } catch (NumberFormatException e) { return type; } return ((ClassData) dict.get(typeIdx)).getName(); } }); }