Browse files

code cleanup and documentation fixes.

  • Loading branch information...
1 parent 5be7173 commit e348ac196edabd1563bf755cc134577af041a48e @tabish121 tabish121 committed Oct 29, 2013
View
6 activemq-cpp/src/main/decaf/lang/CharSequence.h
@@ -54,7 +54,7 @@ namespace lang {
*
* @throws IndexOutOfBoundsException if index is > than length() or negative
*/
- virtual char charAt( int index ) const = 0;
+ virtual char charAt(int index) const = 0;
/**
* Returns a new CharSequence that is a subsequence of this sequence. The
@@ -71,10 +71,10 @@ namespace lang {
*
* @throws IndexOutOfBoundsException if start or end > length() or start or end are negative.
*/
- virtual CharSequence* subSequence( int start, int end ) const = 0;
+ virtual CharSequence* subSequence(int start, int end) const = 0;
/**
- * @returns the string representation of this CharSequence
+ * @returns the String representation of this CharSequence
*/
virtual std::string toString() const = 0;
View
11 activemq-cpp/src/main/decaf/lang/Character.cpp
@@ -22,7 +22,14 @@ using namespace decaf;
using namespace decaf::lang;
////////////////////////////////////////////////////////////////////////////////
-Character::Character( char value ) : value(value) {
+const int Character::MIN_RADIX = 2;
+const int Character::MAX_RADIX = 36;
+const char Character::MIN_VALUE = (char)0x7F;
+const char Character::MAX_VALUE = (char)0x80;
+const int Character::SIZE = 8;
+
+////////////////////////////////////////////////////////////////////////////////
+Character::Character(char value) : value(value) {
}
////////////////////////////////////////////////////////////////////////////////
@@ -31,7 +38,7 @@ std::string Character::toString() const {
}
////////////////////////////////////////////////////////////////////////////////
-int Character::digit( char c, int radix ) {
+int Character::digit(char c, int radix) {
if( radix >= MIN_RADIX && radix <= MAX_RADIX ) {
int result = -1;
if( '0' <= c && c <= '9' ) {
View
178 activemq-cpp/src/main/decaf/lang/Character.h
@@ -37,100 +37,118 @@ namespace lang{
public:
/** The minimum radix available for conversion to and from strings. */
- static const int MIN_RADIX = 2;
+ static const int MIN_RADIX;
/** The maximum radix available for conversion to and from strings. */
- static const int MAX_RADIX = 36;
+ static const int MAX_RADIX;
/** The minimum value that a signed char can take on. */
- static const char MIN_VALUE = (char)0x7F;
+ static const char MIN_VALUE;
/** The maximum value that a signed char can take on. */
- static const char MAX_VALUE = (char)0x80;
+ static const char MAX_VALUE;
- /** The size of the primitive charactor in bits. */
- static const int SIZE = 8;
+ /** The size of the primitive character in bits. */
+ static const int SIZE;
public:
/**
* @param value - char to wrap.
*/
- Character( char value );
+ Character(char value);
/**
* Compares this Character instance with another.
- * @param c - the Character instance to be compared
+ *
+ * @param c
+ * the Character instance to be compared
+ *
* @return zero if this object represents the same char value as the
- * argument; a positive value if this object represents a value greater
- * than the passed in value, and -1 if this object repesents a value
- * less than the passed in value.
+ * argument; a positive value if this object represents a value greater
+ * than the passed in value, and -1 if this object represents a value
+ * less than the passed in value.
*/
- virtual int compareTo( const Character& c ) const {
+ virtual int compareTo(const Character& c) const {
return this->value < c.value ? -1 : (this->value > c.value) ? 1 : 0;
}
/**
* Compares equality between this object and the one passed.
- * @param c - the value to be compared to this one.
+ *
+ * @param c
+ * the value to be compared to this one.
+ *
* @return true if this object is equal to the one passed.
*/
- virtual bool operator==( const Character& c ) const {
+ virtual bool operator==(const Character& c) const {
return this->value == c.value;
}
/**
* Compares this object to another and returns true if this object
- * is considered to be less than the one passed. This
- * @param c - the value to be compared to this one.
+ * is considered to be less than the one passed.
+ *
+ * @param c
+ * the value to be compared to this one.
+ *
* @return true if this object is equal to the one passed.
*/
- virtual bool operator<( const Character& c ) const {
+ virtual bool operator<(const Character& c) const {
return this->value < c.value;
}
/**
* Compares this Character instance with a char type.
- * @param c - the char instance to be compared
+ *
+ * @param c
+ * the char instance to be compared
+ *
* @return zero if this object represents the same char value as the
- * argument; a positive value if this object represents a value greater
- * than the passed in value, and -1 if this object repesents a value
- * less than the passed in value.
+ * argument; a positive value if this object represents a value greater
+ * than the passed in value, and -1 if this object represents a value
+ * less than the passed in value.
*/
- virtual int compareTo( const char& c ) const {
+ virtual int compareTo(const char& c) const {
return this->value < c ? -1 : (this->value > c) ? 1 : 0;
}
/**
* Compares equality between this object and the one passed.
- * @param c - the value to be compared to this one.
+ *
+ * @param c
+ * the value to be compared to this one.
+ *
* @return true if this object is equal to the one passed.
*/
- virtual bool operator==( const char& c ) const {
+ virtual bool operator==(const char& c) const {
return this->value == c;
}
/**
* Compares this object to another and returns true if this object
* is considered to be less than the one passed. This
- * @param c - the value to be compared to this one.
+ *
+ * @param c
+ * the value to be compared to this one.
+ *
* @return true if this object is equal to the one passed.
*/
- virtual bool operator<( const char& c ) const {
+ virtual bool operator<(const char& c) const {
return this->value < c;
}
/**
* @returns true if the two Character Objects have the same value.
*/
- bool equals( const Character& c ) const {
+ bool equals(const Character& c) const {
return this->value == c.value;
}
/**
* @returns true if the two Characters have the same value.
*/
- bool equals( const char& c ) const {
+ bool equals(const char& c) const {
return this->value == c;
}
@@ -141,70 +159,83 @@ namespace lang{
/**
* Answers the double value which the receiver represents
+ *
* @return double the value of the receiver.
*/
virtual double doubleValue() const {
- return (double)this->value;
+ return (double) this->value;
}
/**
* Answers the float value which the receiver represents
+ *
* @return float the value of the receiver.
*/
virtual float floatValue() const {
- return (float)this->value;
+ return (float) this->value;
}
/**
* Answers the byte value which the receiver represents
+ *
* @return int the value of the receiver.
*/
virtual unsigned char byteValue() const {
- return (unsigned char)this->value;
+ return (unsigned char) this->value;
}
/**
* Answers the short value which the receiver represents
+ *
* @return int the value of the receiver.
*/
virtual short shortValue() const {
- return (short)this->value;
+ return (short) this->value;
}
/**
* Answers the int value which the receiver represents
+ *
* @return int the value of the receiver.
*/
virtual int intValue() const {
- return (int)this->value;
+ return (int) this->value;
}
/**
* Answers the long value which the receiver represents
+ *
* @return long the value of the receiver.
*/
virtual long long longValue() const {
- return (long long)this->value;
+ return (long long) this->value;
}
- public: // statics
+ public:
/**
* Returns a Character instance representing the specified char value.
- * @param value - the primitive char to wrap.
- * @returns a new Charactor instance that wraps this value.
+ *
+ * @param value
+ * the primitive char to wrap.
+ *
+ * @returns a new Character instance that wraps this value.
*/
- static Character valueOf( char value ) {
- return Character( value );
+ static Character valueOf(char value) {
+ return Character(value);
}
/**
* Indicates whether or not the given character is considered
* whitespace.
+ *
+ * @param c
+ * The character whose value is being checked.
+ *
+ * @returns true if the character is a whitespace value.
*/
- static bool isWhitespace( char c ){
- switch ( c )
- {
+ static bool isWhitespace(char c) {
+ switch (c) {
case '\n':
case '\t':
case '\r':
@@ -217,54 +248,77 @@ namespace lang{
}
/**
- * Indicates whether or not the given character is
- * a digit.
+ * Indicates whether or not the given character is a digit.
+ *
+ * @param c
+ * The character whose value is being checked.
+ *
+ * @returns true if the character is a digit value.
*/
- static bool isDigit( char c ){
+ static bool isDigit(char c) {
return c >= '0' && c <= '9';
}
/**
- * Indicates whether or not the given character is
- * a lower case character.
+ * Indicates whether or not the given character is a lower case character.
+ *
+ * @param c
+ * The character whose value is being checked.
+ *
+ * @returns true if the character is a lower case ASCII value.
*/
- static bool isLowerCase( char c ){
+ static bool isLowerCase(char c) {
return c >= 'a' && c <= 'z';
}
/**
* Indicates whether or not the given character is
* a upper case character.
+ *
+ * @param c
+ * The character whose value is being checked.
+ *
+ * @returns true if the character is a upper case ASCII value.
*/
- static bool isUpperCase( char c ){
+ static bool isUpperCase(char c) {
return c >= 'A' && c <= 'Z';
}
/**
- * Indicates whether or not the given character is
- * a letter.
+ * Indicates whether or not the given character is a letter.
+ *
+ * @param c
+ * The character whose value is being checked.
+ *
+ * @returns true if the character is an ASCII letter value.
*/
- static bool isLetter( char c ){
+ static bool isLetter(char c) {
return isUpperCase(c) || isLowerCase(c);
}
/**
* Indicates whether or not the given character is
* either a letter or a digit.
+ *
+ * @param c
+ * The character whose value is being checked.
+ *
+ * @returns true if the character is an ASCII letter or numeric value.
*/
- static bool isLetterOrDigit( char c ){
+ static bool isLetterOrDigit(char c) {
return isLetter(c) || isDigit(c);
}
/**
* Answers whether the character is an ISO control character, which
* is a char that lays in the range of 0 to 1f and 7f to 9f
- * @param c - the character, including supplementary characters
+ * @param c
+ * the character, including supplementary characters
+ *
* @return true if the char is an ISO control character
*/
- static bool isISOControl( char c ) {
- return ( c >= 0 && c <= 0x1f ) ||
- ( (unsigned char)c >= 0x7f && (unsigned char)c <= 0x9f );
+ static bool isISOControl(char c) {
+ return (c >= 0 && c <= 0x1f) || ((unsigned char) c >= 0x7f && (unsigned char) c <= 0x9f);
}
/**
@@ -285,8 +339,11 @@ namespace lang{
* and its code is less than radix + 'a' - 10. In this case,
* ch - 'a' + 10 is returned.
*
- * @param c - the char to be converted
- * @param radix - the radix of the number
+ * @param c
+ * the char to be converted
+ * @param radix
+ * the radix of the number
+ *
* @returns the numeric value of the number represented in the given radix
*/
static int digit(char c, int radix);
@@ -298,6 +355,7 @@ namespace lang{
*
* @param value
* the character to convert if needed.
+ *
* @return if value is an upper case character then its lower case
* counterpart, otherwise just returns value unchanged.
*/
@@ -316,6 +374,7 @@ namespace lang{
*
* @param value
* the character to convert to upper case if needed.
+ *
* @return if value is a lower case character then its upper case
* counterpart, otherwise just returns value unchanged.
*/
@@ -326,7 +385,6 @@ namespace lang{
return value;
}
-
};
}}

0 comments on commit e348ac1

Please sign in to comment.