/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* This class holds the information about locales.
*
* @since 1.4
* @author Robert Field
*/
class DocLocale {
/**
* The locale name will be set by Main, if option is provided on the
* command line.
*/
/**
* The locale to be used. If user doesen't provide this,
* then set it to default locale value.
*/
/**
* The collator for this application. This is to take care of Locale
* Specific or Natural Language Text sorting.
*/
/**
* Enclosing DocEnv
*/
/**
* Sentence instance from the BreakIterator.
*/
/**
* True is we should use <code>BreakIterator</code>
* to compute first sentence.
*/
private boolean useBreakIterator = false;
/**
* The HTML sentence terminators.
*/
{
"<p>", "</p>", "<h1>", "<h2>",
"<h3>", "<h4>", "<h5>", "<h6>",
"</h1>", "</h2>", "</h3>", "</h4>", "</h5>",
"</h6>", "<hr>", "<pre>", "</pre>"
};
/**
* Constructor
*/
this.localeName = localeName;
this.useBreakIterator = useBreakIterator;
} else {
}
}
/**
* Get the locale if specified on the command line
* else return null and if locale option is not used
* then return default locale.
*/
int seconduscore = -1;
if (firstuscore == 2) {
if (seconduscore > 0) {
return null;
}
} else {
return null;
}
} else {
return null;
}
if (userlocale == null) {
return null;
} else {
return userlocale;
}
} else {
return Locale.getDefault();
}
}
/**
* Search the locale for specified language, specified country and
* specified variant.
*/
return locales[i];
}
}
return null;
}
return "";
}
}
} else {
return englishLanguageFirstSentence(s).trim();
}
}
/**
* Return the first sentence of a string, where a sentence ends
* with a period followed be white space.
*/
if (s == null) {
return null;
}
boolean period = false;
for (int i = 0 ; i < len ; i++) {
switch (s.charAt(i)) {
case '.':
period = true;
break;
case ' ':
case '\t':
case '\n':
case '\r':
case '\f':
if (period) {
return s.substring(0, i);
}
break;
case '<':
if (i > 0) {
if (htmlSentenceTerminatorFound(s, i)) {
return s.substring(0, i);
}
}
break;
default:
period = false;
}
}
return s;
}
/**
* Find out if there is any HTML tag in the given string. If found
* return true else return false.
*/
return true;
}
}
return false;
}
}