comparison flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeMapping.java @ 3453:e74e707ff650

Replace string comparison with empty string with length equals zero comparison flys-artifacts/trunk@5117 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 24 Jul 2012 09:16:00 +0000
parents 9562ca537143
children 8e713e9bb4d7
comparison
equal deleted inserted replaced
3452:200e70f31f6f 3453:e74e707ff650
82 * 82 *
83 * @param text string to be matched against. 83 * @param text string to be matched against.
84 * @return true if pattern matches text or pattern is empty. 84 * @return true if pattern matches text or pattern is empty.
85 */ 85 */
86 public boolean applyPattern(String text) { 86 public boolean applyPattern(String text) {
87 if (patternStr == null || patternStr.equals("")) { 87 if (patternStr == null || patternStr.length() == 0) {
88 return true; 88 return true;
89 } 89 }
90 Matcher m = pattern.matcher(text); 90 Matcher m = pattern.matcher(text);
91 return m.matches(); 91 return m.matches();
92 } 92 }
101 * 101 *
102 * @param artifact Artifact of which to inspect data. 102 * @param artifact Artifact of which to inspect data.
103 * @return true if no condition is specified or condition is met. 103 * @return true if no condition is specified or condition is met.
104 */ 104 */
105 public boolean masterAttrMatches(FLYSArtifact artifact) { 105 public boolean masterAttrMatches(FLYSArtifact artifact) {
106 if (masterAttr == null || masterAttr.equals("")) { 106 if (masterAttr == null || masterAttr.length() == 0) {
107 return true; 107 return true;
108 } 108 }
109 109
110 // Operator split. 110 // Operator split.
111 String[] parts = masterAttr.split("=="); 111 String[] parts = masterAttr.split("==");
123 /** 123 /**
124 * Returns true if no output condition exists, or the condition is met 124 * Returns true if no output condition exists, or the condition is met
125 * in parameter output. 125 * in parameter output.
126 */ 126 */
127 public boolean outputMatches(String output) { 127 public boolean outputMatches(String output) {
128 if (this.output == null || this.output.equals("")) { 128 if (this.output == null || this.output.length() == 0) {
129 return true; 129 return true;
130 } 130 }
131 131
132 return this.output.equals(output); 132 return this.output.equals(output);
133 } 133 }

http://dive4elements.wald.intevation.org