本文整理了Java中net.sf.okapi.common.Util.isNullOrEmpty()
方法的一些代码示例,展示了Util.isNullOrEmpty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.isNullOrEmpty()
方法的具体详情如下:
包路径:net.sf.okapi.common.Util
类名称:Util
方法名:isNullOrEmpty
[英]Indicates if a locale id is null or empty.
[中]指示区域设置id是空的还是空的。
代码示例来源:origin: net.sf.okapi.tm/okapi-tm-pensieve
/**
* Creates an instance of OkapiTMXHandler
* @param sourceLang the language to import as the source language.
* @param tmxFilter the IFilter to use to parse the TMX
*/
public OkapiTmxImporter(LocaleId sourceLang, IFilter tmxFilter) {
this.tmxFilter = tmxFilter;
this.sourceLang = sourceLang;
if (Util.isNullOrEmpty(sourceLang)) {
throw new IllegalArgumentException("'sourceLang' must be set");
}
if (tmxFilter == null) {
throw new IllegalArgumentException("'filter' must be set");
}
}
代码示例来源:origin: net.sf.okapi.tm/okapi-tm-pensieve
private void checkImportTmxParams(URI tmxUri,
LocaleId targetLang,
ITmWriter tmWriter)
{
if (Util.isNullOrEmpty(targetLang)) {
throw new IllegalArgumentException("'targetLang' was not set");
}
if (tmxUri == null) {
throw new IllegalArgumentException("'tmxUri' was not set");
}
if (tmWriter == null) {
throw new IllegalArgumentException("'tmWriter' was not set");
}
}
代码示例来源:origin: net.sf.okapi/okapi-core
/**
* Gets text of the first part of the target of a given text unit resource in the given locale.
*
* @param textUnit
* the text unit resource which source text should be returned.
* @param locId
* the locale the target part being sought.
* @return the target part of the given text unit resource in the given loacle, or an empty string if the text unit
* doesn't contain one.
*/
public static String getTargetText (ITextUnit textUnit,
LocaleId locId)
{
if (textUnit == null)
return "";
if (Util.isNullOrEmpty(locId))
return "";
return getCodedText(textUnit.getTarget(locId).getFirstContent());
}
代码示例来源:origin: net.sf.okapi/okapi-core
/**
* Attaches an annotation to the target part of a given text unit resource in a given language.
*
* @param textUnit
* the given text unit resource.
* @param locId
* the locale of the target part being attached to.
* @param annotation
* the annotation to be attached to the target part of the text unit.
*/
public static void setTargetAnnotation (ITextUnit textUnit,
LocaleId locId,
IAnnotation annotation)
{
if ( textUnit == null ) return;
if ( Util.isNullOrEmpty(locId) ) return;
if ( textUnit.getTarget(locId) == null ) return;
textUnit.getTarget(locId).setAnnotation(annotation);
}
代码示例来源:origin: net.sf.okapi/okapi-core
/**
* Finds either source or target reference in the skeleton. If locId is specified, then its target reference is sought for.
* @param skel the skeleton being sought for the reference.
* @param locId the locale to search the reference for.
* @return index in the list of skeleton parts for the skeleton part containing the reference.
*/
public static int findTuRefInSkeleton(GenericSkeleton skel,
LocaleId locId)
{
if ( skel == null ) return -1;
List<GenericSkeletonPart> list = skel.getParts();
for ( int i=0; i<list.size(); i++ ) {
GenericSkeletonPart part = list.get(i);
String st = part.toString();
if ( Util.isEmpty(st) ) continue;
if ( st.equalsIgnoreCase(TU_REF) ) {
if ( Util.isNullOrEmpty(locId) ) {
return i;
}
else if ( locId.equals(part.getLocale()) ) {
return i;
}
}
}
return -1;
}
代码示例来源:origin: net.sf.okapi/okapi-core
/**
* Gets an annotation attached to the target part of a given text unit resource in a given locale.
*
* @param <A> a class implementing IAnnotation
* @param textUnit
* the given text unit resource.
* @param locId
* the locale of the target part being sought.
* @param type
* reference to the requested annotation type.
* @return the annotation or null if not found.
*/
public static <A extends IAnnotation> A getTargetAnnotation (ITextUnit textUnit,
LocaleId locId,
Class<A> type)
{
if ( textUnit == null ) return null;
if ( Util.isNullOrEmpty(locId) ) return null;
if ( textUnit.getTarget(locId) == null ) return null;
return textUnit.getTarget(locId).getAnnotation(type);
}
代码示例来源:origin: net.sf.okapi/okapi-core
if (Util.isNullOrEmpty(locId))
res.add(TextUnitUtil.getSourceText(textUnit));
else
代码示例来源:origin: net.sf.okapi/okapi-core
case START_DOCUMENT:
sourceLocale = event.getStartDocument().getLocale();
if (!Util.isNullOrEmpty(sourceLocale)) {
processStartDocument(event);
} else {
break;
case TEXT_UNIT:
if (!Util.isNullOrEmpty(sourceLocale)) {
processTextUnit(event);
} else {
代码示例来源:origin: net.sf.okapi.steps/okapi-step-wordcount
public long doCount(Object text, LocaleId language) {
if (Util.isNullOrEmpty(language)) return 0L;
代码示例来源:origin: net.sf.okapi.filters/okapi-filter-table
if ( Util.isNullOrEmpty(language) ) {
sendAsSkeleton(cell);
continue;
代码示例来源:origin: net.sf.okapi/okapi-core
textUnit.setSource(source);
if (target != null && !Util.isNullOrEmpty(locId))
textUnit.setTarget(locId, target);
代码示例来源:origin: net.sf.okapi.steps/okapi-step-wordcount
public Counts doFullCount(Object text, LocaleId language) {
if (Util.isNullOrEmpty(language)) return new Counts();
代码示例来源:origin: net.sf.okapi.filters/okapi-filter-its
if ( !Util.isNullOrEmpty(input.getTargetLocale()) ) {
trgLangCode = input.getTargetLocale().toString().toLowerCase();
内容来源于网络,如有侵权,请联系作者删除!