Example usage for com.google.common.collect Multiset clear

List of usage examples for com.google.common.collect Multiset clear

Introduction

In this page you can find the example usage for com.google.common.collect Multiset clear.

Prototype

void clear();

Source Link

Document

Removes all of the elements from this collection (optional operation).

Usage

From source file:com.sonarsource.lits.DumpPhase.java

@VisibleForTesting
private void createMissingIssues(SensorContext context, InputComponent resource) {
    Multiset<IssueKey> componentIssues = checker.getByComponentKey(resource.key());
    if (!componentIssues.isEmpty()) {
        checker.disabled = true;/*from  w  ww .j  a  v  a2  s.com*/
        for (IssueKey issueKey : checker.getByComponentKey(resource.key())) {
            // missing issue => create
            checker.different = true;
            RuleKey ruleKey = RuleKey.parse(issueKey.ruleKey);
            ActiveRule activeRule = profile.getActiveRule(ruleKey.repository(), ruleKey.rule());
            if (activeRule == null) {
                // rule not active => skip it
                checker.inactiveRule(issueKey.ruleKey);
                continue;
            }
            checker.differences++;
            NewIssue newIssue = context.newIssue();
            NewIssueLocation location = newIssue.newLocation().on(resource).message("Missing");
            if (issueKey.line != 0) {
                location.at(((InputFile) resource).selectLine(issueKey.line));
            }
            newIssue.forRule(ruleKey).overrideSeverity(Severity.BLOCKER).at(location).save();
        }
        checker.disabled = false;
        componentIssues.clear();
    }
}