⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 llenumeration.java

📁 SRI international 发布的OAA框架软件
💻 JAVA
字号:
package antlr_oaa.collections.impl;

/* ANTLR Translator Generator
 * Project led by Terence Parr at http://www.jGuru.com
 * Software rights: http://www.antlr.org/RIGHTS.html
 *
 * $Id: LLEnumeration.java,v 1.1 2002/11/08 17:37:18 agno Exp $
 */

import antlr_oaa.collections.List;
import antlr_oaa.collections.Stack;
import java.util.Enumeration;
import java.util.NoSuchElementException;
import antlr_oaa.collections.impl.LLCell;

/**An enumeration of a LList.  Maintains a cursor through the list.
 * bad things would happen if the list changed via another thread
 * while we were walking this list.
 */
final class LLEnumeration implements Enumeration {
	LLCell cursor;
	LList list;


	/**Create an enumeration attached to a LList*/
	public LLEnumeration(LList l) {list = l; cursor=list.head;}
	/** Return true/false depending on whether there are more
	 * elements to enumerate.
	 */
	public boolean hasMoreElements() {
		if ( cursor!=null ) return true;
		else return false;
	}
	/**Get the next element in the enumeration.  Destructive in that
	 * the returned element is removed from the enumeration.  This
	 * does not affect the list itself.
	 * @return the next object in the enumeration.
	 */
	public Object nextElement() {
		if ( !hasMoreElements() ) throw new NoSuchElementException();
		LLCell p = cursor;
		cursor = cursor.next;
		return p.data;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -