|
JavaTM 2 Platform Std. Ed. v1. 4.0 |
||||||||||
ÀüÀÇ Å¬·¡½º ´ÙÀ½ÀÇ Å¬·¡½º | ÇÁ·¹ÀÓ ÀÖ¾î ÇÁ·¹ÀÓ ¾øÀ½ | ||||||||||
°³¿ä: »óÀÚ | Çʵå | constructor | ¸Þ¼Òµå | »ó¼¼: Çʵå | constructor | ¸Þ¼Òµå |
java.lang.Object | +--java.text.CollationKey
CollationKey
´Â ƯÁ¤ÀÇ Collator
¿ÀºêÁ§Æ®ÀÇ ·êÀÇ ¾Æ·¡¿¡¼ ÀÖ´Â String
¸¦ ³ªÅ¸³À´Ï´Ù. 2 °³ÀÇ CollationKey
¸¦ ºñ±³Çϸé(ÀÚ), ±×°ÍµéÀÌ ³ªÅ¸³»´Â String
ÀÇ »ó´ë ¼ø¼°¡ µ¹·ÁÁÖ¾îÁý´Ï´Ù. CollationKey
¸¦ »ç¿ëÇØ String
¸¦ ºñ±³ÇÏ´Â (ºÐ)ÆíÀÌ ÀϹÝÀûÀ¸·Î Collator.compare
º¸´Ù °í¼ÓÀ¸·Î. µû¶ó¼, º¹¼öÀÇ String
¸¦ ¸î¹øÀ̳ª ºñ±³ÇÏ´Â °æ¿ì (¿¹¸¦ µé¾î,String
ÀÇ ¸®½ºÆ®¸¦ ¼ÒÆ® ÇÏ´Â °æ¿ì)¿¡´Â CollationKey
¸¦ »ç¿ëÇÏ´Â (ºÐ)ÆíÀÌ È¿À²ÀûÀÔ´Ï´Ù.
CollationKey
¸¦ Á÷Á¢ ÀÛ¼ºÇÒ ¼ö ¾ø½À´Ï´Ù. ±×°ÍµéÀ» »ý¼ºÇÏ·Á¸é ,Collator.getCollationKey
¸¦ È£ÃâÇÒ Çʿ䰡 ÀÖ½À´Ï´Ù. CollationKey
¸¦ ºñ±³ÇÏ´Â °æ¿ì, ±×°ÍµéÀº °°Àº Collator
¿ÀºêÁ§Æ®·ÎºÎÅÍ »ý¼ºÇÏÁö ¾ÊÀ¸¸é ¾ÈµË´Ï´Ù.
String
ÀÇ CollationKey
¸¦ »ý¼ºÇϱâ À§Çؼ´Â String
Àüü¸¦ Á¶»çÇØ ±×°ÍÀ», ºñÆ® ´ÜÀ§·Î ºñ±³ÇÒ ¼ö ÀÖ´Â ºñÆ®¿·Î º¯È¯ÇÒ Çʿ䰡 ÀÖ½À´Ï´Ù. ÀÌ·¸°Ô Çϸé(ÀÚ), ۰¡ »ý¼ºµÈ ÈÄ¿¡, ºñ±³°¡ °í¼ÓÀ¸·Î ÇàÇØÁý´Ï´Ù. ۸¦ »ý¼ºÇÏ´Â ÄÚ½ºÆ®´Â String
¸¦ ¸î¹øÀ̳ª ºñ±³ÇÒ Çʿ䰡 ÀÖ´Â °æ¿ì¿¡´Â °í¼ÓÀÇ ºñ±³¿¡ ÀÇÇØ º¸ÃæÇÒ ¼ö°¡ ÀÖ½À´Ï´Ù. ÇÑÆí, ºñ±³ÀÇ °á°ú´Â °¢°¢ÀÇ String
ÀÇ ÃÖÃÊÀÇ 2 ij¸¯ÅÍ·Î Á¤ÇØÁö´Â ÀÏÀÌ ÀÚÁÖ ÀÖ½À´Ï´Ù. Collator.compare
¿¡¼´Â ÇÊ¿äÇÑ Ä³¸¯Åͼö¸¸ÅÀÌ ºñ±³µÇ¹Ç·Î, ´ÜÀÏÀÇ ºñ±³¿¡¼´Â ÀÌ (ºÐ)ÆíÀÌ °í¼ÓÀ¸·Î.
´ÙÀ½ÀÇ ¿¹´Â CollationKey
¸¦ »ç¿ëÇØ,String
ÀÇ ¸®½ºÆ®¸¦ ¼ÒÆ® ÇÏ´Â °æ¿ì¸¦ ³ªÅ¸³½ °ÍÀÔ´Ï´Ù.
// Create an array of CollationKeys for the Strings to be sorted. Collator myCollator = Collator.getInstance(); CollationKey[] keys = new CollationKey[3]; keys[0] = myCollator.getCollationKey("Tom"); keys[1] = myCollator.getCollationKey("Dick"); keys[2] = myCollator.getCollationKey("Harry"); sort( keys );
//...
// Inside body of sort routine, compare keys this way if( keys[i]. compareTo( keys[j] ) > 0 ) // swap keys[i] and keys[j]
//...
// Finally, when we've returned from sort. System.out.println( keys[0]. getSourceString() ); System.out.println( keys[1]. getSourceString() ); System.out.println( keys[2]. getSourceString() );
Collator
,
RuleBasedCollator
¸Þ¼ÒµåÀÇ °³¿ä | |
int |
compareTo (CollationKey target)
ÀÌ CollationKey ¸¦ Ÿ°ÙÀÇ CollationKey ¿Í ºñ±³ÇÕ´Ï´Ù. |
int |
compareTo (Object o)
CollationKey ¿Í ÁöÁ¤µÈ Object ÀÇ ¼ø¼¸¦ ºñ±³ÇÕ´Ï´Ù. |
boolean |
equals (Object target)
CollationKey ¿Í Ÿ°ÙÀÇ CollationKey °¡ µ¿ÀÏÇÑÁö ¾î¶²Áö¸¦ ºñ±³ÇÕ´Ï´Ù. |
String |
getSourceString ()
ÀÌ CollationKey °¡ ³ªÅ¸³»´Â String ¸¦ µ¹·ÁÁÝ´Ï´Ù. |
int |
hashCode ()
CollationKey ÀÇ ÇØ½Ã Äڵ带 ÀÛ¼ºÇÕ´Ï´Ù. |
byte[] |
toByteArray ()
CollationKey ¸¦ ºñÆ®¿·Î º¯È¯ÇÕ´Ï´Ù. |
Ŭ·¡½º java.lang. Object ¿¡¼ »ó¼Ó¹ÞÀº ¸Þ¼Òµå |
clone , finalize , getClass , notify , notifyAll , toString , wait , wait , wait |
¸Þ¼ÒµåÀÇ »ó¼¼ |
public int compareTo(CollationKey target)
target
- Ÿ°ÙÀÇ CollationKey
Collator.compare(java.lang.String, java.lang.String)
public int compareTo(Object o)
Comparable
³»ÀÇ compareTo
o
- ºñ±³ ´ë»óÀÇ Object
ClassCastException
- ÁöÁ¤µÈ Object °¡ CollationKey °¡ ¾Æ´Ñ °æ¿ìComparable
public boolean equals(Object target)
Object
³»ÀÇ equals
target
- ºñ±³ ´ë»óÀÇ CollationKey
Object.hashCode()
,
Hashtable
public int hashCode()
Object
³»ÀÇ hashCode
Object.equals(java.lang.Object)
,
Hashtable
public String getSourceString()
public byte[] toByteArray()
|
JavaTM 2 Platform Std. Ed. v1. 4.0 |
||||||||||
ÀüÀÇ Å¬·¡½º ´ÙÀ½ÀÇ Å¬·¡½º | ÇÁ·¹ÀÓ ÀÖ¾î ÇÁ·¹ÀÓ ¾øÀ½ | ||||||||||
°³¿ä: »óÀÚ | Çʵå | constructor | ¸Þ¼Òµå | »ó¼¼: Çʵå | constructor | ¸Þ¼Òµå |
Java, Java 2 D, ¹× JDBC ´Â ¹Ì±¹ ¹× ±× ¿ÜÀÇ ³ª¶ó¿¡ ÀÖ¾î¼ÀÇ ¹Ì±¹ Sun Microsystems, Inc. ÀÇ »óÇ¥ ȤÀº µî·Ï»óÇ¥ÀÔ´Ï´Ù.
Copyright 1993-2002 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.