當前位置: 首頁>>代碼示例>>Java>>正文


Java Segment.getIndex方法代碼示例

本文整理匯總了Java中javax.swing.text.Segment.getIndex方法的典型用法代碼示例。如果您正苦於以下問題:Java Segment.getIndex方法的具體用法?Java Segment.getIndex怎麽用?Java Segment.getIndex使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.text.Segment的用法示例。


在下文中一共展示了Segment.getIndex方法的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.getIndex方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。