Skip to content

Commit

Permalink
Removed redundant code - we don't need to check whether the bond is a…
Browse files Browse the repository at this point in the history
…lready in the container as we create a new instance. We also don't need to check the array size as this is done by addBond(IBond)

Change-Id: I9b7ddfa356874aee18995e766513cdfca9e6acd2
Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
  • Loading branch information
johnmay authored and egonw committed Nov 1, 2012
1 parent 0e41b05 commit c7786c9
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 34 deletions.
15 changes: 0 additions & 15 deletions src/main/org/openscience/cdk/AtomContainer.java
Expand Up @@ -1385,16 +1385,6 @@ public void addBond(int atom1, int atom2, IBond.Order order,
IBond.Stereo stereo)
{
IBond bond = getBuilder().newInstance(IBond.class,getAtom(atom1), getAtom(atom2), order, stereo);

if (contains(bond))
{
return;
}

if (bondCount >= bonds.length)
{
growBondArray();
}
addBond(bond);
/* no notifyChanged() here because addBond(bond) does
it already */
Expand All @@ -1411,11 +1401,6 @@ public void addBond(int atom1, int atom2, IBond.Order order,
public void addBond(int atom1, int atom2, IBond.Order order)
{
IBond bond = getBuilder().newInstance(IBond.class,getAtom(atom1), getAtom(atom2), order);

if (bondCount >= bonds.length)
{
growBondArray();
}
addBond(bond);
/* no notifyChanged() here because addBond(bond) does
it already */
Expand Down
19 changes: 0 additions & 19 deletions src/main/org/openscience/cdk/silent/AtomContainer.java
Expand Up @@ -1334,19 +1334,7 @@ public void addBond(int atom1, int atom2, IBond.Order order,
IBond.Stereo stereo)
{
IBond bond = getBuilder().newInstance(IBond.class,getAtom(atom1), getAtom(atom2), order, stereo);

if (contains(bond))
{
return;
}

if (bondCount >= bonds.length)
{
growBondArray();
}
addBond(bond);
/* no notifyChanged() here because addBond(bond) does
it already */
}


Expand All @@ -1360,14 +1348,7 @@ public void addBond(int atom1, int atom2, IBond.Order order,
public void addBond(int atom1, int atom2, IBond.Order order)
{
IBond bond = getBuilder().newInstance(IBond.class,getAtom(atom1), getAtom(atom2), order);

if (bondCount >= bonds.length)
{
growBondArray();
}
addBond(bond);
/* no notifyChanged() here because addBond(bond) does
it already */
}


Expand Down

0 comments on commit c7786c9

Please sign in to comment.