I was searching for a way to uniquely identify a each position in an array,
and in the following post, it looks like the snippet should do exactly what
I want. But, I'm getting mixed results with Results() and HashCode().  Are
their any limits to these functions? I.e.: can you not call them on
dynamically generated arrays or structs? Is there a length limit, etc?


I'm trying:


if(CurrentPosition GT 1){


WriteOutput(CurrentNode["Trace"][CurrentPosition]Equals(CurrentNode["Trace"]
[CurrentPosition - 1]) & "<br />");
}


CurrentNode is set to a specific structure in a much larger structure before
this, and CurrentNode["Trace"] is an array, where CurrentPosition is the
CurrentPosition, which has already been set.


I'm getting a "Complex object types cannot be converted to simple values."
error.  And this same syntax works with simple values:


<cfscript>
a=ArrayNew(1);
a[1]="one";
a[2]="two";
</cfscript>


#a[1]Equals(a[2])#


One more thing, when I run:


CurrentNode["Trace"][CurrentPosition].HashCode() ...it outputs 0?


Any ideas?


TIA for any help you can provide->


Tyler


  _____  

Matt wrote:


<cfscript>
foo = StructNew();
foo.a = "b";
foo.b = "a";
WriteOutput(foo.hashCode());
</cfscript>


Also, I have included more information on how the hashCode is generated
below.


public int hashCode()
Returns the hash code value for this map. The hash code of a map is
defined to be the sum of the hash codes of each entry in the map's
entrySet() view. This ensures that t1.equals(t2) implies that
t1.hashCode()==t2.hashCode() for any two maps t1 and t2, as required by
the general contract of Object.hashCode.


This implementation iterates over entrySet(), calling hashCode on each
element (entry) in the Collection, and adding up the results.


Specified by: hashCode in interface Map
Overrides: hashCode in class Object
Returns: the hash code value for this map.
See Also: Map.Entry.hashCode(), Object.hashCode(),
Object.equals(Object), Set.equals(Object)


Matt Liotta
President & CEO
Montara Software, Inc.
<http://www.montarasoftware.com/> http://www.montarasoftware.com/
V: 415-577-8070
F: 415-341-8906
P:  <mailto:[EMAIL PROTECTED]>
[EMAIL PROTECTED]
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to