Skip to content

Commit

Permalink
Resolves unit test failure (previous commits). When a double bond is …
Browse files Browse the repository at this point in the history
…found and there are no 2D coordinates (e.g. unspecified configuration) then return then return '0' for the configuration value.

Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
  • Loading branch information
johnmay authored and egonw committed Aug 5, 2013
1 parent 1e0cfdb commit c29a6b4
Showing 1 changed file with 4 additions and 0 deletions.
Expand Up @@ -282,6 +282,7 @@ private int getHybridisationState(IAtom atom1) {

/**
* Gets the doubleBondConfiguration2D attribute of the AtomPlacer3D object
* using existing 2D coordinates.
*
*@param bond the double bond
*@param a coordinates (Point2d) of atom1 connected to bond
Expand All @@ -294,6 +295,9 @@ private int getDoubleBondConfiguration2D(IBond bond,Point2d a, Point2d b,Point2d
if (bond.getOrder() != IBond.Order.DOUBLE){
return 0;
}
// no 2D coordinates or existing configuration
if (a == null || b == null || c == null || d == null)
return 0;
Point2d cb=new Point2d(c.x-b.x,c.y-b.y);
Point2d xT=new Point2d(cb.x-1,cb.y);
a.y=a.y-b.y-xT.y;
Expand Down

0 comments on commit c29a6b4

Please sign in to comment.