abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r633199 - in /incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n: lang/ rfc4646/ rfc4646/enums/ text/
Date Mon, 03 Mar 2008 17:42:43 GMT
Author: jmsnell
Date: Mon Mar  3 09:42:41 2008
New Revision: 633199

URL: http://svn.apache.org/viewvc?rev=633199&view=rev
Log:
javadocs

Modified:
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/lang/Lang.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/Lang.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/Range.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/enums/Extlang.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/enums/Language.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/enums/Region.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/enums/Script.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/enums/Singleton.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/enums/Variant.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/text/Bidi.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/text/CharUtils.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/text/Codepoint.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/text/Filter.java

Modified: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/lang/Lang.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/lang/Lang.java?rev=633199&r1=633198&r2=633199&view=diff
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/lang/Lang.java
(original)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/lang/Lang.java
Mon Mar  3 09:42:41 2008
@@ -27,7 +27,7 @@
 
 
 /**
- * rfc3066 implementation
+ * rfc3066 implementation. This has been deprecated. Use org.apache.abdera.i18n.rfc4646.Lang
instead
  * @deprecated 
  * @see org.apache.abdera.i18n.rfc4646.Lang
  */

Modified: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/Lang.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/Lang.java?rev=633199&r1=633198&r2=633199&view=diff
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/Lang.java
(original)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/Lang.java
Mon Mar  3 09:42:41 2008
@@ -29,7 +29,7 @@
 
 
 /**
- * Implementation of RFC 4646
+ * Implementation of RFC 4646 Language Tags
  */
 public final class Lang
   extends SubtagSet {

Modified: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/Range.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/Range.java?rev=633199&r1=633198&r2=633199&view=diff
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/Range.java
(original)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/Range.java
Mon Mar  3 09:42:41 2008
@@ -27,7 +27,7 @@
 import org.apache.abdera.i18n.rfc4646.Subtag.Type;
 
 /**
- * A language range used for matching
+ * A language range used for matching language tags
  */
 public class Range  
   extends SubtagSet {

Modified: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/enums/Extlang.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/enums/Extlang.java?rev=633199&r1=633198&r2=633199&view=diff
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/enums/Extlang.java
(original)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/enums/Extlang.java
Mon Mar  3 09:42:41 2008
@@ -21,9 +21,11 @@
 
 import org.apache.abdera.i18n.rfc4646.Subtag;
 
-
+/**
+ * Enum constants used to validate language tags
+ */
 public enum Extlang {
-// none registrered yet
+// none registered yet
   ;
   
   private final String deprecated;

Modified: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/enums/Language.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/enums/Language.java?rev=633199&r1=633198&r2=633199&view=diff
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/enums/Language.java
(original)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/enums/Language.java
Mon Mar  3 09:42:41 2008
@@ -21,7 +21,9 @@
 
 import org.apache.abdera.i18n.rfc4646.Subtag;
 
-
+/**
+ * Enum constants used to validate language tags
+ */
 public enum Language {
 
   AA(null,null,null,"Afar"),

Modified: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/enums/Region.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/enums/Region.java?rev=633199&r1=633198&r2=633199&view=diff
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/enums/Region.java
(original)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/enums/Region.java
Mon Mar  3 09:42:41 2008
@@ -21,7 +21,9 @@
 
 import org.apache.abdera.i18n.rfc4646.Subtag;
 
-
+/**
+ * Enum constants used to validate language tags
+ */
 public enum Region {
 
   AA(null,null,"PRIVATE USE"),

Modified: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/enums/Script.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/enums/Script.java?rev=633199&r1=633198&r2=633199&view=diff
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/enums/Script.java
(original)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/enums/Script.java
Mon Mar  3 09:42:41 2008
@@ -21,7 +21,9 @@
 
 import org.apache.abdera.i18n.rfc4646.Subtag;
 
-
+/**
+ * Enum constants used to validate language tags
+ */
 public enum Script {
 
   ARAB(null,null,"Arabic"),

Modified: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/enums/Singleton.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/enums/Singleton.java?rev=633199&r1=633198&r2=633199&view=diff
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/enums/Singleton.java
(original)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/enums/Singleton.java
Mon Mar  3 09:42:41 2008
@@ -21,6 +21,9 @@
 
 import org.apache.abdera.i18n.rfc4646.Subtag;
 
+/**
+ * Enum constants used to validate language tags
+ */
 public enum Singleton {
   A("Undefined", -1, null, null),
   B("Undefined", -1, null, null),

Modified: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/enums/Variant.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/enums/Variant.java?rev=633199&r1=633198&r2=633199&view=diff
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/enums/Variant.java
(original)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/rfc4646/enums/Variant.java
Mon Mar  3 09:42:41 2008
@@ -21,7 +21,9 @@
 
 import org.apache.abdera.i18n.rfc4646.Subtag;
 
-
+/**
+ * Enum constants used to validate language tags
+ */
 public enum Variant {
 
   _1606NICT(null,null,"frm","Late Middle French (to 1606)"),

Modified: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/text/Bidi.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/text/Bidi.java?rev=633199&r1=633198&r2=633199&view=diff
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/text/Bidi.java
(original)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/text/Bidi.java
Mon Mar  3 09:42:41 2008
@@ -63,6 +63,11 @@
     "cspc862latinhebrew"
   };
   
+  /**
+   * Algorithm that will determine text direction by looking at the 
+   * characteristics of the language tag.  If the tag uses a language
+   * or script that is known to be RTL, then Direction.RTL will be returned
+   */
   public static Direction guessDirectionFromLanguage(Lang lang) {
     if (lang.getScript() != null) {
       String script = lang.getScript().getName();
@@ -75,6 +80,11 @@
     return Direction.UNSPECIFIED;
   }
  
+  /**
+   * Algorithm that will determine text direction by looking at the 
+   * character set encoding.  If the charset is typically used for RTL 
+   * languages, Direction.RTL will be returned
+   */
   public static Direction guessDirectionFromEncoding(String charset) {
     if (charset == null) return Direction.UNSPECIFIED;
     charset = charset.replace('_', '-');
@@ -84,6 +94,11 @@
     return Direction.UNSPECIFIED;
   }
   
+  /**
+   * Algorithm that analyzes properties of the text to determine text direction.
+   * If the majority of characters in the text are RTL characters, then
+   * Direction.RTL will be returned.
+   */
   public static Direction guessDirectionFromTextProperties(String text) {
     if (text != null && text.length() > 0) {
       if (text.charAt(0) == 0x200F) return Direction.RTL; // if using the unicode right-to-left
mark
@@ -99,6 +114,9 @@
     return Direction.UNSPECIFIED;
   }
   
+  /**
+   * Algorithm that defers to the Java Bidi implementation to determine text direction.
+   */
   public static Direction guessDirectionFromJavaBidi(String text) {
     if (text != null) {
       AttributedString s = new AttributedString(text);

Modified: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/text/CharUtils.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/text/CharUtils.java?rev=633199&r1=633198&r2=633199&view=diff
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/text/CharUtils.java
(original)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/text/CharUtils.java
Mon Mar  3 09:42:41 2008
@@ -27,20 +27,32 @@
 
   private CharUtils() {}
  
+  /**
+   * True if the character is a valid unicode codepoint
+   */
   public static boolean isValid(int c) {
     return c >= 0x000000 && c <= 0x10ffff;
   }
-  
+
+  /**
+   * True if the character is a valid unicode codepoint
+   */
   public static boolean isValid(Codepoint c) {
     return isValid(c.getValue());
   }
   
+  /**
+   * True if all the characters in chars are within the set [low,high]
+   */
   public static boolean inRange(char[] chars, char low, char high) {
     for (int i = 0; i < chars.length; i++)
       if (chars[i] < low || chars[i] > high) return false;
     return true;
   }
 
+  /**
+   * True if all the characters in chars are within the set [low,high]
+   */
   public static boolean inRange(char[] chars, int low, int high) {
     for (int i = 0; i < chars.length; i++) {
       char n = chars[i];
@@ -55,14 +67,25 @@
     return true;
   }
   
+  /**
+   * True if the codepoint is within the set [low,high]
+   */
   public static boolean inRange(int codepoint, int low, int high) {
     return codepoint >= low && codepoint <= high;
   }
   
+  /**
+   * Append the specified codepoint to the buffer, automatically
+   * handling surrogate pairs
+   */
   public static void append(Appendable buf, Codepoint c) {
     append(buf,c.getValue());
   }
   
+  /**
+   * Append the specified codepoint to the buffer, automatically
+   * handling surrogate pairs
+   */
   public static void append(Appendable buf, int c) {
     try {
       if (isSupplementary(c)) {
@@ -74,32 +97,53 @@
     }
   }
 
+  /**
+   * Get the high surrogate for a particular unicode codepoint
+   */
   public static char getHighSurrogate(int c) {
     return (c >= 0x10000) ?
        (char)((0xD800 - (0x10000 >> 10)) + (c >> 10)) : 0;
   }
 
+  /**
+   * Get the low surrogate for a particular unicode codepoint
+   */
   public static char getLowSurrogate(int c) {    
     return (c >= 0x10000) ?
         (char)(0xDC00 + (c & 0x3FF)) : (char)c;
   }
   
+  /**
+   * True if the specified char is a high surrogate
+   */
   public static boolean isHighSurrogate(char c) {
     return c <= '\uDBFF' && c >= '\uD800';
   }
 
+  /**
+   * True if the specified char is a low surrogate
+   */
   public static boolean isLowSurrogate(char c) {
     return c <= '\uDFFF' && c >= '\uDC00';
   }
   
+  /**
+   * True if the specified character is supplemental
+   */
   public static boolean isSupplementary(int c) {
     return c <= 0x10ffff && c >= 0x010000;
   }
   
+  /**
+   * True if the two chars represent a surrogate pair
+   */
   public static boolean isSurrogatePair(char high, char low) {
     return isHighSurrogate(high) && isLowSurrogate(low);
   }
   
+  /**
+   * Converts the high and low surrogate into a supplementary codepoint
+   */
   public static Codepoint toSupplementary(char high, char low) {
     if (!isHighSurrogate(high)) 
       throw new IllegalArgumentException("Invalid High Surrogate");
@@ -108,6 +152,9 @@
     return new Codepoint(((high - '\uD800') << 10) + (low - '\uDC00') + 0x010000);
   
   }
 
+  /**
+   * Return the codepoint at the given location, automatically dealing with surrogate pairs
+   */
   public static Codepoint codepointAt(String s, int i) {
     char c = s.charAt(i);
     if (c < 0xD800 || c > 0xDFFF) return new Codepoint(c);
@@ -125,6 +172,9 @@
     return new Codepoint(c);
   }
   
+  /**
+   * Return the codepoint at the given location, automatically dealing with surrogate pairs
+   */
   public static Codepoint codepointAt(CharSequence s, int i) {
     char c = s.charAt(i);
     if (c < 0xD800 || c > 0xDFFF) return new Codepoint(c);
@@ -142,10 +192,16 @@
     return new Codepoint(c);
   }
   
+  /**
+   * Insert a codepoint into the buffer, automatically dealing with surrogate pairs 
+   */
   public static void insert(CharSequence s, int i, Codepoint c) {
     insert(s,i,c.getValue());
   }
   
+  /**
+   * Insert a codepoint into the buffer, automatically dealing with surrogate pairs 
+   */
   public static void insert(CharSequence s, int i, int c) {
     if (!(s instanceof StringBuilder) && 
         !(s instanceof StringBuffer)) { 
@@ -167,10 +223,16 @@
     }
   }
   
+  /**
+   * Set the character at a given location, automatically dealing with surrogate pairs 
+   */
   public static void setChar(CharSequence s, int i, Codepoint c) {
     setChar(s,i,c.getValue());
   }
   
+  /**
+   * Set the character at a given location, automatically dealing with surrogate pairs 
+   */
   public static void setChar(CharSequence s, int i, int c) {
     if (!(s instanceof StringBuilder) && 
         !(s instanceof StringBuffer)) { 
@@ -195,18 +257,30 @@
     }
   }
   
+  /**
+   * Return the number of characters used to represent the codepoint (will return 1 or 2)
+   */
   public static int length(Codepoint c) {
     return c.getCharCount();
   }
   
+  /**
+   * Return the number of characters used to represent the codepoint (will return 1 or 2)
+   */
   public static int length(int c) {
     return new Codepoint(c).getCharCount();
   }
   
+  /**
+   * Return the total number of codepoints in the buffer.  Each surrogate pair counts as
a single codepoint
+   */
   public static int length(CharSequence c) {
     return length(CodepointIterator.forCharSequence(c));
   }
   
+  /**
+   * Return the total number of codepoints in the buffer.  Each surrogate pair counts as
a single codepoint
+   */
   public static int length(char[] c) {
     return length(CodepointIterator.forCharArray(c));
   }
@@ -226,6 +300,9 @@
     return buf.toString();
   }
   
+  /**
+   * Return the String representation of the codepoint, automatically dealing with surrogate
pairs
+   */
   public static String toString(int c) {
     return (isSupplementary(c)) ? 
       supplementaryToString(c) : 
@@ -252,8 +329,10 @@
     return s;
   }
     
-  public static String stripBidiInternal(String s) {
-    
+  /**
+   * Removes bidi controls from within a string
+   */
+  public static String stripBidiInternal(String s) {    
     return s.replaceAll("[\u202A\u202B\u202D\u202E\u200E\u200F\u202C]", "");
   }
 
@@ -280,36 +359,60 @@
       default:  return s;
     }
   }
-  
+
+  /**
+   * True if the codepoint is a digit
+   */
   public static boolean isDigit(Codepoint codepoint) {
     return isDigit(codepoint.getValue());
   }
   
+  /**
+   * True if the codepoint is a digit
+   */
   public static boolean isDigit(int codepoint) {
     return CharUtils.inRange(codepoint, '0', '9');
   }
   
+  /**
+   * True if the codepoint is part of the ASCII alphabet (a-z, A-Z)
+   */
   public static boolean isAlpha(Codepoint codepoint) {
     return isAlpha(codepoint.getValue());
   }
   
+  /**
+   * True if the codepoint is part of the ASCII alphabet (a-z, A-Z)
+   */
   public static boolean isAlpha(int codepoint) {
     return CharUtils.inRange(codepoint, 'A', 'Z') ||
            CharUtils.inRange(codepoint, 'a', 'z');
   }
 
+  /**
+   * True if isAlpha and isDigit both return true
+   */
   public static boolean isAlphaDigit(Codepoint codepoint) {
     return isAlphaDigit(codepoint.getValue());
   }
   
+  /**
+   * True if isAlpha and isDigit both return true
+   */
   public static boolean isAlphaDigit(int codepoint) {
     return isDigit(codepoint) || isAlpha(codepoint);
   }
 
+  /**
+   * True if the codepoint is a bidi control character
+   */
   public static boolean isBidi(Codepoint codepoint) {
     return isBidi(codepoint.getValue());
   }
   
+  /**
+   * True if the codepoint is a bidi control character
+   */
   public static boolean isBidi(int codepoint) {
     return  codepoint == LRM || // Left-to-right mark
             codepoint == RLM || // Right-to-left mark
@@ -355,7 +458,6 @@
     return ((s-1) & 1) == 0;    
   }
   
-  
   public static enum Profile {
     NONE(
       new Filter() {
@@ -797,36 +899,57 @@
            codepoint == '-';
   }
 
+  /**
+   * Verifies a sequence of codepoints using the specified filter
+   */
   public static void verify(CodepointIterator ci, Filter filter) throws InvalidCharacterException
{
     CodepointIterator rci = CodepointIterator.restrict(ci, filter);
     while (rci.hasNext()) rci.next();
   }
   
+  /**
+   * Verifies a sequence of codepoints using the specified filter
+   */
   public static void verify(CodepointIterator ci, Profile profile) throws InvalidCharacterException
{
     CodepointIterator rci = CodepointIterator.restrict(ci, profile.filter());
     while (rci.hasNext()) rci.next();
   }
   
+  /**
+   * Verifies a sequence of codepoints using the specified profile
+   */
   public static void verify(char[] s, Profile profile) throws InvalidCharacterException {
     if (s == null) return;
     verify(CodepointIterator.forCharArray(s),profile);
   }
   
+  /**
+   * Verifies a sequence of codepoints using the specified profile
+   */
   public static void verify(String s, Profile profile) throws InvalidCharacterException {
     if (s == null) return;
     verify(CodepointIterator.forCharSequence(s),profile);
   }
 
+  /**
+   * Verifies a sequence of codepoints using the specified filter
+   */
   public static void verifyNot(CodepointIterator ci, Filter filter) throws InvalidCharacterException
{
     CodepointIterator rci = ci.restrict(filter,false,true);
     while (rci.hasNext()) rci.next();
   }
   
+  /**
+   * Verifies a sequence of codepoints using the specified profile
+   */
   public static void verifyNot(CodepointIterator ci, Profile profile) throws InvalidCharacterException
{
     CodepointIterator rci = ci.restrict(profile.filter(),false,true);
     while (rci.hasNext()) rci.next();
   }
   
+  /**
+   * Verifies a sequence of codepoints using the specified profile
+   */
   public static void verifyNot(char[] array, Profile profile) throws InvalidCharacterException
{
     CodepointIterator rci = 
       CodepointIterator.forCharArray(array)

Modified: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/text/Codepoint.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/text/Codepoint.java?rev=633199&r1=633198&r2=633199&view=diff
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/text/Codepoint.java
(original)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/text/Codepoint.java
Mon Mar  3 09:42:41 2008
@@ -20,6 +20,9 @@
 import java.io.Serializable;
 import java.io.UnsupportedEncodingException;
 
+/**
+ * Represents a single Unicode Codepoint
+ */
 public class Codepoint
   implements Serializable, 
              Cloneable,
@@ -30,6 +33,9 @@
   private static final String DEFAULT_ENCODING = "UTF-8";
   private final int value;
 
+  /**
+   * Create a Codepoint from a byte array using the default encoding (UTF-8)
+   */
   public Codepoint(byte[] bytes) {
     try {
       this.value = valueFromCharSequence(new String(bytes,DEFAULT_ENCODING));
@@ -38,6 +44,9 @@
     }
   }
   
+  /**
+   * Create a Codepoint from a byte array with the specified charset encoding. Length must
equal 1
+   */
   public Codepoint(
     byte[] bytes, 
     String encoding) 
@@ -45,6 +54,9 @@
     this.value = valueFromCharSequence(new String(bytes,encoding));
   }
   
+  /**
+   * Create a Codepoint from a CharSequence. Length must equal 1
+   */
   public Codepoint(CharSequence value) {
     this(valueFromCharSequence(value));
   }
@@ -61,18 +73,30 @@
     }
   }
   
+  /**
+   * Create a codepoint from a single char
+   */
   public Codepoint(char value) {
     this((int)value);
   }
-  
+
+  /**
+   * Create a codepoint from a surrogate pair
+   */
   public Codepoint(char high, char low) {
     this(CharUtils.toSupplementary(high, low).getValue());
   }
   
+  /**
+   * Create a codepoint as a copy of another codepoint
+   */
   public Codepoint(Codepoint codepoint) {
     this(codepoint.value);
   }
   
+  /**
+   * Create a codepoint from a specific integer value
+   */
   public Codepoint(int value) {
     if (value < 0) 
       throw new IllegalArgumentException(
@@ -80,22 +104,67 @@
     this.value = value;
   }
   
+  /**
+   * The codepoint value
+   */
   public int getValue() {
     return value;
   }
   
+  /**
+   * True if this codepoint is supplementary
+   */
   public boolean isSupplementary() {
     return CharUtils.isSupplementary(value);
   }
-  
+
+  /**
+   * True if this codepoint is a low surrogate
+   */
   public boolean isLowSurrogate() {
     return CharUtils.isLowSurrogate((char)value);
   }
   
+  /**
+   * True if this codepoint is a high surrogate
+   */
   public boolean isHighSurrogate() {
     return CharUtils.isHighSurrogate((char)value);
   }
   
+  /**
+   * Get the high surrogate of this Codepoint
+   */
+  public char getHighSurrogate() {
+    return CharUtils.getHighSurrogate(value);
+  }
+  
+  /**
+   * Get the low surrogate of this Codepoint
+   */
+  public char getLowSurrogate() {
+    return CharUtils.getLowSurrogate(value);
+  }
+  
+  /**
+   * True if this Codepoint is a bidi control char
+   */
+  public boolean isBidi() {
+    return CharUtils.isBidi(value);
+  }
+  
+  public boolean isDigit() {
+    return CharUtils.isDigit(value);
+  }
+
+  public boolean isAlpha() {
+    return CharUtils.isAlpha(value);
+  }
+  
+  public boolean isAlphaDigit() {
+    return CharUtils.isAlpha(value);
+  }
+  
   public int compareTo(Codepoint o) {
     return value < o.value ? -1 :
            value == o.value ? 0 : 1;
@@ -109,6 +178,10 @@
     return toString().toCharArray();
   }
   
+  /**
+   * Get the number of chars necessary to represent this codepoint.
+   * Returns 2 if this is a supplementary codepoint
+   */
   public int getCharCount() {
     return toChars().length;
   }
@@ -166,11 +239,17 @@
     }
   }
   
+  /**
+   * Get the next codepoint
+   */
   public Codepoint next() {
     if (value == 0x10ffff) throw new IndexOutOfBoundsException();
     return new Codepoint(value + 1);
   }
   
+  /**
+   * Get the previous codepoint
+   */
   public Codepoint previous() {
     if (value == 0) throw new IndexOutOfBoundsException();
     return new Codepoint(value - 1);

Modified: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/text/Filter.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/text/Filter.java?rev=633199&r1=633198&r2=633199&view=diff
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/text/Filter.java
(original)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/text/Filter.java
Mon Mar  3 09:42:41 2008
@@ -17,6 +17,9 @@
 */
 package org.apache.abdera.i18n.text;
 
+/**
+ * Filters are used in a variety of ways to filter or verify unicode codepoints
+ */
 public interface Filter {
 
   boolean accept(int c);



Mime
View raw message