From 91bbad91cfa82813d0ce46b61db94e6637ee1e91 Mon Sep 17 00:00:00 2001 From: Alan Liu Date: Tue, 11 Jan 2000 04:03:54 +0000 Subject: [PATCH] Cleanup, embellish comments X-SVN-Rev: 523 --- icu4j/src/com/ibm/icu/text/UnicodeSet.java | 55 +++++++++++++++------- icu4j/src/com/ibm/text/UnicodeSet.java | 55 +++++++++++++++------- 2 files changed, 78 insertions(+), 32 deletions(-) diff --git a/icu4j/src/com/ibm/icu/text/UnicodeSet.java b/icu4j/src/com/ibm/icu/text/UnicodeSet.java index 975f2856fd..1fa000c5af 100755 --- a/icu4j/src/com/ibm/icu/text/UnicodeSet.java +++ b/icu4j/src/com/ibm/icu/text/UnicodeSet.java @@ -124,6 +124,10 @@ import java.util.Dictionary; * * * + * Any character may be preceded by a backslash in order to remove any special + * meaning. White space characters, as defined by Character.isWhitespace(), are + * ignored, unless they are escaped. + * * Patterns specify individual characters, ranges of characters, and * Unicode character categories. When elements are concatenated, they * specify their union. To complement a set, place a '^' immediately @@ -226,7 +230,8 @@ import java.util.Dictionary; * *Unsupported by Java (and hence unsupported by UnicodeSet). * * @author Alan Liu - * @version $RCSfile: UnicodeSet.java,v $ $Revision: 1.3 $ $Date: 2000/01/11 02:25:03 $ */ + * @version $RCSfile: UnicodeSet.java,v $ $Revision: 1.4 $ $Date: 2000/01/11 04:03:54 $ + */ public class UnicodeSet { /** * The internal representation is a StringBuffer of even length. @@ -300,18 +305,28 @@ public class UnicodeSet { applyPattern(pattern); } - - - - + /** + * Constructs a set from the given pattern. See the class description + * for the syntax of the pattern language. + * @param pattern a string specifying what characters are in the set + * @param pos on input, the position in pattern at which to start parsing. + * On output, the position after the last character parsed. + * @param varNameToChar a mapping from variable names (String) to characters + * (Character). May be null. If varCharToSet is non-null, then names may + * map to either single characters or sets, depending on whether a mapping + * exists in varCharToSet. If varCharToSet is null then all names map to + * single characters. + * @param varCharToSet a mapping from characters (Character objects from + * varNameToChar) to UnicodeSet objects. May be null. Is only used if + * varNameToChar is also non-null. + * @exception IllegalArgumentException if the pattern + * contains a syntax error. + */ public UnicodeSet(String pattern, ParsePosition pos, Dictionary varNameToChar, Dictionary varCharToSet) { applyPattern(pattern, pos, varNameToChar, varCharToSet); } - - - /** * Constructs a set from the given Unicode character category. * @param category an integer indicating the character category as @@ -344,19 +359,27 @@ public class UnicodeSet { } } - - - - + /** + * Modifies this set to represent the set specified by the given pattern. + * @param pattern a string specifying what characters are in the set + * @param pos on input, the position in pattern at which to start parsing. + * On output, the position after the last character parsed. + * @param varNameToChar a mapping from variable names (String) to characters + * (Character). May be null. If varCharToSet is non-null, then names may + * map to either single characters or sets, depending on whether a mapping + * exists in varCharToSet. If varCharToSet is null then all names map to + * single characters. + * @param varCharToSet a mapping from characters (Character objects from + * varNameToChar) to UnicodeSet objects. May be null. Is only used if + * varNameToChar is also non-null. + * @exception IllegalArgumentException if the pattern + * contains a syntax error. + */ private void applyPattern(String pattern, ParsePosition pos, Dictionary varNameToChar, Dictionary varCharToSet) { pairs = parse(pattern, pos, varNameToChar, varCharToSet); } - - - - /** * Returns a string representation of this set. If the result of * calling this function is passed to a UnicodeSet constructor, it diff --git a/icu4j/src/com/ibm/text/UnicodeSet.java b/icu4j/src/com/ibm/text/UnicodeSet.java index 975f2856fd..1fa000c5af 100755 --- a/icu4j/src/com/ibm/text/UnicodeSet.java +++ b/icu4j/src/com/ibm/text/UnicodeSet.java @@ -124,6 +124,10 @@ import java.util.Dictionary; * * * + * Any character may be preceded by a backslash in order to remove any special + * meaning. White space characters, as defined by Character.isWhitespace(), are + * ignored, unless they are escaped. + * * Patterns specify individual characters, ranges of characters, and * Unicode character categories. When elements are concatenated, they * specify their union. To complement a set, place a '^' immediately @@ -226,7 +230,8 @@ import java.util.Dictionary; * *Unsupported by Java (and hence unsupported by UnicodeSet). * * @author Alan Liu - * @version $RCSfile: UnicodeSet.java,v $ $Revision: 1.3 $ $Date: 2000/01/11 02:25:03 $ */ + * @version $RCSfile: UnicodeSet.java,v $ $Revision: 1.4 $ $Date: 2000/01/11 04:03:54 $ + */ public class UnicodeSet { /** * The internal representation is a StringBuffer of even length. @@ -300,18 +305,28 @@ public class UnicodeSet { applyPattern(pattern); } - - - - + /** + * Constructs a set from the given pattern. See the class description + * for the syntax of the pattern language. + * @param pattern a string specifying what characters are in the set + * @param pos on input, the position in pattern at which to start parsing. + * On output, the position after the last character parsed. + * @param varNameToChar a mapping from variable names (String) to characters + * (Character). May be null. If varCharToSet is non-null, then names may + * map to either single characters or sets, depending on whether a mapping + * exists in varCharToSet. If varCharToSet is null then all names map to + * single characters. + * @param varCharToSet a mapping from characters (Character objects from + * varNameToChar) to UnicodeSet objects. May be null. Is only used if + * varNameToChar is also non-null. + * @exception IllegalArgumentException if the pattern + * contains a syntax error. + */ public UnicodeSet(String pattern, ParsePosition pos, Dictionary varNameToChar, Dictionary varCharToSet) { applyPattern(pattern, pos, varNameToChar, varCharToSet); } - - - /** * Constructs a set from the given Unicode character category. * @param category an integer indicating the character category as @@ -344,19 +359,27 @@ public class UnicodeSet { } } - - - - + /** + * Modifies this set to represent the set specified by the given pattern. + * @param pattern a string specifying what characters are in the set + * @param pos on input, the position in pattern at which to start parsing. + * On output, the position after the last character parsed. + * @param varNameToChar a mapping from variable names (String) to characters + * (Character). May be null. If varCharToSet is non-null, then names may + * map to either single characters or sets, depending on whether a mapping + * exists in varCharToSet. If varCharToSet is null then all names map to + * single characters. + * @param varCharToSet a mapping from characters (Character objects from + * varNameToChar) to UnicodeSet objects. May be null. Is only used if + * varNameToChar is also non-null. + * @exception IllegalArgumentException if the pattern + * contains a syntax error. + */ private void applyPattern(String pattern, ParsePosition pos, Dictionary varNameToChar, Dictionary varCharToSet) { pairs = parse(pattern, pos, varNameToChar, varCharToSet); } - - - - /** * Returns a string representation of this set. If the result of * calling this function is passed to a UnicodeSet constructor, it