当前位置: 首页>>代码示例>>Java>>正文


Java Segment.getEndIndex方法代码示例

本文整理汇总了Java中javax.swing.text.Segment.getEndIndex方法的典型用法代码示例。如果您正苦于以下问题:Java Segment.getEndIndex方法的具体用法?Java Segment.getEndIndex怎么用?Java Segment.getEndIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.text.Segment的用法示例。


在下文中一共展示了Segment.getEndIndex方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getNextWordStart

import javax.swing.text.Segment; //导入方法依赖的package包/类
/** This helper method will return the start character of the next
 * word in the buffer from the start position
 */
private static int getNextWordStart(Segment text, int startPos) {
  if (startPos <= text.getEndIndex())
    for (char ch = text.setIndex(startPos); ch != Segment.DONE; ch = text.next()) {
      if (Character.isLetterOrDigit(ch)) {
        return text.getIndex();
      }
    }
  return -1;
}
 
开发者ID:Thecarisma,项目名称:powertext,代码行数:13,代码来源:DocumentWordTokenizer.java

示例2: getNextWordEnd

import javax.swing.text.Segment; //导入方法依赖的package包/类
/** This helper method will return the end of the next word in the buffer.
 *
 */
private static int getNextWordEnd(Segment text, int startPos) {
  for (char ch = text.setIndex(startPos); ch != Segment.DONE; ch = text.next()) {
    if (!Character.isLetterOrDigit(ch)) {
      if (ch == '-' || ch == '\'') { // handle ' and - inside words
        char ch2 = text.next();
        text.previous();
        if (ch2 != Segment.DONE && Character.isLetterOrDigit(ch2))
          continue;
      }
      return text.getIndex();
    }
  }
  return text.getEndIndex();
}
 
开发者ID:Thecarisma,项目名称:powertext,代码行数:18,代码来源:DocumentWordTokenizer.java

示例3: getNextWordStart

import javax.swing.text.Segment; //导入方法依赖的package包/类
/**
 * This helper method will return the start character of the next
 * word in the buffer from the start position
 *
 * @param  text      Description of the Parameter
 * @param  startPos  Description of the Parameter
 * @return           The nextWordStart value
 */
private static int getNextWordStart(Segment text, int startPos) {
	if (startPos <= text.getEndIndex())
		for (char ch = text.setIndex(startPos); ch != Segment.DONE; ch = text.next()) {
			// changed by Saruta
			if (Character.isLetterOrDigit(ch) || ch == '-' || ch == '\'' || ch == '~') {
				return text.getIndex();
			}
		}
	return -1;
}
 
开发者ID:SarutaSan72,项目名称:Yass,代码行数:19,代码来源:DocumentWordTokenizer.java

示例4: getNextWordEnd

import javax.swing.text.Segment; //导入方法依赖的package包/类
/**
 * This helper method will return the end of the next word in the buffer.
 *
 * @param  text      Description of the Parameter
 * @param  startPos  Description of the Parameter
 * @return           The nextWordEnd value
 */
private static int getNextWordEnd(Segment text, int startPos) {
	for (char ch = text.setIndex(startPos); ch != Segment.DONE; ch = text.next()) {
		if (!Character.isLetterOrDigit(ch)) {
			// changed by Saruta
			if (ch == '-' || ch == '\'' || ch == '~') {
				// handle ' and - inside words
				continue;
			}
			return text.getIndex();
		}
	}
	return text.getEndIndex();
}
 
开发者ID:SarutaSan72,项目名称:Yass,代码行数:21,代码来源:DocumentWordTokenizer.java


注:本文中的javax.swing.text.Segment.getEndIndex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。