Logo Search packages:      
Sourcecode: maven-repo-helper version File versions

int org::debian::maven::repo::DependencyRule::compareTo ( Object  o  )  [inline]

Natural sort order: from the most specific rules to the most generic rules, a rule is more generic if a generic match appears on th egroup rule, then artifact rule, then type rule, then version rule. If 2 rules have the same order of genericity, then use an alphabetical sorting of the pattern strings.

Definition at line 71 of file DependencyRule.java.

References artifactRule, groupRule, scopeRule, toPatternString(), typeRule, and versionRule.

Referenced by org::debian::maven::repo::DependencyRuleTest::testCompareTo().

                                   {
        DependencyRule other = (DependencyRule) o;
        if (groupRule.isGeneric() && !other.groupRule.isGeneric()) {
            return 1;
        }
        if (!groupRule.isGeneric() && other.groupRule.isGeneric()) {
            return -1;
        }
        if (artifactRule.isGeneric() && !other.artifactRule.isGeneric()) {
            return 1;
        }
        if (!artifactRule.isGeneric() && other.artifactRule.isGeneric()) {
            return -1;
        }
        if (typeRule.isGeneric() && !other.typeRule.isGeneric()) {
            return 1;
        }
        if (!typeRule.isGeneric() && other.typeRule.isGeneric()) {
            return -1;
        }
        if (versionRule.isGeneric() && !other.versionRule.isGeneric()) {
            return 1;
        }
        if (!versionRule.isGeneric() && other.versionRule.isGeneric()) {
            return -1;
        }
        if (scopeRule.isGeneric() && !other.scopeRule.isGeneric()) {
            return 1;
        }
        if (!scopeRule.isGeneric() && other.scopeRule.isGeneric()) {
            return -1;
        }
        return this.toPatternString().compareTo(other.toPatternString());
    }


Generated by  Doxygen 1.6.0   Back to index