001: /**
002: * Licensed to the Apache Software Foundation (ASF) under one
003: * or more contributor license agreements. See the NOTICE file
004: * distributed with this work for additional information
005: * regarding copyright ownership. The ASF licenses this file
006: * to you under the Apache License, Version 2.0 (the
007: * "License"); you may not use this file except in compliance
008: * with the License. You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing,
013: * software distributed under the License is distributed on an
014: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015: * KIND, either express or implied. See the License for the
016: * specific language governing permissions and limitations
017: * under the License.
018: */
019: /**
020: * Copyright (c) 2005-2006 David Heinemeier Hansson
021: *
022: * Permission is hereby granted, free of charge, to any person obtaining
023: * a copy of this software and associated documentation files (the
024: * "Software"), to deal in the Software without restriction, including
025: * without limitation the rights to use, copy, modify, merge, publish,
026: * distribute, sublicense, and/or sell copies of the Software, and to
027: * permit persons to whom the Software is furnished to do so, subject to
028: * the following conditions:
029:
030: * The above copyright notice and this permission notice shall be
031: * included in all copies or substantial portions of the Software.
032:
033: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
034: * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
035: * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
036: * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
037: * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
038: * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
039: * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
040: */package org.apache.cxf.binding.http.strategy;
041:
042: /**
043: * Rules for English inflection.
044: * <p>
045: * Notice: Some portions of this class where ported from Ruby's ActiveSupport
046: * library which are Copyright (c) 2005-2006 David Heinemeier Hansson and
047: * under the MIT license.
048: */
049: public class EnglishInflector extends Inflector {
050:
051: public EnglishInflector() {
052: addPlural("$", "s");
053: addPlural("s$", "$1s");
054: addPlural("(ax|test)is$", "$1es");
055: addPlural("(octop|vir)us$", "$1i");
056: addPlural("(alias|status)$", "$1es");
057: addPlural("(bu)s$", "$1ses");
058: addPlural("(buffal|tomat)o$", "$1oes");
059: addPlural("([ti])um$", "$1a");
060: addPlural("sis$", "ses");
061: addPlural("(?:([^f])fe|([lr])f)$", "$1\2ves");
062: addPlural("(hive)$", "$1s");
063: addPlural("([^aeiouy]|qu)y$", "$1ies");
064: addPlural("(x|ch|ss|sh)$", "$1es");
065: addPlural("(matr|vert|ind)ix|ex$", "$1ices");
066: addPlural("([m|l])ouse$", "$1ice");
067: addPlural("^(ox)$", "$1en");
068: addPlural("(quiz)$", "$1zes");
069:
070: addSingular("s$", "");
071: addSingular("(n)ews$", "$1ews");
072: addSingular("([ti])a$", "$1um");
073: addSingular(
074: "((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$",
075: "$1\2sis");
076: addSingular("(^analy)ses$", "$1sis");
077: addSingular("([^f])ves$", "$1fe");
078: addSingular("(hive)s$", "$1");
079: addSingular("(tive)s$", "$1");
080: addSingular("([lr])ves$", "$1f");
081: addSingular("([^aeiouy]|qu)ies$", "$1y");
082: addSingular("(s)eries$", "$1eries");
083: addSingular("(m)ovies$", "$1ovie");
084: addSingular("(x|ch|ss|sh)es$", "$1");
085: addSingular("([m|l])ice$", "$1ouse");
086: addSingular("(bus)es$", "$1");
087: addSingular("(o)es$", "$1");
088: addSingular("(shoe)s$", "$1");
089: addSingular("(cris|ax|test)es$", "$1is");
090: addSingular("(octop|vir)i$", "$1us");
091: addSingular("(alias|status)es$", "$1");
092: addSingular("^(ox)en", "$1");
093: addSingular("(vert|ind)ices$", "$1ex");
094: addSingular("(matr)ices$", "$1ix");
095: addSingular("(quiz)zes$", "$1");
096:
097: addIrregular("person", "people");
098: addIrregular("man", "men");
099: addIrregular("child", "children");
100: addIrregular("sex", "sexes");
101: addIrregular("move", "moves");
102:
103: addUncountable(new String[] { "equipment", "information",
104: "rice", "money", "species", "series", "fish", "sheep" });
105: }
106: }
|