You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Chris Feldhacker <fe...@mchsi.com> on 2003/08/02 08:55:08 UTC
[lang] CharSet oversight?
The CharSet.add(String) method makes special consideration for the "-" character, adding it to the set if it is the only character in the string. However, the same special consideration is not made for the "^" character. Is this intentional?
I would think special consideration should either be made for both characters or not at all...
Re: [lang] ArrayUtils.contains()
Posted by Stephen Colebourne <sc...@btopenworld.com>.
Hadn't thought of that one, but I guess it makes sense. If you want to
supply a patch....;-)
Stephen
----- Original Message -----
From: "Tim O'Brien" <to...@discursive.com>
To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
Sent: Sunday, August 03, 2003 4:17 AM
Subject: [lang] ArrayUtils.contains()
> Has anyone thought of adding a tolerance to ArrayUtils when trying to
calls
> contains, indexOf, of lastIndexOf for a floating point number?
>
> boolean ArrayUtils.contains(double[] array, double valueToFind, double
tolerance)
>
> The method would return true if array contained a double value in
valueToFind +/- tolerance.
>
> Any thoughts?
>
> Tim
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
Re: [lang] ArrayUtils.contains()
Posted by Stephen Colebourne <sc...@btopenworld.com>.
Hadn't thought of that one, but I guess it makes sense. If you want to
supply a patch....;-)
Stephen
----- Original Message -----
From: "Tim O'Brien" <to...@discursive.com>
To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
Sent: Sunday, August 03, 2003 4:17 AM
Subject: [lang] ArrayUtils.contains()
> Has anyone thought of adding a tolerance to ArrayUtils when trying to
calls
> contains, indexOf, of lastIndexOf for a floating point number?
>
> boolean ArrayUtils.contains(double[] array, double valueToFind, double
tolerance)
>
> The method would return true if array contained a double value in
valueToFind +/- tolerance.
>
> Any thoughts?
>
> Tim
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
[lang] ArrayUtils.contains()
Posted by Tim O'Brien <to...@discursive.com>.
Has anyone thought of adding a tolerance to ArrayUtils when trying to calls
contains, indexOf, of lastIndexOf for a floating point number?
boolean ArrayUtils.contains(double[] array, double valueToFind, double tolerance)
The method would return true if array contained a double value in valueToFind +/- tolerance.
Any thoughts?
Tim
[lang] ArrayUtils.contains()
Posted by Tim O'Brien <to...@discursive.com>.
Has anyone thought of adding a tolerance to ArrayUtils when trying to calls
contains, indexOf, of lastIndexOf for a floating point number?
boolean ArrayUtils.contains(double[] array, double valueToFind, double tolerance)
The method would return true if array contained a double value in valueToFind +/- tolerance.
Any thoughts?
Tim
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [lang] CharSet oversight?
Posted by Stephen Colebourne <sc...@btopenworld.com>.
I disagree that GC is an issue with a cached toString. The String reference
will only be held by our class so would not block a GC run.
You are probably right that the cost isn't justified here. I'll have to
check the rest of lang to see what it does. I think that some other classes
also cache the toString.
Stephen
----- Original Message -----
From: "Chris Feldhacker" <fe...@mchsi.com>
> Please consider the following patch. Suggested changes included:
>
> 1) Made "serialVersionUID" private instead of default scope (same should
be
> done in CharSet)
> 2) I question the need to cache the toString representation: is this
really
> necessary? If so, then why not do it elsewhere? I think that by caching
> the toString value we could be preventing garbage collection of a cached
> value that is no longer needed simply because our class continues to hang
on
> to it. Besides, the toString method is extremely quick; perhaps if it was
> more complex and intensive... (even then, I would think the cached value
> should be stored in a SoftReference to make sure garbage collection can
> occur).
>
> Thoughts?
>
>
> ----- Original Message -----
> From: "Stephen Colebourne"
> To: "Jakarta Commons Developers List"
> Sent: Saturday, August 02, 2003 1:30 PM
> Subject: Re: [lang] CharSet oversight?
>
>
> > CharSet and CharRange now fully rewritten, javadocced and tested. Be
great
> > if you had a quick look....
> >
> > Stephen
>
----------------------------------------------------------------------------
----
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [lang] CharSet oversight?
Posted by Stephen Colebourne <sc...@btopenworld.com>.
I disagree that GC is an issue with a cached toString. The String reference
will only be held by our class so would not block a GC run.
You are probably right that the cost isn't justified here. I'll have to
check the rest of lang to see what it does. I think that some other classes
also cache the toString.
Stephen
----- Original Message -----
From: "Chris Feldhacker" <fe...@mchsi.com>
> Please consider the following patch. Suggested changes included:
>
> 1) Made "serialVersionUID" private instead of default scope (same should
be
> done in CharSet)
> 2) I question the need to cache the toString representation: is this
really
> necessary? If so, then why not do it elsewhere? I think that by caching
> the toString value we could be preventing garbage collection of a cached
> value that is no longer needed simply because our class continues to hang
on
> to it. Besides, the toString method is extremely quick; perhaps if it was
> more complex and intensive... (even then, I would think the cached value
> should be stored in a SoftReference to make sure garbage collection can
> occur).
>
> Thoughts?
>
>
> ----- Original Message -----
> From: "Stephen Colebourne"
> To: "Jakarta Commons Developers List"
> Sent: Saturday, August 02, 2003 1:30 PM
> Subject: Re: [lang] CharSet oversight?
>
>
> > CharSet and CharRange now fully rewritten, javadocced and tested. Be
great
> > if you had a quick look....
> >
> > Stephen
>
----------------------------------------------------------------------------
----
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [lang] CharSet oversight?
Posted by Chris Feldhacker <fe...@mchsi.com>.
Please consider the following patch. Suggested changes included:
1) Made "serialVersionUID" private instead of default scope (same should be
done in CharSet)
2) I question the need to cache the toString representation: is this really
necessary? If so, then why not do it elsewhere? I think that by caching
the toString value we could be preventing garbage collection of a cached
value that is no longer needed simply because our class continues to hang on
to it. Besides, the toString method is extremely quick; perhaps if it was
more complex and intensive... (even then, I would think the cached value
should be stored in a SoftReference to make sure garbage collection can
occur).
Thoughts?
----- Original Message -----
From: "Stephen Colebourne"
To: "Jakarta Commons Developers List"
Sent: Saturday, August 02, 2003 1:30 PM
Subject: Re: [lang] CharSet oversight?
> CharSet and CharRange now fully rewritten, javadocced and tested. Be great
> if you had a quick look....
>
> Stephen
Re: [lang] CharSet oversight?
Posted by Stephen Colebourne <sc...@btopenworld.com>.
CharSet and CharRange now fully rewritten, javadocced and tested. Be great
if you had a quick look....
Stephen
----- Original Message -----
From: "Chris Feldhacker" <fe...@mchsi.com>
To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
Sent: Saturday, August 02, 2003 7:55 AM
Subject: [lang] CharSet oversight?
The CharSet.add(String) method makes special consideration for the "-"
character, adding it to the set if it is the only character in the string.
However, the same special consideration is not made for the "^" character.
Is this intentional?
I would think special consideration should either be made for both
characters or not at all...
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [lang] CharSet oversight?
Posted by Stephen Colebourne <sc...@btopenworld.com>.
CharSet and CharRange now fully rewritten, javadocced and tested. Be great
if you had a quick look....
Stephen
----- Original Message -----
From: "Chris Feldhacker" <fe...@mchsi.com>
To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
Sent: Saturday, August 02, 2003 7:55 AM
Subject: [lang] CharSet oversight?
The CharSet.add(String) method makes special consideration for the "-"
character, adding it to the set if it is the only character in the string.
However, the same special consideration is not made for the "^" character.
Is this intentional?
I would think special consideration should either be made for both
characters or not at all...