Skip to content

Commit d911f5f

Browse files
author
Niall Kegan Pemberton
committed
Remove tabs
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/codec/trunk@658834 13f79535-47bb-0310-9956-ffa450edef68
1 parent b1a9534 commit d911f5f

12 files changed

Lines changed: 460 additions & 460 deletions

File tree

src/java/org/apache/commons/codec/binary/Hex.java

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public static char[] encodeHex(byte[] data) {
113113

114114
return out;
115115
}
116-
116+
117117
/**
118118
* Converts an array of character bytes representing hexidecimal values into an
119119
* array of bytes of those same values. The returned array will be half the
@@ -128,10 +128,10 @@ public static char[] encodeHex(byte[] data) {
128128
* to this function
129129
* @see #decodeHex(char[])
130130
*/
131-
public byte[] decode(byte[] array) throws DecoderException {
132-
return decodeHex(new String(array).toCharArray());
133-
}
134-
131+
public byte[] decode(byte[] array) throws DecoderException {
132+
return decodeHex(new String(array).toCharArray());
133+
}
134+
135135
/**
136136
* Converts a String or an array of character bytes representing hexidecimal values into an
137137
* array of bytes of those same values. The returned array will be half the
@@ -146,15 +146,15 @@ public byte[] decode(byte[] array) throws DecoderException {
146146
* to this function or the object is not a String or char[]
147147
* @see #decodeHex(char[])
148148
*/
149-
public Object decode(Object object) throws DecoderException {
150-
try {
149+
public Object decode(Object object) throws DecoderException {
150+
try {
151151
char[] charArray = object instanceof String ? ((String) object).toCharArray() : (char[]) object;
152-
return decodeHex(charArray);
153-
} catch (ClassCastException e) {
154-
throw new DecoderException(e.getMessage());
155-
}
156-
}
157-
152+
return decodeHex(charArray);
153+
} catch (ClassCastException e) {
154+
throw new DecoderException(e.getMessage());
155+
}
156+
}
157+
158158
/**
159159
* Converts an array of bytes into an array of bytes for the characters representing the
160160
* hexidecimal values of each byte in order. The returned array will be
@@ -165,9 +165,9 @@ public Object decode(Object object) throws DecoderException {
165165
* @return A byte[] containing the bytes of the hexidecimal characters
166166
* @see #encodeHex(byte[])
167167
*/
168-
public byte[] encode(byte[] array) {
169-
return new String(encodeHex(array)).getBytes();
170-
}
168+
public byte[] encode(byte[] array) {
169+
return new String(encodeHex(array)).getBytes();
170+
}
171171

172172
/**
173173
* Converts a String or an array of bytes into an array of characters representing the
@@ -180,14 +180,14 @@ public byte[] encode(byte[] array) {
180180
* @throws EncoderException Thrown if the given object is not a String or byte[]
181181
* @see #encodeHex(byte[])
182182
*/
183-
public Object encode(Object object) throws EncoderException {
184-
try {
183+
public Object encode(Object object) throws EncoderException {
184+
try {
185185
byte[] byteArray = object instanceof String ? ((String) object).getBytes() : (byte[]) object;
186-
return encodeHex(byteArray);
187-
} catch (ClassCastException e) {
188-
throw new EncoderException(e.getMessage());
189-
}
190-
}
186+
return encodeHex(byteArray);
187+
} catch (ClassCastException e) {
188+
throw new EncoderException(e.getMessage());
189+
}
190+
}
191191

192192
}
193193

src/java/org/apache/commons/codec/language/DoubleMetaphone.java

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -807,24 +807,24 @@ private int handleZ(String value, DoubleMetaphoneResult result, int index,
807807
* Complex condition 0 for 'C'
808808
*/
809809
private boolean conditionC0(String value, int index) {
810-
if (contains(value, index, 4, "CHIA")) {
811-
return true;
812-
} else if (index <= 1) {
813-
return false;
814-
} else if (isVowel(charAt(value, index - 2))) {
815-
return false;
816-
} else if (!contains(value, index - 1, 3, "ACH")) {
817-
return false;
818-
} else {
819-
char c = charAt(value, index + 2);
820-
return (c != 'I' && c != 'E') ||
821-
contains(value, index - 2, 6, "BACHER", "MACHER");
822-
}
823-
}
810+
if (contains(value, index, 4, "CHIA")) {
811+
return true;
812+
} else if (index <= 1) {
813+
return false;
814+
} else if (isVowel(charAt(value, index - 2))) {
815+
return false;
816+
} else if (!contains(value, index - 1, 3, "ACH")) {
817+
return false;
818+
} else {
819+
char c = charAt(value, index + 2);
820+
return (c != 'I' && c != 'E') ||
821+
contains(value, index - 2, 6, "BACHER", "MACHER");
822+
}
823+
}
824824

