diff options
author | Evgeny Mandrikov <mandrikov@gmail.com> | 2012-02-06 12:43:18 +0400 |
---|---|---|
committer | Fabrice Bellingard <bellingard@gmail.com> | 2012-02-06 16:27:33 +0100 |
commit | ec02a8faea5132013a21349ef75872bbb888a8f4 (patch) | |
tree | 1e414c7eba7669741c6f1493cdbe0e8dfe567520 /sonar-duplications/src/main/java | |
parent | 128122b05d5452ef932bb9cf2b0c02838c14988f (diff) | |
download | sonarqube-ec02a8faea5132013a21349ef75872bbb888a8f4.tar.gz sonarqube-ec02a8faea5132013a21349ef75872bbb888a8f4.zip |
Fix some quality flaws
Diffstat (limited to 'sonar-duplications/src/main/java')
-rw-r--r-- | sonar-duplications/src/main/java/org/sonar/duplications/DuplicationPredicates.java | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/DuplicationPredicates.java b/sonar-duplications/src/main/java/org/sonar/duplications/DuplicationPredicates.java new file mode 100644 index 00000000000..a6e05179fae --- /dev/null +++ b/sonar-duplications/src/main/java/org/sonar/duplications/DuplicationPredicates.java @@ -0,0 +1,48 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2012 SonarSource + * mailto:contact AT sonarsource DOT com + * + * Sonar is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * Sonar is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.duplications; + +import com.google.common.annotations.Beta; +import com.google.common.base.Predicate; +import org.sonar.duplications.index.CloneGroup; + +@Beta +public final class DuplicationPredicates { + + private DuplicationPredicates() { + } + + public static Predicate<CloneGroup> numberOfUnitsNotLessThan(int min) { + return new NumberOfUnitsNotLessThan(min); + } + + private static class NumberOfUnitsNotLessThan implements Predicate<CloneGroup> { + private final int min; + + public NumberOfUnitsNotLessThan(int min) { + this.min = min; + } + + public boolean apply(CloneGroup input) { + return input.getLengthInUnits() >= min; + } + } + +} |