注释格式化;

This commit is contained in:
Magese 2021-12-31 17:51:35 +08:00
parent dd7822b6be
commit 32a9369680

View File

@ -28,14 +28,20 @@
package org.wltea.analyzer.core; package org.wltea.analyzer.core;
/** /**
* IK分词器专用的Lexem快速排序集合 * IK分词器专用的Lexeme快速排序集合
*/ */
class QuickSortSet { class QuickSortSet {
//链表头 /**
* 链表头
*/
private Cell head; private Cell head;
//链表尾 /**
* 链表尾
*/
private Cell tail; private Cell tail;
//链表的实际大小 /**
* 链表的实际大小
*/
private int size; private int size;
QuickSortSet() { QuickSortSet() {
@ -53,31 +59,29 @@ class QuickSortSet {
this.size++; this.size++;
} else { } else {
/*if(this.tail.compareTo(newCell) == 0){//词元与尾部词元相同不放入集合 if (this.tail.compareTo(newCell) < 0) {
// 词元接入链表尾部
}else */
if (this.tail.compareTo(newCell) < 0) {//词元接入链表尾部
this.tail.next = newCell; this.tail.next = newCell;
newCell.prev = this.tail; newCell.prev = this.tail;
this.tail = newCell; this.tail = newCell;
this.size++; this.size++;
} else if (this.head.compareTo(newCell) > 0) {//词元接入链表头部 } else if (this.head.compareTo(newCell) > 0) {
// 词元接入链表头部
this.head.prev = newCell; this.head.prev = newCell;
newCell.next = this.head; newCell.next = this.head;
this.head = newCell; this.head = newCell;
this.size++; this.size++;
} else { } else {
//从尾部上逆 // 从尾部上逆
Cell index = this.tail; Cell index = this.tail;
while (index != null && index.compareTo(newCell) > 0) { while (index != null && index.compareTo(newCell) > 0) {
index = index.prev; index = index.prev;
} }
/*if(index.compareTo(newCell) == 0){//词元与集合中的词元重复不放入集合
}else */ // 词元插入链表中的某个位置
if ((index != null ? index.compareTo(newCell) : 1) < 0) {//词元插入链表中的某个位置 if ((index != null ? index.compareTo(newCell) : 1) < 0) {
newCell.prev = index; newCell.prev = index;
newCell.next = index.next; newCell.next = index.next;
index.next.prev = newCell; index.next.prev = newCell;