825825
/**
826-
* Complex condition 0 for 'CH'
827-
*/
826+
* Complex condition 0 for 'CH'
827+
*/
828828
private boolean conditionCH0(String value, int index) {
829829
if (index != 0) {
830830
return false;
@@ -870,20 +870,20 @@ private boolean conditionL0(String value, int index) {
870870
* Complex condition 0 for 'M'
871871
*/
872872
private boolean conditionM0(String value, int index) {
873-
if (charAt(value, index + 1) == 'M') {
874-
return true;
875-
}
876-
return contains(value, index - 1, 3, "UMB") &&
877-
((index + 1) == value.length() - 1 || contains(value,
878-
index + 2, 2, "ER"));
879-
}
873+
if (charAt(value, index + 1) == 'M') {
874+
return true;
875+
}
876+
return contains(value, index - 1, 3, "UMB") &&
877+
((index + 1) == value.length() - 1 || contains(value,
878+
index + 2, 2, "ER"));
879+
}
880880

881881
//-- BEGIN HELPER FUNCTIONS --//
882882

883883
/**
884-
* Determines whether or not a value is of slavo-germanic orgin. A value is
885-
* of slavo-germanic origin if it contians any of 'W', 'K', 'CZ', or 'WITZ'.
886-
*/
884+
* Determines whether or not a value is of slavo-germanic orgin. A value is
885+
* of slavo-germanic origin if it contians any of 'W', 'K', 'CZ', or 'WITZ'.
886+
*/
887887
private boolean isSlavoGermanic(String value) {
888888
return value.indexOf('W') > -1 || value.indexOf('K') > -1 ||
889889
value.indexOf("CZ") > -1 || value.indexOf("WITZ") > -1;
@@ -916,21 +916,21 @@ private boolean isSilentStart(String value) {
916916
* Cleans the input
917917
*/
918918
private String cleanInput(String input) {
919-
if (input == null) {
920-
return null;
921-
}
922-
input = input.trim();
923-
if (input.length() == 0) {
924-
return null;
925-
}
926-
return input.toUpperCase(java.util.Locale.ENGLISH);
927-
}
919+
if (input == null) {
920+
return null;
921+
}
922+
input = input.trim();
923+
if (input.length() == 0) {
924+
return null;
925+
}
926+
return input.toUpperCase(java.util.Locale.ENGLISH);
927+
}
928928

929929
/**
930-
* Gets the character at index <code>index</code> if available, otherwise
931-
* it returns <code>Character.MIN_VALUE</code> so that there is some sort
932-
* of a default
933-
*/
930+
* Gets the character at index <code>index</code> if available, otherwise
931+
* it returns <code>Character.MIN_VALUE</code> so that there is some sort
932+
* of a default
933+
*/
934934
protected char charAt(String value, int index) {
935935
if (index < 0 || index >= value.length()) {
936936
return Character.MIN_VALUE;

src/java/org/apache/commons/codec/language/Metaphone.java

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public String metaphone(String txt) {
135135
int n = 0 ;
136136

137137
while ((code.length() < this.getMaxCodeLen()) &&
138-
(n < wdsz) ) { // max code size of 4 works well
138+
(n < wdsz) ) { // max code size of 4 works well
139139
char symb = local.charAt(n) ;
140140
// remove duplicate letters except C
141141
if ((symb != 'C') && (isPreviousChar( local, n, symb )) ) {
@@ -150,7 +150,7 @@ public String metaphone(String txt) {
150150
case 'B' :
151151
if ( isPreviousChar(local, n, 'M') &&
152152
isLastChar(wdsz, n) ) { // B is silent if word ends in MB
153-
break;
153+
break;
154154
}
155155
code.append(symb);
156156
break;
@@ -171,13 +171,13 @@ public String metaphone(String txt) {
171171
break; // CI,CE,CY -> S
172172
}
173173
if (isPreviousChar(local, n, 'S') &&
174-
isNextChar(local, n, 'H') ) { // SCH->sk
174+
isNextChar(local, n, 'H') ) { // SCH->sk
175175
code.append('K') ;
176176
break ;
177177
}
178178
if (isNextChar(local, n, 'H')) { // detect CH
179179
if ((n == 0) &&
180-
(wdsz >= 3) &&
180+
(wdsz >= 3) &&
181181
isVowel(local,2) ) { // CH consonant -> K consonant
182182
code.append('K');
183183
} else {
@@ -207,8 +207,8 @@ public String metaphone(String txt) {
207207
break;
208208
}
209209
if ((n > 0) &&
210-
( regionMatch(local, n, "GN") ||
211-
regionMatch(local, n, "GNED") ) ) {
210+
( regionMatch(local, n, "GN") ||
211+
regionMatch(local, n, "GNED") ) ) {
212212
break; // silent G
213213
}
214214
if (isPreviousChar(local, n, 'G')) {
@@ -266,21 +266,21 @@ public String metaphone(String txt) {
266266
break;
267267
case 'S' :
268268
if (regionMatch(local,n,"SH") ||
269-
regionMatch(local,n,"SIO") ||
270-
regionMatch(local,n,"SIA")) {
269+
regionMatch(local,n,"SIO") ||
270+
regionMatch(local,n,"SIA")) {
271271
code.append('X');
272272
} else {
273273
code.append('S');
274274
}
275275
break;
276276
case 'T' :
277277
if (regionMatch(local,n,"TIA") ||
278-
regionMatch(local,n,"TIO")) {
278+
regionMatch(local,n,"TIO")) {
279279
code.append('X');
280280
break;
281281
}
282282
if (regionMatch(local,n,"TCH")) {
283-
// Silent if in "TCH"
283+
// Silent if in "TCH"
284284
break;
285285
}
286286
// substitute numeral 0 for TH (resembles theta after all)
@@ -294,7 +294,7 @@ public String metaphone(String txt) {
294294
code.append('F'); break ;
295295
case 'W' : case 'Y' : // silent if not followed by vowel
296296
if (!isLastChar(wdsz,n) &&
297-
isVowel(local,n+1)) {
297+
isVowel(local,n+1)) {
298298
code.append(symb);
299299
}
300300
break ;
@@ -307,47 +307,47 @@ public String metaphone(String txt) {
307307
n++ ;
308308
} // end else from symb != 'C'
309309
if (code.length() > this.getMaxCodeLen()) {
310-
code.setLength(this.getMaxCodeLen());
310+
code.setLength(this.getMaxCodeLen());
311311
}
312312
}
313313
return code.toString();
314314
}
315315

316-
private boolean isVowel(StringBuffer string, int index) {
317-
return VOWELS.indexOf(string.charAt(index)) >= 0;
318-
}
316+
private boolean isVowel(StringBuffer string, int index) {
317+
return VOWELS.indexOf(string.charAt(index)) >= 0;
318+
}
319319

320-
private boolean isPreviousChar(StringBuffer string, int index, char c) {
321-
boolean matches = false;
322-
if( index > 0 &&
323-
index < string.length() ) {
324-
matches = string.charAt(index - 1) == c;
325-
}
326-
return matches;
327-
}
320+
private boolean isPreviousChar(StringBuffer string, int index, char c) {
321+
boolean matches = false;
322+
if( index > 0 &&
323+
index < string.length() ) {
324+
matches = string.charAt(index - 1) == c;
325+
}
326+
return matches;
327+
}
328328

329-
private boolean isNextChar(StringBuffer string, int index, char c) {
330-
boolean matches = false;
331-
if( index >= 0 &&
332-
index < string.length() - 1 ) {
333-
matches = string.charAt(index + 1) == c;
334-
}
335-
return matches;
336-
}
329+
private boolean isNextChar(StringBuffer string, int index, char c) {
330+
boolean matches = false;
331+
if( index >= 0 &&
332+
index < string.length() - 1 ) {
333+
matches = string.charAt(index + 1) == c;
334+
}
335+
return matches;
336+
}
337337

338-
private boolean regionMatch(StringBuffer string, int index, String test) {
339-
boolean matches = false;
340-
if( index >= 0 &&
341-
(index + test.length() - 1) < string.length() ) {
342-
String substring = string.substring( index, index + test.length());
343-
matches = substring.equals( test );
344-
}
345-
return matches;
346-
}
338+
private boolean regionMatch(StringBuffer string, int index, String test) {
339+
boolean matches = false;
340+
if( index >= 0 &&
341+
(index + test.length() - 1) < string.length() ) {
342+
String substring = string.substring( index, index + test.length());
343+
matches = substring.equals( test );
344+
}
345+
return matches;
346+
}
347347

348-
private boolean isLastChar(int wdsz, int n) {
349-
return n + 1 == wdsz;
350-
}
348+
private boolean isLastChar(int wdsz, int n) {
349+
return n + 1 == wdsz;
350+
}
351351

352352

353353
/**

0 commit comments

Comments
 (0)