|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
ÀÌÀü Ŭ·¡½º ´ÙÀ½ Ŭ·¡½º | ÇÁ·¹ÀÓÀ¸·Î ÇÁ·¹ÀÓ ¾øÀÌ | |||||||||
°³¿ä: NESTED | Çʵå | constructor | ¸Þ¼µå | »ó¼¼: Çʵå | »ý¼ºÀÚ | ¸Þ¼µå |
java.lang.Objectjavax.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 2 Platform Standard Ed. 5.0 |
|||||||||
ÀÌÀü Ŭ·¡½º ´ÙÀ½ Ŭ·¡½º | ÇÁ·¹ÀÓÀ¸·Î ÇÁ·¹ÀÓ ¾øÀÌ | |||||||||
°³¿ä: NESTED | Çʵå | constructor | ¸Þ¼µå | »ó¼¼: Çʵå | »ý¼ºÀÚ | ¸Þ¼µå |
Copyright 2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms . Documentation Redistribution Policy µµ ÂüÁ¶ÇϽʽÿÀ.