Author: sebb Date: Fri Mar 25 02:13:45 2011 New Revision: 1085238 URL: http://svn.apache.org/viewvc?rev=1085238&view=rev Log: eol-style
Modified: commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/AbstractCaverphone.java (contents, props changed) commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/Caverphone1.java (contents, props changed) commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/Caverphone2.java (contents, props changed) commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/Utils.java (contents, props changed) commons/proper/codec/trunk/src/test/org/apache/commons/codec/DecoderExceptionTest.java (contents, props changed) commons/proper/codec/trunk/src/test/org/apache/commons/codec/EncoderExceptionTest.java (contents, props changed) commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Codec105ErrorInputStream.java (props changed) commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/Caverphone1Test.java (contents, props changed) commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/Caverphone2Test.java (contents, props changed) commons/proper/codec/trunk/src/test/org/apache/commons/codec/net/UtilsTest.java (contents, props changed) Modified: commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/AbstractCaverphone.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/AbstractCaverphone.java?rev=1085238&r1=1085237&r2=1085238&view=diff ============================================================================== --- commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/AbstractCaverphone.java (original) +++ commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/AbstractCaverphone.java Fri Mar 25 02:13:45 2011 @@ -1,77 +1,77 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.codec.language; - -import org.apache.commons.codec.EncoderException; -import org.apache.commons.codec.StringEncoder; - -/** - * Encodes a string into a Caverphone value. - * - * This is an algorithm created by the Caversham Project at the University of Otago. It implements the Caverphone 2.0 - * algorithm: - * - * @author Apache Software Foundation - * @version $Id: Caverphone.java 1075947 2011-03-01 17:56:14Z ggregory $ - * @see <a href="http://en.wikipedia.org/wiki/Caverphone">Wikipedia - Caverphone</a> - * @since 1.5 - */ -public abstract class AbstractCaverphone implements StringEncoder { - - /** - * Creates an instance of the Caverphone encoder - */ - public AbstractCaverphone() { - super(); - } - - /** - * Encodes an Object using the caverphone algorithm. This method is provided in order to satisfy the requirements of - * the Encoder interface, and will throw an EncoderException if the supplied object is not of type java.lang.String. - * - * @param source - * Object to encode - * @return An object (or type java.lang.String) containing the caverphone code which corresponds to the String - * supplied. - * @throws EncoderException - * if the parameter supplied is not of type java.lang.String - */ - public Object encode(Object source) throws EncoderException { - if (!(source instanceof String)) { - throw new EncoderException("Parameter supplied to Caverphone encode is not of type java.lang.String"); - } - return this.encode((String) source); - } - - /** - * Tests if the encodings of two strings are equal. - * - * This method might be promoted to a new AbstractStringEncoder superclass. - * - * @param str1 - * First of two strings to compare - * @param str2 - * Second of two strings to compare - * @return <code>true</code> if the encodings of these strings are identical, <code>false</code> otherwise. - * @throws EncoderException - */ - public boolean isEncodeEqual(String str1, String str2) throws EncoderException { - return this.encode(str1).equals(this.encode(str2)); - } - -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.codec.language; + +import org.apache.commons.codec.EncoderException; +import org.apache.commons.codec.StringEncoder; + +/** + * Encodes a string into a Caverphone value. + * + * This is an algorithm created by the Caversham Project at the University of Otago. It implements the Caverphone 2.0 + * algorithm: + * + * @author Apache Software Foundation + * @version $Id: Caverphone.java 1075947 2011-03-01 17:56:14Z ggregory $ + * @see <a href="http://en.wikipedia.org/wiki/Caverphone">Wikipedia - Caverphone</a> + * @since 1.5 + */ +public abstract class AbstractCaverphone implements StringEncoder { + + /** + * Creates an instance of the Caverphone encoder + */ + public AbstractCaverphone() { + super(); + } + + /** + * Encodes an Object using the caverphone algorithm. This method is provided in order to satisfy the requirements of + * the Encoder interface, and will throw an EncoderException if the supplied object is not of type java.lang.String. + * + * @param source + * Object to encode + * @return An object (or type java.lang.String) containing the caverphone code which corresponds to the String + * supplied. + * @throws EncoderException + * if the parameter supplied is not of type java.lang.String + */ + public Object encode(Object source) throws EncoderException { + if (!(source instanceof String)) { + throw new EncoderException("Parameter supplied to Caverphone encode is not of type java.lang.String"); + } + return this.encode((String) source); + } + + /** + * Tests if the encodings of two strings are equal. + * + * This method might be promoted to a new AbstractStringEncoder superclass. + * + * @param str1 + * First of two strings to compare + * @param str2 + * Second of two strings to compare + * @return <code>true</code> if the encodings of these strings are identical, <code>false</code> otherwise. + * @throws EncoderException + */ + public boolean isEncodeEqual(String str1, String str2) throws EncoderException { + return this.encode(str1).equals(this.encode(str2)); + } + +} Propchange: commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/AbstractCaverphone.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/Caverphone1.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/Caverphone1.java?rev=1085238&r1=1085237&r2=1085238&view=diff ============================================================================== --- commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/Caverphone1.java (original) +++ commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/Caverphone1.java Fri Mar 25 02:13:45 2011 @@ -1,125 +1,125 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.codec.language; - -/** - * Encodes a string into a Caverphone 1.0 value. - * - * This is an algorithm created by the Caversham Project at the University of Otago. It implements the Caverphone 1.0 - * algorithm: - * - * @author Apache Software Foundation - * @version $Id: Caverphone.java 1075947 2011-03-01 17:56:14Z ggregory $ - * @see <a href="http://en.wikipedia.org/wiki/Caverphone">Wikipedia - Caverphone</a> - * @see <a href="http://caversham.otago.ac.nz/files/working/ctp060902.pdf">Caverphone 1.0 specification</a> - * @since 1.5 - */ -public class Caverphone1 extends AbstractCaverphone { - - private static final String SIX_1 = "111111"; - - /** - * Encodes the given String into a Caverphone value. - * - * @param source - * String the source string - * @return A caverphone code for the given String - */ - public String encode(String source) { - String txt = source; - if (txt == null || txt.length() == 0) { - return SIX_1; - } - - // 1. Convert to lowercase - txt = txt.toLowerCase(java.util.Locale.ENGLISH); - - // 2. Remove anything not A-Z - txt = txt.replaceAll("[^a-z]", ""); - - // 3. Handle various start options - // 2 is a temporary placeholder to indicate a consonant which we are no longer interested in. - txt = txt.replaceAll("^cough", "cou2f"); - txt = txt.replaceAll("^rough", "rou2f"); - txt = txt.replaceAll("^tough", "tou2f"); - txt = txt.replaceAll("^enough", "enou2f"); - txt = txt.replaceAll("^gn", "2n"); - - // End - txt = txt.replaceAll("mb$", "m2"); - - // 4. Handle replacements - txt = txt.replaceAll("cq", "2q"); - txt = txt.replaceAll("ci", "si"); - txt = txt.replaceAll("ce", "se"); - txt = txt.replaceAll("cy", "sy"); - txt = txt.replaceAll("tch", "2ch"); - txt = txt.replaceAll("c", "k"); - txt = txt.replaceAll("q", "k"); - txt = txt.replaceAll("x", "k"); - txt = txt.replaceAll("v", "f"); - txt = txt.replaceAll("dg", "2g"); - txt = txt.replaceAll("tio", "sio"); - txt = txt.replaceAll("tia", "sia"); - txt = txt.replaceAll("d", "t"); - txt = txt.replaceAll("ph", "fh"); - txt = txt.replaceAll("b", "p"); - txt = txt.replaceAll("sh", "s2"); - txt = txt.replaceAll("z", "s"); - txt = txt.replaceAll("^[aeiou]", "A"); - // 3 is a temporary placeholder marking a vowel - txt = txt.replaceAll("[aeiou]", "3"); - txt = txt.replaceAll("3gh3", "3kh3"); - txt = txt.replaceAll("gh", "22"); - txt = txt.replaceAll("g", "k"); - txt = txt.replaceAll("s+", "S"); - txt = txt.replaceAll("t+", "T"); - txt = txt.replaceAll("p+", "P"); - txt = txt.replaceAll("k+", "K"); - txt = txt.replaceAll("f+", "F"); - txt = txt.replaceAll("m+", "M"); - txt = txt.replaceAll("n+", "N"); - txt = txt.replaceAll("w3", "W3"); - txt = txt.replaceAll("wy", "Wy"); // 1.0 only - txt = txt.replaceAll("wh3", "Wh3"); - txt = txt.replaceAll("why", "Why"); // 1.0 only - txt = txt.replaceAll("w", "2"); - txt = txt.replaceAll("^h", "A"); - txt = txt.replaceAll("h", "2"); - txt = txt.replaceAll("r3", "R3"); - txt = txt.replaceAll("ry", "Ry"); // 1.0 only - txt = txt.replaceAll("r", "2"); - txt = txt.replaceAll("l3", "L3"); - txt = txt.replaceAll("ly", "Ly"); // 1.0 only - txt = txt.replaceAll("l", "2"); - txt = txt.replaceAll("j", "y"); // 1.0 only - txt = txt.replaceAll("y3", "Y3"); // 1.0 only - txt = txt.replaceAll("y", "2"); // 1.0 only - - // 5. Handle removals - txt = txt.replaceAll("2", ""); - txt = txt.replaceAll("3", ""); - - // 6. put ten 1s on the end - txt = txt + SIX_1; - - // 7. take the first six characters as the code - return txt.substring(0, SIX_1.length()); - } - -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.codec.language; + +/** + * Encodes a string into a Caverphone 1.0 value. + * + * This is an algorithm created by the Caversham Project at the University of Otago. It implements the Caverphone 1.0 + * algorithm: + * + * @author Apache Software Foundation + * @version $Id: Caverphone.java 1075947 2011-03-01 17:56:14Z ggregory $ + * @see <a href="http://en.wikipedia.org/wiki/Caverphone">Wikipedia - Caverphone</a> + * @see <a href="http://caversham.otago.ac.nz/files/working/ctp060902.pdf">Caverphone 1.0 specification</a> + * @since 1.5 + */ +public class Caverphone1 extends AbstractCaverphone { + + private static final String SIX_1 = "111111"; + + /** + * Encodes the given String into a Caverphone value. + * + * @param source + * String the source string + * @return A caverphone code for the given String + */ + public String encode(String source) { + String txt = source; + if (txt == null || txt.length() == 0) { + return SIX_1; + } + + // 1. Convert to lowercase + txt = txt.toLowerCase(java.util.Locale.ENGLISH); + + // 2. Remove anything not A-Z + txt = txt.replaceAll("[^a-z]", ""); + + // 3. Handle various start options + // 2 is a temporary placeholder to indicate a consonant which we are no longer interested in. + txt = txt.replaceAll("^cough", "cou2f"); + txt = txt.replaceAll("^rough", "rou2f"); + txt = txt.replaceAll("^tough", "tou2f"); + txt = txt.replaceAll("^enough", "enou2f"); + txt = txt.replaceAll("^gn", "2n"); + + // End + txt = txt.replaceAll("mb$", "m2"); + + // 4. Handle replacements + txt = txt.replaceAll("cq", "2q"); + txt = txt.replaceAll("ci", "si"); + txt = txt.replaceAll("ce", "se"); + txt = txt.replaceAll("cy", "sy"); + txt = txt.replaceAll("tch", "2ch"); + txt = txt.replaceAll("c", "k"); + txt = txt.replaceAll("q", "k"); + txt = txt.replaceAll("x", "k"); + txt = txt.replaceAll("v", "f"); + txt = txt.replaceAll("dg", "2g"); + txt = txt.replaceAll("tio", "sio"); + txt = txt.replaceAll("tia", "sia"); + txt = txt.replaceAll("d", "t"); + txt = txt.replaceAll("ph", "fh"); + txt = txt.replaceAll("b", "p"); + txt = txt.replaceAll("sh", "s2"); + txt = txt.replaceAll("z", "s"); + txt = txt.replaceAll("^[aeiou]", "A"); + // 3 is a temporary placeholder marking a vowel + txt = txt.replaceAll("[aeiou]", "3"); + txt = txt.replaceAll("3gh3", "3kh3"); + txt = txt.replaceAll("gh", "22"); + txt = txt.replaceAll("g", "k"); + txt = txt.replaceAll("s+", "S"); + txt = txt.replaceAll("t+", "T"); + txt = txt.replaceAll("p+", "P"); + txt = txt.replaceAll("k+", "K"); + txt = txt.replaceAll("f+", "F"); + txt = txt.replaceAll("m+", "M"); + txt = txt.replaceAll("n+", "N"); + txt = txt.replaceAll("w3", "W3"); + txt = txt.replaceAll("wy", "Wy"); // 1.0 only + txt = txt.replaceAll("wh3", "Wh3"); + txt = txt.replaceAll("why", "Why"); // 1.0 only + txt = txt.replaceAll("w", "2"); + txt = txt.replaceAll("^h", "A"); + txt = txt.replaceAll("h", "2"); + txt = txt.replaceAll("r3", "R3"); + txt = txt.replaceAll("ry", "Ry"); // 1.0 only + txt = txt.replaceAll("r", "2"); + txt = txt.replaceAll("l3", "L3"); + txt = txt.replaceAll("ly", "Ly"); // 1.0 only + txt = txt.replaceAll("l", "2"); + txt = txt.replaceAll("j", "y"); // 1.0 only + txt = txt.replaceAll("y3", "Y3"); // 1.0 only + txt = txt.replaceAll("y", "2"); // 1.0 only + + // 5. Handle removals + txt = txt.replaceAll("2", ""); + txt = txt.replaceAll("3", ""); + + // 6. put ten 1s on the end + txt = txt + SIX_1; + + // 7. take the first six characters as the code + return txt.substring(0, SIX_1.length()); + } + +} Propchange: commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/Caverphone1.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/Caverphone2.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/Caverphone2.java?rev=1085238&r1=1085237&r2=1085238&view=diff ============================================================================== --- commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/Caverphone2.java (original) +++ commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/Caverphone2.java Fri Mar 25 02:13:45 2011 @@ -1,128 +1,128 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.codec.language; - -/** - * Encodes a string into a Caverphone 2.0 value. - * - * This is an algorithm created by the Caversham Project at the University of Otago. It implements the Caverphone 2.0 - * algorithm: - * - * @author Apache Software Foundation - * @version $Id: Caverphone.java 1075947 2011-03-01 17:56:14Z ggregory $ - * @see <a href="http://en.wikipedia.org/wiki/Caverphone">Wikipedia - Caverphone</a> - * @see <a href="http://caversham.otago.ac.nz/files/working/ctp150804.pdf">Caverphone 2.0 specification</a> - * @since 1.5 - */ -public class Caverphone2 extends AbstractCaverphone { - - private static final String TEN_1 = "1111111111"; - - /** - * Encodes the given String into a Caverphone 2.0 value. - * - * @param source - * String the source string - * @return A caverphone code for the given String - */ - public String encode(String source) { - String txt = source; - if (txt == null || txt.length() == 0) { - return TEN_1; - } - - // 1. Convert to lowercase - txt = txt.toLowerCase(java.util.Locale.ENGLISH); - - // 2. Remove anything not A-Z - txt = txt.replaceAll("[^a-z]", ""); - - // 2.5. Remove final e - txt = txt.replaceAll("e$", ""); // 2.0 only - - // 3. Handle various start options - txt = txt.replaceAll("^cough", "cou2f"); - txt = txt.replaceAll("^rough", "rou2f"); - txt = txt.replaceAll("^tough", "tou2f"); - txt = txt.replaceAll("^enough", "enou2f"); // 2.0 only - txt = txt.replaceAll("^trough", "trou2f"); // 2.0 only - note the spec says ^enough here again, c+p error I assume - txt = txt.replaceAll("^gn", "2n"); - - // End - txt = txt.replaceAll("mb$", "m2"); - - // 4. Handle replacements - txt = txt.replaceAll("cq", "2q"); - txt = txt.replaceAll("ci", "si"); - txt = txt.replaceAll("ce", "se"); - txt = txt.replaceAll("cy", "sy"); - txt = txt.replaceAll("tch", "2ch"); - txt = txt.replaceAll("c", "k"); - txt = txt.replaceAll("q", "k"); - txt = txt.replaceAll("x", "k"); - txt = txt.replaceAll("v", "f"); - txt = txt.replaceAll("dg", "2g"); - txt = txt.replaceAll("tio", "sio"); - txt = txt.replaceAll("tia", "sia"); - txt = txt.replaceAll("d", "t"); - txt = txt.replaceAll("ph", "fh"); - txt = txt.replaceAll("b", "p"); - txt = txt.replaceAll("sh", "s2"); - txt = txt.replaceAll("z", "s"); - txt = txt.replaceAll("^[aeiou]", "A"); - txt = txt.replaceAll("[aeiou]", "3"); - txt = txt.replaceAll("j", "y"); // 2.0 only - txt = txt.replaceAll("^y3", "Y3"); // 2.0 only - txt = txt.replaceAll("^y", "A"); // 2.0 only - txt = txt.replaceAll("y", "3"); // 2.0 only - txt = txt.replaceAll("3gh3", "3kh3"); - txt = txt.replaceAll("gh", "22"); - txt = txt.replaceAll("g", "k"); - txt = txt.replaceAll("s+", "S"); - txt = txt.replaceAll("t+", "T"); - txt = txt.replaceAll("p+", "P"); - txt = txt.replaceAll("k+", "K"); - txt = txt.replaceAll("f+", "F"); - txt = txt.replaceAll("m+", "M"); - txt = txt.replaceAll("n+", "N"); - txt = txt.replaceAll("w3", "W3"); - txt = txt.replaceAll("wh3", "Wh3"); - txt = txt.replaceAll("w$", "3"); // 2.0 only - txt = txt.replaceAll("w", "2"); - txt = txt.replaceAll("^h", "A"); - txt = txt.replaceAll("h", "2"); - txt = txt.replaceAll("r3", "R3"); - txt = txt.replaceAll("r$", "3"); // 2.0 only - txt = txt.replaceAll("r", "2"); - txt = txt.replaceAll("l3", "L3"); - txt = txt.replaceAll("l$", "3"); // 2.0 only - txt = txt.replaceAll("l", "2"); - - // 5. Handle removals - txt = txt.replaceAll("2", ""); - txt = txt.replaceAll("3$", "A"); // 2.0 only - txt = txt.replaceAll("3", ""); - - // 6. put ten 1s on the end - txt = txt + TEN_1; - - // 7. take the first ten characters as the code - return txt.substring(0, TEN_1.length()); - } - -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.codec.language; + +/** + * Encodes a string into a Caverphone 2.0 value. + * + * This is an algorithm created by the Caversham Project at the University of Otago. It implements the Caverphone 2.0 + * algorithm: + * + * @author Apache Software Foundation + * @version $Id: Caverphone.java 1075947 2011-03-01 17:56:14Z ggregory $ + * @see <a href="http://en.wikipedia.org/wiki/Caverphone">Wikipedia - Caverphone</a> + * @see <a href="http://caversham.otago.ac.nz/files/working/ctp150804.pdf">Caverphone 2.0 specification</a> + * @since 1.5 + */ +public class Caverphone2 extends AbstractCaverphone { + + private static final String TEN_1 = "1111111111"; + + /** + * Encodes the given String into a Caverphone 2.0 value. + * + * @param source + * String the source string + * @return A caverphone code for the given String + */ + public String encode(String source) { + String txt = source; + if (txt == null || txt.length() == 0) { + return TEN_1; + } + + // 1. Convert to lowercase + txt = txt.toLowerCase(java.util.Locale.ENGLISH); + + // 2. Remove anything not A-Z + txt = txt.replaceAll("[^a-z]", ""); + + // 2.5. Remove final e + txt = txt.replaceAll("e$", ""); // 2.0 only + + // 3. Handle various start options + txt = txt.replaceAll("^cough", "cou2f"); + txt = txt.replaceAll("^rough", "rou2f"); + txt = txt.replaceAll("^tough", "tou2f"); + txt = txt.replaceAll("^enough", "enou2f"); // 2.0 only + txt = txt.replaceAll("^trough", "trou2f"); // 2.0 only - note the spec says ^enough here again, c+p error I assume + txt = txt.replaceAll("^gn", "2n"); + + // End + txt = txt.replaceAll("mb$", "m2"); + + // 4. Handle replacements + txt = txt.replaceAll("cq", "2q"); + txt = txt.replaceAll("ci", "si"); + txt = txt.replaceAll("ce", "se"); + txt = txt.replaceAll("cy", "sy"); + txt = txt.replaceAll("tch", "2ch"); + txt = txt.replaceAll("c", "k"); + txt = txt.replaceAll("q", "k"); + txt = txt.replaceAll("x", "k"); + txt = txt.replaceAll("v", "f"); + txt = txt.replaceAll("dg", "2g"); + txt = txt.replaceAll("tio", "sio"); + txt = txt.replaceAll("tia", "sia"); + txt = txt.replaceAll("d", "t"); + txt = txt.replaceAll("ph", "fh"); + txt = txt.replaceAll("b", "p"); + txt = txt.replaceAll("sh", "s2"); + txt = txt.replaceAll("z", "s"); + txt = txt.replaceAll("^[aeiou]", "A"); + txt = txt.replaceAll("[aeiou]", "3"); + txt = txt.replaceAll("j", "y"); // 2.0 only + txt = txt.replaceAll("^y3", "Y3"); // 2.0 only + txt = txt.replaceAll("^y", "A"); // 2.0 only + txt = txt.replaceAll("y", "3"); // 2.0 only + txt = txt.replaceAll("3gh3", "3kh3"); + txt = txt.replaceAll("gh", "22"); + txt = txt.replaceAll("g", "k"); + txt = txt.replaceAll("s+", "S"); + txt = txt.replaceAll("t+", "T"); + txt = txt.replaceAll("p+", "P"); + txt = txt.replaceAll("k+", "K"); + txt = txt.replaceAll("f+", "F"); + txt = txt.replaceAll("m+", "M"); + txt = txt.replaceAll("n+", "N"); + txt = txt.replaceAll("w3", "W3"); + txt = txt.replaceAll("wh3", "Wh3"); + txt = txt.replaceAll("w$", "3"); // 2.0 only + txt = txt.replaceAll("w", "2"); + txt = txt.replaceAll("^h", "A"); + txt = txt.replaceAll("h", "2"); + txt = txt.replaceAll("r3", "R3"); + txt = txt.replaceAll("r$", "3"); // 2.0 only + txt = txt.replaceAll("r", "2"); + txt = txt.replaceAll("l3", "L3"); + txt = txt.replaceAll("l$", "3"); // 2.0 only + txt = txt.replaceAll("l", "2"); + + // 5. Handle removals + txt = txt.replaceAll("2", ""); + txt = txt.replaceAll("3$", "A"); // 2.0 only + txt = txt.replaceAll("3", ""); + + // 6. put ten 1s on the end + txt = txt + TEN_1; + + // 7. take the first ten characters as the code + return txt.substring(0, TEN_1.length()); + } + +} Propchange: commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/Caverphone2.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/Utils.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/Utils.java?rev=1085238&r1=1085237&r2=1085238&view=diff ============================================================================== --- commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/Utils.java (original) +++ commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/Utils.java Fri Mar 25 02:13:45 2011 @@ -1,49 +1,49 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.codec.net; - -import org.apache.commons.codec.DecoderException; - -/** - * Utility methods for this package. - * - * @author <a href="mailto:ggreg...@seagullsw.com">Gary Gregory</a> - * @version $Id$ - * @since 1.4 - */ -class Utils { - - /** - * Returns the numeric value of the character <code>b</code> in radix 16. - * - * @param b - * The byte to be converted. - * @return The numeric value represented by the character in radix 16. - * - * @throws DecoderException - * Thrown when the byte is not valid per {@link Character#digit(char,int)} - */ - static int digit16(byte b) throws DecoderException { - int i = Character.digit((char) b, 16); - if (i == -1) { - throw new DecoderException("Invalid URL encoding: not a valid digit (radix " + URLCodec.RADIX + "): " + b); - } - return i; - } - -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.codec.net; + +import org.apache.commons.codec.DecoderException; + +/** + * Utility methods for this package. + * + * @author <a href="mailto:ggreg...@seagullsw.com">Gary Gregory</a> + * @version $Id$ + * @since 1.4 + */ +class Utils { + + /** + * Returns the numeric value of the character <code>b</code> in radix 16. + * + * @param b + * The byte to be converted. + * @return The numeric value represented by the character in radix 16. + * + * @throws DecoderException + * Thrown when the byte is not valid per {@link Character#digit(char,int)} + */ + static int digit16(byte b) throws DecoderException { + int i = Character.digit((char) b, 16); + if (i == -1) { + throw new DecoderException("Invalid URL encoding: not a valid digit (radix " + URLCodec.RADIX + "): " + b); + } + return i; + } + +} Propchange: commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/Utils.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: commons/proper/codec/trunk/src/test/org/apache/commons/codec/DecoderExceptionTest.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/DecoderExceptionTest.java?rev=1085238&r1=1085237&r2=1085238&view=diff ============================================================================== --- commons/proper/codec/trunk/src/test/org/apache/commons/codec/DecoderExceptionTest.java (original) +++ commons/proper/codec/trunk/src/test/org/apache/commons/codec/DecoderExceptionTest.java Fri Mar 25 02:13:45 2011 @@ -1,58 +1,58 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.codec; - -import junit.framework.TestCase; - -/** - * Tests {@link DecoderException}. - * - * @author <a href="mailto:ggreg...@seagullsw.com">Gary Gregory</a> - * @version $Id$ - */ -public class DecoderExceptionTest extends TestCase { - - private static final String MSG = "TEST"; - - private static final Throwable t = new Exception(); - - public void testConstructor0() { - DecoderException e = new DecoderException(); - assertNull(e.getMessage()); - assertNull(e.getCause()); - } - - public void testConstructorString() { - DecoderException e = new DecoderException(MSG); - assertEquals(MSG, e.getMessage()); - assertNull(e.getCause()); - } - - public void testConstructorStringThrowable() { - DecoderException e = new DecoderException(MSG, t); - assertEquals(MSG, e.getMessage()); - assertEquals(t, e.getCause()); - } - - public void testConstructorThrowable() { - DecoderException e = new DecoderException(t); - assertEquals(t.getClass().getName(), e.getMessage()); - assertEquals(t, e.getCause()); - } - -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.codec; + +import junit.framework.TestCase; + +/** + * Tests {@link DecoderException}. + * + * @author <a href="mailto:ggreg...@seagullsw.com">Gary Gregory</a> + * @version $Id$ + */ +public class DecoderExceptionTest extends TestCase { + + private static final String MSG = "TEST"; + + private static final Throwable t = new Exception(); + + public void testConstructor0() { + DecoderException e = new DecoderException(); + assertNull(e.getMessage()); + assertNull(e.getCause()); + } + + public void testConstructorString() { + DecoderException e = new DecoderException(MSG); + assertEquals(MSG, e.getMessage()); + assertNull(e.getCause()); + } + + public void testConstructorStringThrowable() { + DecoderException e = new DecoderException(MSG, t); + assertEquals(MSG, e.getMessage()); + assertEquals(t, e.getCause()); + } + + public void testConstructorThrowable() { + DecoderException e = new DecoderException(t); + assertEquals(t.getClass().getName(), e.getMessage()); + assertEquals(t, e.getCause()); + } + +} Propchange: commons/proper/codec/trunk/src/test/org/apache/commons/codec/DecoderExceptionTest.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: commons/proper/codec/trunk/src/test/org/apache/commons/codec/EncoderExceptionTest.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/EncoderExceptionTest.java?rev=1085238&r1=1085237&r2=1085238&view=diff ============================================================================== --- commons/proper/codec/trunk/src/test/org/apache/commons/codec/EncoderExceptionTest.java (original) +++ commons/proper/codec/trunk/src/test/org/apache/commons/codec/EncoderExceptionTest.java Fri Mar 25 02:13:45 2011 @@ -1,58 +1,58 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.codec; - -import junit.framework.TestCase; - -/** - * Tests {@link EncoderException}. - * - * @author <a href="mailto:ggreg...@seagullsw.com">Gary Gregory</a> - * @version $Id$ - */ -public class EncoderExceptionTest extends TestCase { - - private static final String MSG = "TEST"; - - private static final Throwable t = new Exception(); - - public void testConstructor0() { - EncoderException e = new EncoderException(); - assertNull(e.getMessage()); - assertNull(e.getCause()); - } - - public void testConstructorString() { - EncoderException e = new EncoderException(MSG); - assertEquals(MSG, e.getMessage()); - assertNull(e.getCause()); - } - - public void testConstructorStringThrowable() { - EncoderException e = new EncoderException(MSG, t); - assertEquals(MSG, e.getMessage()); - assertEquals(t, e.getCause()); - } - - public void testConstructorThrowable() { - EncoderException e = new EncoderException(t); - assertEquals(t.getClass().getName(), e.getMessage()); - assertEquals(t, e.getCause()); - } - -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.codec; + +import junit.framework.TestCase; + +/** + * Tests {@link EncoderException}. + * + * @author <a href="mailto:ggreg...@seagullsw.com">Gary Gregory</a> + * @version $Id$ + */ +public class EncoderExceptionTest extends TestCase { + + private static final String MSG = "TEST"; + + private static final Throwable t = new Exception(); + + public void testConstructor0() { + EncoderException e = new EncoderException(); + assertNull(e.getMessage()); + assertNull(e.getCause()); + } + + public void testConstructorString() { + EncoderException e = new EncoderException(MSG); + assertEquals(MSG, e.getMessage()); + assertNull(e.getCause()); + } + + public void testConstructorStringThrowable() { + EncoderException e = new EncoderException(MSG, t); + assertEquals(MSG, e.getMessage()); + assertEquals(t, e.getCause()); + } + + public void testConstructorThrowable() { + EncoderException e = new EncoderException(t); + assertEquals(t.getClass().getName(), e.getMessage()); + assertEquals(t, e.getCause()); + } + +} Propchange: commons/proper/codec/trunk/src/test/org/apache/commons/codec/EncoderExceptionTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Codec105ErrorInputStream.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/Caverphone1Test.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/Caverphone1Test.java?rev=1085238&r1=1085237&r2=1085238&view=diff ============================================================================== --- commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/Caverphone1Test.java (original) +++ commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/Caverphone1Test.java Fri Mar 25 02:13:45 2011 @@ -1,105 +1,105 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.codec.language; - -import junit.framework.Assert; - -import org.apache.commons.codec.EncoderException; -import org.apache.commons.codec.StringEncoder; -import org.apache.commons.codec.StringEncoderAbstractTest; - -/** - * Tests Caverphone1. - * - * @author Apache Software Foundation - * @version $Id: CaverphoneTest.java 1075947 2011-03-01 17:56:14Z ggregory $ - * @since 1.5 - */ -public class Caverphone1Test extends StringEncoderAbstractTest { - - public Caverphone1Test(String name) { - super(name); - } - - protected StringEncoder createStringEncoder() { - return new Caverphone1(); - } - - /** - * Tests example adapted from version 2.0 http://caversham.otago.ac.nz/files/working/ctp150804.pdf - * - * AT1111 words: add, aid, at, art, eat, earth, head, hit, hot, hold, hard, heart, it, out, old - * - * @throws EncoderException - */ - public void testCaverphoneRevisitedCommonCodeAT1111() throws EncoderException { - this.checkEncodingVariations("AT1111", new String[]{ - "add", - "aid", - "at", - "art", - "eat", - "earth", - "head", - "hit", - "hot", - "hold", - "hard", - "heart", - "it", - "out", - "old"}); - } - - public void testEndMb() throws EncoderException { - String[][] data = {{"mb", "M11111"}, {"mbmb", "MPM111"}}; - this.checkEncodings(data); - } - - /** - * Tests some examples from version 2.0 http://caversham.otago.ac.nz/files/working/ctp150804.pdf - * - * @throws EncoderException - */ - public void testIsCaverphoneEquals() throws EncoderException { - Caverphone1 caverphone = new Caverphone1(); - Assert.assertFalse("Caverphone encodings should not be equal", caverphone.isEncodeEqual("Peter", "Stevenson")); - Assert.assertTrue("Caverphone encodings should be equal", caverphone.isEncodeEqual("Peter", "Peady")); - } - - /** - * Tests example from http://caversham.otago.ac.nz/files/working/ctp060902.pdf - * - * @throws EncoderException - */ - public void testSpecificationV1Examples() throws EncoderException { - String[][] data = {{"David", "TFT111"}, {"Whittle", "WTL111"}}; - this.checkEncodings(data); - } - - /** - * Tests examples from http://en.wikipedia.org/wiki/Caverphone - * - * @throws EncoderException - */ - public void testWikipediaExamples() throws EncoderException { - String[][] data = {{"Lee", "L11111"}, {"Thompson", "TMPSN1"}}; - this.checkEncodings(data); - } - -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.codec.language; + +import junit.framework.Assert; + +import org.apache.commons.codec.EncoderException; +import org.apache.commons.codec.StringEncoder; +import org.apache.commons.codec.StringEncoderAbstractTest; + +/** + * Tests Caverphone1. + * + * @author Apache Software Foundation + * @version $Id: CaverphoneTest.java 1075947 2011-03-01 17:56:14Z ggregory $ + * @since 1.5 + */ +public class Caverphone1Test extends StringEncoderAbstractTest { + + public Caverphone1Test(String name) { + super(name); + } + + protected StringEncoder createStringEncoder() { + return new Caverphone1(); + } + + /** + * Tests example adapted from version 2.0 http://caversham.otago.ac.nz/files/working/ctp150804.pdf + * + * AT1111 words: add, aid, at, art, eat, earth, head, hit, hot, hold, hard, heart, it, out, old + * + * @throws EncoderException + */ + public void testCaverphoneRevisitedCommonCodeAT1111() throws EncoderException { + this.checkEncodingVariations("AT1111", new String[]{ + "add", + "aid", + "at", + "art", + "eat", + "earth", + "head", + "hit", + "hot", + "hold", + "hard", + "heart", + "it", + "out", + "old"}); + } + + public void testEndMb() throws EncoderException { + String[][] data = {{"mb", "M11111"}, {"mbmb", "MPM111"}}; + this.checkEncodings(data); + } + + /** + * Tests some examples from version 2.0 http://caversham.otago.ac.nz/files/working/ctp150804.pdf + * + * @throws EncoderException + */ + public void testIsCaverphoneEquals() throws EncoderException { + Caverphone1 caverphone = new Caverphone1(); + Assert.assertFalse("Caverphone encodings should not be equal", caverphone.isEncodeEqual("Peter", "Stevenson")); + Assert.assertTrue("Caverphone encodings should be equal", caverphone.isEncodeEqual("Peter", "Peady")); + } + + /** + * Tests example from http://caversham.otago.ac.nz/files/working/ctp060902.pdf + * + * @throws EncoderException + */ + public void testSpecificationV1Examples() throws EncoderException { + String[][] data = {{"David", "TFT111"}, {"Whittle", "WTL111"}}; + this.checkEncodings(data); + } + + /** + * Tests examples from http://en.wikipedia.org/wiki/Caverphone + * + * @throws EncoderException + */ + public void testWikipediaExamples() throws EncoderException { + String[][] data = {{"Lee", "L11111"}, {"Thompson", "TMPSN1"}}; + this.checkEncodings(data); + } + +} Propchange: commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/Caverphone1Test.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/Caverphone2Test.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/Caverphone2Test.java?rev=1085238&r1=1085237&r2=1085238&view=diff ============================================================================== --- commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/Caverphone2Test.java (original) +++ commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/Caverphone2Test.java Fri Mar 25 02:13:45 2011 @@ -1,39 +1,39 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.codec.language; - -import org.apache.commons.codec.StringEncoder; - -/** - * Tests Caverphone2. - * - * @author Apache Software Foundation - * @version $Id: CaverphoneTest.java 1075947 2011-03-01 17:56:14Z ggregory $ - * @since 1.5 - */ -public class Caverphone2Test extends CaverphoneTest { - - public Caverphone2Test(String name) { - super(name); - } - - protected StringEncoder createStringEncoder() { - return new Caverphone2(); - } - -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.codec.language; + +import org.apache.commons.codec.StringEncoder; + +/** + * Tests Caverphone2. + * + * @author Apache Software Foundation + * @version $Id: CaverphoneTest.java 1075947 2011-03-01 17:56:14Z ggregory $ + * @since 1.5 + */ +public class Caverphone2Test extends CaverphoneTest { + + public Caverphone2Test(String name) { + super(name); + } + + protected StringEncoder createStringEncoder() { + return new Caverphone2(); + } + +} Propchange: commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/Caverphone2Test.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: commons/proper/codec/trunk/src/test/org/apache/commons/codec/net/UtilsTest.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/net/UtilsTest.java?rev=1085238&r1=1085237&r2=1085238&view=diff ============================================================================== --- commons/proper/codec/trunk/src/test/org/apache/commons/codec/net/UtilsTest.java (original) +++ commons/proper/codec/trunk/src/test/org/apache/commons/codec/net/UtilsTest.java Fri Mar 25 02:13:45 2011 @@ -1,42 +1,42 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.codec.net; - -import junit.framework.TestCase; - -/** - * Tests Utils. - * <p> - * Methods currently get 100%/100% line/branch code coverage from other tests classes. - * </p> - * - * @author <a href="mailto:ggreg...@seagullsw.com">Gary Gregory</a> - * @version $Id$ - * @since 1.4 - */ -public class UtilsTest extends TestCase { - - /** - * We could make the constructor private but there does not seem to be a point to jumping through extra code hoops - * to restrict instantiation right now. - */ - public void testConstructor() { - new Utils(); - } - -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.codec.net; + +import junit.framework.TestCase; + +/** + * Tests Utils. + * <p> + * Methods currently get 100%/100% line/branch code coverage from other tests classes. + * </p> + * + * @author <a href="mailto:ggreg...@seagullsw.com">Gary Gregory</a> + * @version $Id$ + * @since 1.4 + */ +public class UtilsTest extends TestCase { + + /** + * We could make the constructor private but there does not seem to be a point to jumping through extra code hoops + * to restrict instantiation right now. + */ + public void testConstructor() { + new Utils(); + } + +} Propchange: commons/proper/codec/trunk/src/test/org/apache/commons/codec/net/UtilsTest.java ------------------------------------------------------------------------------ svn:eol-style = native