incubator-ivy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xav...@apache.org
Subject svn commit: r578390 - in /incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/namespace: MRIDRule.java MRIDTransformationRule.java NameSpaceHelper.java Namespace.java NamespaceRule.java
Date Sat, 22 Sep 2007 07:55:13 GMT
Author: xavier
Date: Sat Sep 22 00:55:12 2007
New Revision: 578390

URL: http://svn.apache.org/viewvc?rev=578390&view=rev
Log:
clean code

Modified:
    incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/namespace/MRIDRule.java
    incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/namespace/MRIDTransformationRule.java
    incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/namespace/NameSpaceHelper.java
    incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/namespace/Namespace.java
    incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/namespace/NamespaceRule.java

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/namespace/MRIDRule.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/namespace/MRIDRule.java?rev=578390&r1=578389&r2=578390&view=diff
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/namespace/MRIDRule.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/namespace/MRIDRule.java Sat Sep
22 00:55:12 2007
@@ -18,57 +18,57 @@
 package org.apache.ivy.plugins.namespace;
 
 public class MRIDRule {
-    private String _org;
+    private String org;
 
-    private String _module;
+    private String module;
 
-    private String _branch;
+    private String branch;
 
-    private String _rev;
+    private String rev;
 
     public MRIDRule(String org, String mod, String rev) {
-        _org = org;
-        _module = mod;
-        _rev = rev;
+        this.org = org;
+        this.module = mod;
+        this.rev = rev;
     }
 
     public MRIDRule() {
     }
 
     public String getModule() {
-        return _module;
+        return module;
     }
 
     public void setModule(String module) {
-        _module = module;
+        this.module = module;
     }
 
     public String getOrg() {
-        return _org;
+        return org;
     }
 
     public void setOrg(String org) {
-        _org = org;
+        this.org = org;
     }
 
     public String getRev() {
-        return _rev;
+        return rev;
     }
 
     public void setRev(String rev) {
-        _rev = rev;
+        this.rev = rev;
     }
 
     public String toString() {
-        return "[ " + _org + " " + _module + (_branch != null ? " " + _branch : "") + " "
+ _rev
+        return "[ " + org + " " + module + (branch != null ? " " + branch : "") + " " + rev
                 + " ]";
     }
 
     public String getBranch() {
-        return _branch;
+        return branch;
     }
 
     public void setBranch(String branch) {
-        _branch = branch;
+        this.branch = branch;
     }
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/namespace/MRIDTransformationRule.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/namespace/MRIDTransformationRule.java?rev=578390&r1=578389&r2=578390&view=diff
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/namespace/MRIDTransformationRule.java
(original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/namespace/MRIDTransformationRule.java
Sat Sep 22 00:55:12 2007
@@ -30,33 +30,35 @@
     private static class MridRuleMatcher {
         private static final String[] TYPES = new String[] {"o", "m", "b", "r"};
 
-        private Matcher[] _matchers = new Matcher[4];
+        private Matcher[] matchers = new Matcher[TYPES.length];
 
         public boolean match(MRIDRule src, ModuleRevisionId mrid) {
-            _matchers[0] = Pattern.compile(getPattern(src.getOrg()))
+            //CheckStyle:MagicNumber| OFF
+            matchers[0] = Pattern.compile(getPattern(src.getOrg()))
                     .matcher(mrid.getOrganisation());
-            if (!_matchers[0].matches()) {
+            if (!matchers[0].matches()) {
                 return false;
             }
-            _matchers[1] = Pattern.compile(getPattern(src.getModule())).matcher(mrid.getName());
-            if (!_matchers[1].matches()) {
+            matchers[1] = Pattern.compile(getPattern(src.getModule())).matcher(mrid.getName());
+            if (!matchers[1].matches()) {
                 return false;
             }
             if (mrid.getBranch() == null) {
-                _matchers[2] = null;
+                matchers[2] = null;
             } else {
-                _matchers[2] = Pattern.compile(getPattern(src.getBranch())).matcher(
+                matchers[2] = Pattern.compile(getPattern(src.getBranch())).matcher(
                     mrid.getBranch());
-                if (!_matchers[2].matches()) {
+                if (!matchers[2].matches()) {
                     return false;
                 }
             }
-            _matchers[3] = Pattern.compile(getPattern(src.getRev())).matcher(mrid.getRevision());
-            if (!_matchers[3].matches()) {
+            matchers[3] = Pattern.compile(getPattern(src.getRev())).matcher(mrid.getRevision());
+            if (!matchers[3].matches()) {
                 return false;
             }
 
             return true;
+            //CheckStyle:MagicNumber| ON
         }
 
         public ModuleRevisionId apply(MRIDRule dest, ModuleRevisionId mrid) {
@@ -70,7 +72,7 @@
 
         private String applyRules(String str, String type) {
             for (int i = 0; i < TYPES.length; i++) {
-                str = applyTypeRule(str, TYPES[i], type, _matchers[i]);
+                str = applyTypeRule(str, TYPES[i], type, matchers[i]);
             }
             return str;
         }
@@ -109,28 +111,28 @@
         }
     }
 
-    private List _src = new ArrayList();
+    private List src = new ArrayList();
 
-    private MRIDRule _dest;
+    private MRIDRule dest;
 
     public void addSrc(MRIDRule src) {
-        _src.add(src);
+        this.src.add(src);
     }
 
     public void addDest(MRIDRule dest) {
-        if (_dest != null) {
+        if (dest != null) {
             throw new IllegalArgumentException("only one dest is allowed per mapping");
         }
-        _dest = dest;
+        this.dest = dest;
     }
 
     public ModuleRevisionId transform(ModuleRevisionId mrid) {
         MridRuleMatcher matcher = new MridRuleMatcher();
-        for (Iterator iter = _src.iterator(); iter.hasNext();) {
+        for (Iterator iter = src.iterator(); iter.hasNext();) {
             MRIDRule rule = (MRIDRule) iter.next();
             if (matcher.match(rule, mrid)) {
-                ModuleRevisionId destMrid = matcher.apply(_dest, mrid);
-                Message.debug("found matching namespace rule: " + rule + ". Applied " + _dest
+                ModuleRevisionId destMrid = matcher.apply(dest, mrid);
+                Message.debug("found matching namespace rule: " + rule + ". Applied " + dest
                         + " on " + mrid + ". Transformed to " + destMrid);
                 return destMrid;
             }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/namespace/NameSpaceHelper.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/namespace/NameSpaceHelper.java?rev=578390&r1=578389&r2=578390&view=diff
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/namespace/NameSpaceHelper.java
(original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/namespace/NameSpaceHelper.java
Sat Sep 22 00:55:12 2007
@@ -29,7 +29,9 @@
 import org.apache.ivy.core.resolve.DefaultModuleRevision;
 import org.apache.ivy.core.resolve.ResolvedModuleRevision;
 
-public class NameSpaceHelper {
+public final class NameSpaceHelper {
+    private NameSpaceHelper() {
+    }
 
     public static DependencyDescriptor toSystem(DependencyDescriptor dd, Namespace ns) {
         return DefaultDependencyDescriptor.transformInstance(dd, ns);

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/namespace/Namespace.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/namespace/Namespace.java?rev=578390&r1=578389&r2=578390&view=diff
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/namespace/Namespace.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/namespace/Namespace.java Sat
Sep 22 00:55:12 2007
@@ -29,18 +29,18 @@
         SYSTEM_NAMESPACE = new Namespace();
     }
 
-    private List _rules = new ArrayList();
+    private List rules = new ArrayList();
 
-    private String _name;
+    private String name;
 
-    private boolean _chainRules = false;
+    private boolean chainRules = false;
 
-    private NamespaceTransformer _fromSystemTransformer = new NamespaceTransformer() {
+    private NamespaceTransformer fromSystemTransformer = new NamespaceTransformer() {
         public ModuleRevisionId transform(ModuleRevisionId mrid) {
-            for (Iterator iter = _rules.iterator(); iter.hasNext();) {
+            for (Iterator iter = rules.iterator(); iter.hasNext();) {
                 NamespaceRule rule = (NamespaceRule) iter.next();
                 ModuleRevisionId nmrid = rule.getFromSystem().transform(mrid);
-                if (_chainRules) {
+                if (chainRules) {
                     mrid = nmrid;
                 } else if (!nmrid.equals(mrid)) {
                     return nmrid;
@@ -50,16 +50,16 @@
         }
 
         public boolean isIdentity() {
-            return _rules.isEmpty();
+            return rules.isEmpty();
         }
     };
 
-    private NamespaceTransformer _toSystemTransformer = new NamespaceTransformer() {
+    private NamespaceTransformer toSystemTransformer = new NamespaceTransformer() {
         public ModuleRevisionId transform(ModuleRevisionId mrid) {
-            for (Iterator iter = _rules.iterator(); iter.hasNext();) {
+            for (Iterator iter = rules.iterator(); iter.hasNext();) {
                 NamespaceRule rule = (NamespaceRule) iter.next();
                 ModuleRevisionId nmrid = rule.getToSystem().transform(mrid);
-                if (_chainRules) {
+                if (chainRules) {
                     mrid = nmrid;
                 } else if (!nmrid.equals(mrid)) {
                     return nmrid;
@@ -69,35 +69,35 @@
         }
 
         public boolean isIdentity() {
-            return _rules.isEmpty();
+            return rules.isEmpty();
         }
     };
 
     public void addRule(NamespaceRule rule) {
-        _rules.add(rule);
+        rules.add(rule);
     }
 
     public String getName() {
-        return _name;
+        return name;
     }
 
     public void setName(String name) {
-        _name = name;
+        this.name = name;
     }
 
     public NamespaceTransformer getFromSystemTransformer() {
-        return _fromSystemTransformer;
+        return fromSystemTransformer;
     }
 
     public NamespaceTransformer getToSystemTransformer() {
-        return _toSystemTransformer;
+        return toSystemTransformer;
     }
 
     public boolean isChainrules() {
-        return _chainRules;
+        return chainRules;
     }
 
     public void setChainrules(boolean chainRules) {
-        _chainRules = chainRules;
+        this.chainRules = chainRules;
     }
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/namespace/NamespaceRule.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/namespace/NamespaceRule.java?rev=578390&r1=578389&r2=578390&view=diff
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/namespace/NamespaceRule.java
(original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/namespace/NamespaceRule.java
Sat Sep 22 00:55:12 2007
@@ -18,49 +18,49 @@
 package org.apache.ivy.plugins.namespace;
 
 public class NamespaceRule {
-    private String _name;
+    private String name;
 
-    private String _description;
+    private String description;
 
-    private MRIDTransformationRule _fromSystem;
+    private MRIDTransformationRule fromSystem;
 
-    private MRIDTransformationRule _toSystem;
+    private MRIDTransformationRule toSystem;
 
     public MRIDTransformationRule getFromSystem() {
-        return _fromSystem;
+        return fromSystem;
     }
 
     public void addFromsystem(MRIDTransformationRule fromSystem) {
-        if (_fromSystem != null) {
+        if (fromSystem != null) {
             throw new IllegalArgumentException("only one fromsystem is allowed per rule");
         }
-        _fromSystem = fromSystem;
+        this.fromSystem = fromSystem;
     }
 
     public MRIDTransformationRule getToSystem() {
-        return _toSystem;
+        return toSystem;
     }
 
     public void addTosystem(MRIDTransformationRule toSystem) {
-        if (_toSystem != null) {
+        if (toSystem != null) {
             throw new IllegalArgumentException("only one tosystem is allowed per rule");
         }
-        _toSystem = toSystem;
+        this.toSystem = toSystem;
     }
 
     public String getDescription() {
-        return _description;
+        return description;
     }
 
     public void setDescription(String description) {
-        _description = description;
+        this.description = description;
     }
 
     public String getName() {
-        return _name;
+        return name;
     }
 
     public void setName(String name) {
-        _name = name;
+        this.name = name;
     }
 }



Mime
View raw message