Class BondManipulator
- java.lang.Object
-
- org.openscience.cdk.tools.manipulator.BondManipulator
-
public class BondManipulator extends Object
Class with convenience methods that provide methods to manipulate AtomContainer's. For example:AtomContainerManipulator.replaceAtomByAtom(container, atom1, atom2);
will replace the Atom in the AtomContainer, but in all the ElectronContainer's it participates too.- Author:
- Egon Willighagen
- Source code:
- main
- Belongs to CDK module:
- core
- Created on:
- 2003-08-07
-
-
Constructor Summary
Constructors Constructor Description BondManipulator()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static IBond.Order
createBondOrder(double bondOrder)
Convenience method to convert a double into an IBond.Order.static void
decreaseBondOrder(IBond bond)
Decrease the order of a bond.static IBond.Order
decreaseBondOrder(IBond.Order oldOrder)
Returns the IBond.Order one lower.static double
destroyBondOrder(IBond.Order bondOrder)
Deprecated.useIBond.Order.numeric().doubleValue()
insteadstatic IAtom[]
getAtomArray(IBond container)
Constructs an array of Atom objects from Bond.static IBond.Order
getMaximumBondOrder(Iterator<IBond> bonds)
Returns the maximum bond order for a List of bonds, given an iterator to the list.static IBond.Order
getMaximumBondOrder(List<IBond> bonds)
Returns the maximum bond order for a List of bonds.static IBond.Order
getMaximumBondOrder(IBond.Order firstOrder, IBond.Order secondOrder)
Returns the maximum bond order for the two bond orders.static IBond.Order
getMaximumBondOrder(IBond firstBond, IBond secondBond)
Returns the maximum bond order for the two bonds.static IBond.Order
getMinimumBondOrder(Iterator<IBond> bonds)
Returns the minimum bond order for a List of bonds, given an iterator to the list.static IBond.Order
getMinimumBondOrder(List<IBond> bonds)
Returns the minimum bond order for a List of bonds.static int
getSingleBondEquivalentSum(Iterator<IBond> bonds)
Get the single bond equivalent (SBE) of a list of bonds, given an iterator to the list.static int
getSingleBondEquivalentSum(List<IBond> bonds)
Get the single bond equivalent (SBE) of a list of bonds.static void
increaseBondOrder(IBond bond)
Increment the bond order of this bond.static IBond.Order
increaseBondOrder(IBond.Order oldOrder)
Returns the IBond.Order one higher.static boolean
isHigherOrder(IBond.Order first, IBond.Order second)
Returns true if the first bond has a higher bond order than the second bond.static boolean
isLowerOrder(IBond.Order first, IBond.Order second)
Returns true if the first bond has a lower bond order than the second bond.
-
-
-
Method Detail
-
getAtomArray
public static IAtom[] getAtomArray(IBond container)
Constructs an array of Atom objects from Bond.- Parameters:
container
- The Bond object.- Returns:
- The array of Atom objects.
-
isLowerOrder
public static boolean isLowerOrder(IBond.Order first, IBond.Order second)
Returns true if the first bond has a lower bond order than the second bond. It returns false if the bond order is equal, and if the order of the first bond is larger than that of the second. Also returns false if either bond order is unset.- Parameters:
first
- The first bond order objectsecond
- The second bond order object- Returns:
- true if the first bond order is lower than the second one, false otherwise
- See Also:
isHigherOrder(org.openscience.cdk.interfaces.IBond.Order, org.openscience.cdk.interfaces.IBond.Order)
-
isHigherOrder
public static boolean isHigherOrder(IBond.Order first, IBond.Order second)
Returns true if the first bond has a higher bond order than the second bond. It returns false if the bond order is equal, and if the order of the first bond is lower than that of the second. Also returns false if either bond order is unset.- Parameters:
first
- The first bond order objectsecond
- The second bond order object- Returns:
- true if the first bond order is higher than the second one, false otherwise
- See Also:
isLowerOrder(org.openscience.cdk.interfaces.IBond.Order, org.openscience.cdk.interfaces.IBond.Order)
-
increaseBondOrder
public static IBond.Order increaseBondOrder(IBond.Order oldOrder)
Returns the IBond.Order one higher. Does not increase the bond order beyond the QUADRUPLE bond order.- Parameters:
oldOrder
- the old order- Returns:
- The incremented bond order
- See Also:
increaseBondOrder(org.openscience.cdk.interfaces.IBond)
,decreaseBondOrder(org.openscience.cdk.interfaces.IBond.Order)
,decreaseBondOrder(org.openscience.cdk.interfaces.IBond)
-
increaseBondOrder
public static void increaseBondOrder(IBond bond)
Increment the bond order of this bond.- Parameters:
bond
- The bond whose order is to be incremented- See Also:
increaseBondOrder(org.openscience.cdk.interfaces.IBond.Order)
,decreaseBondOrder(org.openscience.cdk.interfaces.IBond.Order)
,decreaseBondOrder(org.openscience.cdk.interfaces.IBond)
-
decreaseBondOrder
public static IBond.Order decreaseBondOrder(IBond.Order oldOrder)
Returns the IBond.Order one lower. Does not decrease the bond order lower the QUADRUPLE bond order.- Parameters:
oldOrder
- the old order- Returns:
- the decremented order
- See Also:
decreaseBondOrder(org.openscience.cdk.interfaces.IBond)
,increaseBondOrder(org.openscience.cdk.interfaces.IBond.Order)
,increaseBondOrder(org.openscience.cdk.interfaces.IBond.Order)
-
decreaseBondOrder
public static void decreaseBondOrder(IBond bond)
Decrease the order of a bond.- Parameters:
bond
- The bond in question- See Also:
decreaseBondOrder(org.openscience.cdk.interfaces.IBond.Order)
,increaseBondOrder(org.openscience.cdk.interfaces.IBond.Order)
,increaseBondOrder(org.openscience.cdk.interfaces.IBond.Order)
-
createBondOrder
public static IBond.Order createBondOrder(double bondOrder)
Convenience method to convert a double into an IBond.Order. Returns NULL if the bond order is not 1.0, 2.0, 3.0 and 4.0.- Parameters:
bondOrder
- The numerical bond order- Returns:
- An instance of
IBond.Order
- See Also:
destroyBondOrder(org.openscience.cdk.interfaces.IBond.Order)
-
destroyBondOrder
public static double destroyBondOrder(IBond.Order bondOrder)
Deprecated.useIBond.Order.numeric().doubleValue()
insteadConvert aIBond.Order
to a numeric value. Single, double, triple and quadruple bonds are converted to 1.0, 2.0, 3.0 and 4.0 respectively.- Parameters:
bondOrder
- The bond order object- Returns:
- The numeric value
- See Also:
createBondOrder(double)
-
getMaximumBondOrder
public static IBond.Order getMaximumBondOrder(List<IBond> bonds)
Returns the maximum bond order for a List of bonds.- Parameters:
bonds
- The list of bonds to search through- Returns:
- The maximum bond order found
- See Also:
getMaximumBondOrder(java.util.Iterator)
-
getMaximumBondOrder
public static IBond.Order getMaximumBondOrder(Iterator<IBond> bonds)
Returns the maximum bond order for a List of bonds, given an iterator to the list.- Parameters:
bonds
- An iterator for the list of bonds- Returns:
- The maximum bond order found
- See Also:
getMaximumBondOrder(java.util.List)
-
getMaximumBondOrder
public static IBond.Order getMaximumBondOrder(IBond firstBond, IBond secondBond)
Returns the maximum bond order for the two bonds.- Parameters:
firstBond
- first bond to comparesecondBond
- second bond to compare- Returns:
- The maximum bond order found
-
getMaximumBondOrder
public static IBond.Order getMaximumBondOrder(IBond.Order firstOrder, IBond.Order secondOrder)
Returns the maximum bond order for the two bond orders.- Parameters:
firstOrder
- first bond order to comparesecondOrder
- second bond order to compare- Returns:
- The maximum bond order found
-
getMinimumBondOrder
public static IBond.Order getMinimumBondOrder(List<IBond> bonds)
Returns the minimum bond order for a List of bonds.- Parameters:
bonds
- The list of bonds to search through- Returns:
- The maximum bond order found
- See Also:
getMinimumBondOrder(java.util.Iterator)
-
getMinimumBondOrder
public static IBond.Order getMinimumBondOrder(Iterator<IBond> bonds)
Returns the minimum bond order for a List of bonds, given an iterator to the list.- Parameters:
bonds
- An iterator for the list of bonds- Returns:
- The minimum bond order found
- See Also:
getMinimumBondOrder(java.util.List)
-
getSingleBondEquivalentSum
public static int getSingleBondEquivalentSum(List<IBond> bonds)
Get the single bond equivalent (SBE) of a list of bonds. This sums the bond orders of all the bonds.- Parameters:
bonds
- The list of bonds- Returns:
- The SBE sum
- See Also:
getSingleBondEquivalentSum(java.util.Iterator)
-
-