本文整理了Java中net.sf.okapi.common.Util.checkIndex()
方法的一些代码示例,展示了Util.checkIndex()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.checkIndex()
方法的具体详情如下:
包路径:net.sf.okapi.common.Util
类名称:Util
方法名:checkIndex
[英]Indicates if a given index is within the list bounds.
[中]指示给定索引是否在列表范围内。
代码示例来源:origin: net.sf.okapi.filters/okapi-filter-table
private ITextUnit getSource(List<ITextUnit> cells, int colNum, List<Integer> columnsList, List<Integer> refList) {
if (columnsList == null) return null;
int index = columnsList.indexOf(colNum);
if (!Util.checkIndex(index, refList)) return null;
int ref = refList.get(index) - 1; // refList items are 1-based
if (!Util.checkIndex(ref, cells)) return null;
return cells.get(ref);
}
代码示例来源:origin: net.sf.okapi.filters/okapi-filter-table
private String getSuffix(int colNum) {
if (sourceColumns == null) return "";
int index = sourceColumns.indexOf(colNum);
if (!Util.checkIndex(index, sourceIdSuffixes)) return "";
return sourceIdSuffixes.get(index);
}
代码示例来源:origin: net.sf.okapi.filters/okapi-filter-table
private String getSuffixFromSourceRef(int colNum) {
if (sourceIdColumns == null) return "";
int index = sourceIdColumns.indexOf(colNum);
if (!Util.checkIndex(index, sourceIdSuffixes)) return "";
return sourceIdSuffixes.get(index);
}
代码示例来源:origin: net.sf.okapi/okapi-core
if (!Util.checkIndex(start, array) && !Util.checkIndex(end, array))
return "";
if (start < 0 && Util.checkIndex(end, array))
start = 0;
if (Util.checkIndex(start, array) && end >= array.length)
end = array.length - 1;
代码示例来源:origin: net.sf.okapi/okapi-core
public static GenericSkeletonPart getPart(GenericSkeleton skel, int index) {
List<GenericSkeletonPart> parts = skel.getParts();
if (!Util.checkIndex(index, parts)) return null;
return parts.get(index);
}
代码示例来源:origin: net.sf.okapi.filters/okapi-filter-table
private LocaleId getLanguageFromTargetRef(int colNum) {
if ( targetColumns == null ) return LocaleId.EMPTY;
int index = targetColumns.indexOf(colNum);
if ( !Util.checkIndex(index, targetLanguages) )
return getTargetLocale();
return targetLanguages.get(index);
}
代码示例来源:origin: net.sf.okapi/okapi-core
if (Util.checkIndex(start, list) && Util.checkIndex(end, list))
res.addAll(list.subList(start, end + 1));
代码示例来源:origin: net.sf.okapi/okapi-core
/**
* Replaces a part of a given skeleton with another given skeleton part.
* @param skel the skeleton which part is being replaced.
* @param index the index of the skeleton part to be replaced.
* @param replacement the given new skeleton part to replace the existing one.
* @return true if replacement succeeded.
*/
public static boolean replaceSkeletonPart (GenericSkeleton skel,
int index,
GenericSkeleton replacement)
{
if ( skel == null ) return false;
if ( replacement == null ) return false;
List<GenericSkeletonPart> list = skel.getParts();
if ( !Util.checkIndex(index, list) ) return false;
List<GenericSkeletonPart> list2 = (List<GenericSkeletonPart>) ListUtil.moveItems(list); // clears the original list
for (int i = 0; i < list2.size(); i++) {
if ( i == index )
skel.add(replacement);
else
list.add(list2.get(i));
}
return true;
}
代码示例来源:origin: net.sf.okapi.filters/okapi-filter-table
if (Util.checkIndex(index + 1, buf)) buf.remove(index + 1); // Line num
if (!Util.checkIndex(index - 1, buf)) break;
if (!Util.checkIndex(index + 1, buf)) break;
if (index >= start && start > -1) return;
if (!Util.checkIndex(index, buffer)) return; // = -1, no complete line of chunks
if (!Util.checkIndex(index + 1, buffer)) return; // No line num item
long lineNum = new Long(buffer.get(index + 1));
代码示例来源:origin: net.sf.okapi.filters/okapi-filter-table
int index = params.recordIdColumn - 1;
if (Util.checkIndex(index, cells))
recordID = TextUnitUtil.getSourceText(cells.get(index));
内容来源于网络,如有侵权,请联系作者删除!