It seems like the length squared should not be part of the string representation. Does anyone know how to control this Gson output formatter to ignore this field?
The lengthSquared field has bitten us a couple times... I still wonder if it's possible and better to remove this and have callers be smarter about caching the value? or did we conclude that was just unrealistic. On Fri, Mar 12, 2010 at 9:42 AM, Pallavi Palleti <pallavi.pall...@corp.aol.com> wrote: > Hi, > > I found getLengthSqured() method name in AbstractVector slightly misguiding. > As, it is not only getting the lengthSquared value but also setting it if it > is not set previously. Actually, I found this issue when I am comparing two > vectors, though both of them are same, in one place the lengthSquared value > wasn't set (so, by default it has -1) and for other vector, it is set > because the distance(double lengthSquared, Vector, Vector) method was > called. So, when I am comparing the string format of both of them( as well > vectors), they failed though they are same vectors but the lengthSquared > value was different. I am not sure whether we can ignore this value while > outputting in asFormatString(). Just wanted to bring to the notice so that > it will be useful to others while experimenting (especially, in unit tests). > > Thanks > Pallavi >