[geos-devel] FW: [jts-devel] Node invariant
Martin Davis
mbdavis at VividSolutions.com
Fri Apr 7 12:07:32 EDT 2006
You're right, Node assumes that the EdgeEndStar argument is non-null.
(By the way, there definitely is a concept of null in Java, and it's
used in exactly the same way that a null pointer is used in C++)
Node was never written to be a general-purpose class, so not too much
attention was paid to hand-holding. It is assumed that the client uses
the class correctly. In Java this is self-detecting, since any use of a
null pointer will cause a nice exception to be thrown. I guess this
isn't the case in C++, so maybe you need to check for null. (However,
there maybe be valid uses of node which have a null edges reference, so
you'll have to check for it on use, not construction)
Martin Davis, Senior Technical Architect
Vivid Solutions Inc. www.vividsolutions.com
Suite #1A-2328 Government Street Victoria, B.C. V8T 5G5
Phone: (250) 385 6040 - Local 308 Fax: (250) 385 6046
> -----Original Message-----
> From: jts-devel-bounces at lists.jump-project.org
> [mailto:jts-devel-bounces at lists.jump-project.org] On Behalf
> Of strk at refractions.net
> Sent: April 7, 2006 8:49 AM
> To: jts-devel at lists.jump-project.org
> Cc: geos-devel at geos.refractions.net
> Subject: [jts-devel] Node invariant
>
>
> I'm debugging memory instabilities in GEOS
> and came to a question about Node.
>
> Node constructor in JTS takes an EdgeEndStar
> argument and assigns to this.edges.
>
> Later on, this.edges is used as a fully
> constructed object [ see Node#add(EdgeEnd) ]
>
> Does this mean that the given EdgeEndStar
> *must* be NOT NULL ? Or should Node#add(EdgeEnd)
> check for it ? Or isn't there anything such
> a NULL object in Java ?
>
> --strk;
>
> /"\ ASCII Ribbon Campaign
> \ / Respect for low technology.
> X Keep e-mail messages readable by any computer system.
> / \ Keep it ASCII.
>
> _______________________________________________
> jts-devel mailing list
> jts-devel at lists.jump-project.org
> http://lists.refractions.net/mailman/listinfo/jts-devel
>
_______________________________________________
jts-devel mailing list
jts-devel at lists.jump-project.org
http://lists.refractions.net/mailman/listinfo/jts-devel
More information about the geos-devel
mailing list