[Plexus-svn] SF.net SVN: plexus:[904] trunk/plexus-graph/src
Status: Alpha
Brought to you by:
rconner
From: <rc...@us...> - 2010-11-19 23:42:38
|
Revision: 904 http://plexus.svn.sourceforge.net/plexus/?rev=904&view=rev Author: rconner Date: 2010-11-19 23:42:32 +0000 (Fri, 19 Nov 2010) Log Message: ----------- Making the behavior of a Product graph consistent with the documented Graph API. Graphs which don't allow null nodes should throw IllegalArgumentException when given them, everywhere except containsNode(). Modified Paths: -------------- trunk/plexus-graph/src/changes/changes.xml trunk/plexus-graph/src/main/java/com/phoenixst/plexus/operations/Product.java Modified: trunk/plexus-graph/src/changes/changes.xml =================================================================== --- trunk/plexus-graph/src/changes/changes.xml 2010-11-19 23:41:00 UTC (rev 903) +++ trunk/plexus-graph/src/changes/changes.xml 2010-11-19 23:42:32 UTC (rev 904) @@ -14,6 +14,13 @@ Fixed DefaultGraph deserialization. </action> + <action dev="rconner" type="fix"> + Product now throws an IllegalArgumentException when given a null + node argument instead of a NullPointerException, as mandated by + the Graph interface API. PlanarMesh, Prism, and ToroidalMesh are + subclasses of Product. + </action> + <action dev="rconner" type="update"> Reorganized into a standard maven project. </action> Modified: trunk/plexus-graph/src/main/java/com/phoenixst/plexus/operations/Product.java =================================================================== --- trunk/plexus-graph/src/main/java/com/phoenixst/plexus/operations/Product.java 2010-11-19 23:41:00 UTC (rev 903) +++ trunk/plexus-graph/src/main/java/com/phoenixst/plexus/operations/Product.java 2010-11-19 23:42:32 UTC (rev 904) @@ -181,6 +181,9 @@ @Override protected Traverser traverser( Object node ) { + if( node == null ) { + throw new IllegalArgumentException( "This graph does not permit null nodes." ); + } OrderedPair baseNode = (OrderedPair) node; Object leftNode = baseNode.getFirst(); Object rightNode = baseNode.getSecond(); @@ -254,6 +257,9 @@ @Override public int degree( Object node ) { + if( node == null ) { + throw new IllegalArgumentException( "This graph does not permit null nodes." ); + } OrderedPair baseNode = (OrderedPair) node; Object leftNode = baseNode.getFirst(); Object rightNode = baseNode.getSecond(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |