Please excuse the slightly wrong code-level errors in the sample below. The 
<a></a> needs to be the root level for it to make sense... I am sure you get 
the message any way.

Cheers
Niclas

On Thursday 29 July 2004 14:58, Niclas Hedhman wrote:
> Gang,
>
> Since I am digging in Framework, I also stumbled upon another problem.
> Either it is a semantic bug in the intentions, or a bug in the
> ConfigurationUtils.equals() method.
>
> The problem is highlighted in an added testcase, which now fails in
> Framework implementation.
>
> It goes something like this;
>
> The two configurations
> Configuration a =
> <a>
>   <b>1</b>
>   <b>2</b>
> </a>
>
> and
>
> Configuration b =
> <a>
>   <b>2</b>
>   <b>1</b>
> </a>
>
> then
> a.equals( b ) --> TRUE
>
> It is not specified in the Javadocs of Configuration, but it is said in
> Javadocs of DefaultConfiguration that getChild( String element ), will
> return the FIRST child.
>
> SO;
> String v1 = a.getChild( "b" ).getValue();
> String v2 = b.getChild( "b" ).getValue();
> return v1.equals( v2 );
>
> evaluates to FALSE !!!!
> In which case the two Configurations can NOT be considered equal.
>
> I can imagine this is quite a headache, and the only way out as I see it,
> is that Configurations must be same in order of its children as well, to be
> considered equal.
>
> Furthermore, the current equals() implementation is very slow for large
> configurations, as it does at worst O(n!) iterations through the tree.
>
> What are we going to do about this?
>
>
> Cheers
> Niclas

-- 
   +------//-------------------+
  / http://www.bali.ac        /
 / http://niclas.hedhman.org / 
+------//-------------------+


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to