public int getEndIndex() { return getMark(0).getToken().getIndex() + getTokenCount() - 1; }
public void findMatches() { cpdListener.phaseUpdate(CPDListener.HASH); Map<TokenEntry, Object> markGroups = hash(); cpdListener.phaseUpdate(CPDListener.MATCH); MatchCollector matchCollector = new MatchCollector(this); for (Iterator<Object> i = markGroups.values().iterator(); i.hasNext();) { Object o = i.next(); if (o instanceof List) { @SuppressWarnings("unchecked") List<TokenEntry> l = (List<TokenEntry>) o; Collections.reverse(l); matchCollector.collect(l); } i.remove(); } cpdListener.phaseUpdate(CPDListener.GROUPING); matches = matchCollector.getMatches(); for (Match match : matches) { for (Mark mark : match) { TokenEntry token = mark.getToken(); int lineCount = tokens.getLineCount(token, match); mark.setLineCount(lineCount); SourceCode sourceCode = source.get(token.getTokenSrcID()); mark.setSourceCode(sourceCode); } } cpdListener.phaseUpdate(CPDListener.DONE); }
public int getEndIndex() { return getMark(0).getToken().getIndex() + getTokenCount() - 1; }
public void findMatches() { cpdListener.phaseUpdate(CPDListener.HASH); Map<TokenEntry, Object> markGroups = hash(); cpdListener.phaseUpdate(CPDListener.MATCH); MatchCollector matchCollector = new MatchCollector(this); for (Iterator<Object> i = markGroups.values().iterator(); i.hasNext();) { Object o = i.next(); if (o instanceof List) { @SuppressWarnings("unchecked") List<TokenEntry> l = (List<TokenEntry>) o; Collections.reverse(l); matchCollector.collect(l); } i.remove(); } cpdListener.phaseUpdate(CPDListener.GROUPING); matches = matchCollector.getMatches(); for (Match match : matches) { for (Mark mark : match) { TokenEntry token = mark.getToken(); int lineCount = tokens.getLineCount(token, match); mark.setLineCount(lineCount); SourceCode sourceCode = source.get(token.getTokenSrcID()); mark.setSourceCode(sourceCode); } } cpdListener.phaseUpdate(CPDListener.DONE); }
TokenEntry mark = occurrences.next().getToken(); generateFileLine( mark );