abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r1239419 - in /abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text: Codec.java CodepointIterator.java CodepointMatcher.java CodepointMatchers.java NormalizationForm.java
Date Thu, 02 Feb 2012 00:22:32 GMT
Author: jmsnell
Date: Thu Feb  2 00:22:31 2012
New Revision: 1239419

URL: http://svn.apache.org/viewvc?rev=1239419&view=rev
Log:
Documentation updates

Modified:
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/Codec.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/CodepointIterator.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/CodepointMatcher.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/CodepointMatchers.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/NormalizationForm.java

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/Codec.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/Codec.java?rev=1239419&r1=1239418&r2=1239419&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/Codec.java (original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/Codec.java Thu Feb
 2 00:22:31 2012
@@ -30,6 +30,16 @@ import org.apache.commons.codec.net.QCod
 import com.google.common.base.Function;
 import com.google.common.collect.ImmutableSet;
 
+/**
+ * Provides utility classes for the legacy B and Q Encodings (RFC 2047)
+ * historically used to encoded non-ascii characters within the headers of HTTP messages.
+ * Also provides an implementation of the newer, easier to understand and implement
+ * mechanism for encoding Header parameters defined by RFC 5987 (what I call 
+ * the "Star Encoding" here due to the use of the * character within the encoding.
+ * 
+ * The Star Encoding is assumed to be the default when encoding data, but 
+ * all codecs will be tried transparently when decoding. 
+ */
 public enum Codec {
     B, 
     Q,

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/CodepointIterator.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/CodepointIterator.java?rev=1239419&r1=1239418&r2=1239419&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/CodepointIterator.java
(original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/CodepointIterator.java
Thu Feb  2 00:22:31 2012
@@ -33,6 +33,10 @@ import java.util.NoSuchElementException;
 import com.ibm.icu.text.UCharacterIterator;
 import com.ibm.icu.text.UForwardCharacterIterator;
 
+/**
+ * Utility for iterating over the unicode codepoints in a char array,
+ * charsequence, byte array, etc. 
+ */
 public abstract class CodepointIterator 
   implements Iterator<Integer> {
   

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/CodepointMatcher.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/CodepointMatcher.java?rev=1239419&r1=1239418&r2=1239419&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/CodepointMatcher.java
(original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/CodepointMatcher.java
Thu Feb  2 00:22:31 2012
@@ -29,6 +29,12 @@ public abstract class CodepointMatcher 
   public static final CodepointMatcher MATCH_ALL = matchAll();
   public static final CodepointMatcher MATCH_NONE = matchNone();
   
+  /**
+   * Verify that each of the unicode codepoints in the specified
+   * iterator match this matchers criteria. If successful, the
+   * method will return, If unsuccessful, an InvalidCharacterException
+   * will be thrown.
+   */
   public void verify(CodepointIterator iterator) {
     while(iterator.hasNext()) {
       int cp = iterator.next();
@@ -37,6 +43,12 @@ public abstract class CodepointMatcher 
     }
   }
   
+  /**
+   * Verify that each of the unicode codepoints in the specified
+   * iterator do not match this matchers criteria. If successful, the
+   * method will return, If unsuccessful, an InvalidCharacterException
+   * will be thrown.
+   */
   public void verifyNot(CodepointIterator iterator) {
     while(iterator.hasNext()) {
       int cp = iterator.next();
@@ -45,14 +57,26 @@ public abstract class CodepointMatcher 
     }
   }
   
+  /**
+   * True if all of the charsequence's unicode codepoints match
+   * the criteria
+   */
   public boolean all(CharSequence seq) {
     return all(CodepointIterator.getInstance(seq));
   }
   
+  /**
+   * True if any of the charsequence's unicode codepoints match
+   * the criteria
+   */
   public boolean any(CharSequence seq) {
     return any(CodepointIterator.getInstance(seq));
   }
   
+  /**
+   * True if all of the iterator's unicode codepoints match
+   * the criteria
+   */
   public boolean all(CodepointIterator iterator) {
     while (iterator.hasNext())
       if (!apply(iterator.next()))
@@ -60,6 +84,10 @@ public abstract class CodepointMatcher 
     return true;
   }
   
+  /**
+   * True if any of the iterator's unicode codepoints match
+   * the criteria
+   */
   public boolean any(CodepointIterator iterator) {
     while (iterator.hasNext())
       if (apply(iterator.next()))
@@ -67,58 +95,110 @@ public abstract class CodepointMatcher 
     return false;    
   }
   
+  /**
+   * True if the codepoint matches the criteria
+   */
   public boolean matches(int codepoint) {
     return apply(codepoint);
   }
   
+  /**
+   * True if the codepoint matches the criteria
+   */
   public boolean apply(int codepoint) {
     return this.apply(Integer.valueOf(codepoint));
   }
   
+  /**
+   * Returns a CodepointMatcher that matches the opposite of this one
+   */
   public CodepointMatcher negate() {
     return new NegatingCodepointMatcher(this);
   }
   
+  /**
+   * Returns a CodepointMatcher that matches the opposite of the specified matcher
+   */
   public static CodepointMatcher negate(CodepointMatcher matcher) {
     return matcher.negate();
   }
 
+  /**
+   * Creates a new CodepointMatcher that matches either this Codepoint Matcher
+   * or the specified matcher.
+   */
   public CodepointMatcher or(CodepointMatcher that) {
     return new OrCodepointMatcher(this,that);
   }
   
+  /**
+   * Creates a new CodepointMatcher that matches either this Codepoint Matcher
+   * or the specified matchers.
+   */
   public static CodepointMatcher or(CodepointMatcher... matchers) {
     return new OrCodepointMatcher(matchers);
   }
   
+  /**
+   * Creates a new CodepointMatcher that matches this Codepoint Matcher and 
+   * the specified matcher
+   */
   public CodepointMatcher and(CodepointMatcher that) {
     return new AndCodepointMatcher(this,that);
   }
   
+  /**
+   * Creates a ne CodepointMatcher that matches this Codepoint Matcher and
+   * the specified matchers
+   */
   public static CodepointMatcher and(CodepointMatcher... matchers) {
     return new AndCodepointMatcher(matchers);
   }
   
+  /**
+   * Returns a Codepoint Matcher that tests to ensure a codepoint is
+   * within a given range
+   */
   public static CodepointMatcher inRange(int low, int high) {
     return new RangeCodepointMatcher(low,high);
   }
   
+  /**
+   * Returns a Codepoint Matcher that tests to ensure a codepoint is 
+   * outside a given range
+   */
   public static CodepointMatcher notInRange(int low, int high) {
     return new NegatingCodepointMatcher(inRange(low,high));
   }
   
+  /**
+   * Returns a Codepoint Matcher that ensures a codepoint is one of a 
+   * specific set of codepoints
+   */
   public static CodepointMatcher is(int... cp) {
     return new IsCodepointMatcher(cp);
   }
   
+  /**
+   * Returns a Codepoint Matcher that ensures a codepoint is NOT one of a
+   * specific set of codepoints
+   */
   public static CodepointMatcher isNot(int cp) {
     return new NegatingCodepointMatcher(is(cp));
   }
   
+  /**
+   * Returns a Codepoint Matcher that ensures a codepoint is within a given
+   * set as described by the input inversion set.
+   */
   public static CodepointMatcher inInversionSet(int[] set) {
     return new InversionSetCodepointMatcher(set);
   }
   
+  /**
+   * Returns a Codepoint Matcher that ensures a codepoint is NOT within a 
+   * given set as described by the input inversion set
+   */
   public static CodepointMatcher notInInversionSet(int[] set) {
     return new NegatingCodepointMatcher(inInversionSet(set));
   }

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/CodepointMatchers.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/CodepointMatchers.java?rev=1239419&r1=1239418&r2=1239419&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/CodepointMatchers.java
(original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/CodepointMatchers.java
Thu Feb  2 00:22:31 2012
@@ -21,7 +21,11 @@ import static org.apache.abdera2.common.
 
 import org.apache.abdera2.common.xml.XMLVersion;
 
-public class CodepointMatchers {
+/**
+ * Variety of Codepoint Matcher implementations... most deal with 
+ * URI/IRI validation requirements
+ */
+public final class CodepointMatchers {
 
   public static CodepointMatcher isAlpha() {
     return new OrCodepointMatcher(

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/NormalizationForm.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/NormalizationForm.java?rev=1239419&r1=1239418&r2=1239419&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/NormalizationForm.java
(original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/NormalizationForm.java
Thu Feb  2 00:22:31 2012
@@ -28,6 +28,9 @@ import com.google.common.base.Predicate;
 import com.ibm.icu.text.Normalizer2;
 import com.ibm.icu.text.Normalizer2.Mode;
 
+/**
+ * Utility that wraps Unicode Normalization functions
+ */
 public enum NormalizationForm
   implements Function<CharSequence,CharSequence> {
   



Mime
View raw message