|
JavaTM Platform Standard Ed. 6 |
|||||||||
전의 클래스 다음의 클래스 | 프레임 있어 프레임 없음 | |||||||||
개요: 상자 | 필드 | 생성자 | 메소드 | 상세: 필드 | 생성자 | 메소드 |
java.lang.Object javax.swing.text.ElementIterator
public class ElementIterator
ElementIterator 는, 그 이름이 가리키는 대로, 요소 트리를 반복 처리 합니다. 생성자 을 호출하려면 , 문서 또는 요소를 인수에 사용합니다. 문서를 인수로서 생성자 을 호출하면(자), 반복의 루트는 document.getDefaultRootElement()의 반환값이 됩니다. 깊이 우선 방식에서 반복합니다. 경계의 처리법은 다음과 같습니다. a) first() 또는 current()보다 먼저 next()가 불려 갔을 경우는, 루트를 돌려줍니다. b) next()는 null 를 돌려주어 리스트의 말미를 나타냅니다. c) 현재의 요소가 루트의 경우, 또는 next()가 null 를 돌려주었을 경우는, previous()는 null 를 돌려줍니다. ElementIterator 는 요소 트리를 잠그지 않습니다. 즉, ElementIterator 는 어떠한 변경도 추적하지 않습니다. 이 클래스의 사용자가, 요소의 반복 처리로 변경이 생기지 않은 것을 확인할 필요가 있습니다. 다음에, 간단한 사용예를 나타냅니다. public void iterate() { ElementIterator it = new ElementIterator(root); Element elem; while (true) { if ((elem = next()) ! = null) { // process element System.out.println("elem: " + elem.getName()); } else { break; } } }
생성자 의 개요 | |
---|---|
ElementIterator (Document document)
새로운 ElementIterator 를 작성합니다. |
|
ElementIterator (Element root)
새로운 ElementIterator 를 작성합니다. |
메소드의 개요 | |
---|---|
Object |
clone ()
ElementIterator 를 복제합니다. |
Element |
current ()
현재의 Element 를 가져옵니다. |
int |
depth ()
요소 트리의 현재의 깊이를 가져옵니다. |
Element |
first ()
선두의 요소를 가져옵니다. |
Element |
next ()
다음의 Element 를 가져옵니다. |
Element |
previous ()
직전의 Element 를 가져옵니다. |
클래스 java.lang. Object 로부터 상속된 메소드 |
---|
equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait |
생성자 의 상세 |
---|
public ElementIterator(Document document)
document
- Documentpublic ElementIterator(Element root)
root
- 루트 Element메소드의 상세 |
---|
public Object clone()
Object
내의 clone
Cloneable
public Element first()
public int depth()
public Element current()
null
의 경우는 null
public Element next()
null
public Element previous()
Element
|
JavaTM Platform Standard Ed. 6 |
|||||||||
전의 클래스 다음의 클래스 | 프레임 있어 프레임 없음 | |||||||||
개요: 상자 | 필드 | 생성자 | 메소드 | 상세: 필드 | 생성자 | 메소드 |
Copyright 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms . Documentation Redistribution Policy 도 참조해 주세요.