Package moss
Class BondTypeMgr
java.lang.Object
moss.TypeMgr
moss.BondTypeMgr
- All Implemented Interfaces:
Serializable
Class for a bond type manager.
- Since:
- 2007.06.20
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
bond type: aromaticstatic final int
a mask for the type of a bondstatic final int
bond type: doublestatic final int
a mask, to be anded (bitwise &) with a bond type in order to downgrade an aromatic bond to a single bondprotected static String[]
the table of bond names; using the bond type as an index for this table yields a printable bond descriptionstatic final int
bond type: null bond, that is, a bond that does not actually connect two atomsstatic final int
a mask, to be anded (bitwise &) with a bond type in order to remove any distinction of bond typesstatic final int
bond type: singlestatic final int
bond type: triplestatic final int
bond type: unknownstatic final int
a mask, to be anded (bitwise &) with a bond type in order to upgrade an aromatic bond to a double bond -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Add a bond type.static int
Convert Kekulé representations to true aromatic rings.static int
getBond
(int type) Extract the raw bond type from a bond type.static String
getBondName
(int type) Get the name of the bond type.int
Map a bond name to the corresponding code.getName
(int code) Map a code to the corresponding bond name.int
Get the number of managed types.static boolean
isAromatic
(int type) Check whether a bond type is aromatic.static boolean
isDouble
(int type) Check whether a bond type is double.boolean
isFixed()
Check whether a type manager is fixed (is not extendable).static boolean
isRing
(int type) Check whether a bond type specifies a ring bond.static boolean
isSingle
(int type) Check whether a bond type is single.static boolean
isTriple
(int type) Check whether a bond type is triple.static void
Main function for testing some basic functionality.Methods inherited from class moss.TypeMgr
getBase, isSpecial, isWildcard
-
Field Details
-
UNKNOWN
public static final int UNKNOWNbond type: unknown- See Also:
-
NULL
public static final int NULLbond type: null bond, that is, a bond that does not actually connect two atoms- See Also:
-
SINGLE
public static final int SINGLEbond type: single- See Also:
-
AROMATIC
public static final int AROMATICbond type: aromatic- See Also:
-
DOUBLE
public static final int DOUBLEbond type: double- See Also:
-
TRIPLE
public static final int TRIPLEbond type: triple- See Also:
-
BONDMASK
public static final int BONDMASKa mask for the type of a bond- See Also:
-
SAMETYPE
public static final int SAMETYPEa mask, to be anded (bitwise &) with a bond type in order to remove any distinction of bond types- See Also:
-
DOWNGRADE
public static final int DOWNGRADEa mask, to be anded (bitwise &) with a bond type in order to downgrade an aromatic bond to a single bond- See Also:
-
UPGRADE
public static final int UPGRADEa mask, to be anded (bitwise &) with a bond type in order to upgrade an aromatic bond to a double bond- See Also:
-
names
the table of bond names; using the bond type as an index for this table yields a printable bond description
-
-
Constructor Details
-
BondTypeMgr
public BondTypeMgr()Create a bond type manager.- Since:
- 2007.06.21 (Christian Borgelt)
-
-
Method Details
-
isFixed
public boolean isFixed()Check whether a type manager is fixed (is not extendable). -
getTypeCount
public int getTypeCount()Get the number of managed types.- Specified by:
getTypeCount
in classTypeMgr
- Returns:
- the number of types in this type manager
- Since:
- 2020.10.16 (Christian Borgelt)
-
add
Add a bond type.The set of bond types is fixed and cannot be extended. Therefore this function behaves exactly like the function
getCode()
and returns -1 for an unknown name. -
getCode
Map a bond name to the corresponding code. -
getName
Map a code to the corresponding bond name. -
getBond
public static int getBond(int type) Extract the raw bond type from a bond type.The raw bond type is only part of the type of a bond. The full type of a bond also includes a ring flag.
- Parameters:
type
- the type from which to extract the bond type- Returns:
- the bond type without a possible ring flag
- Since:
- 2006.10.31/2007.06.20 (Christian Borgelt)
-
getBondName
Get the name of the bond type.- Parameters:
type
- the bond type for which to get the name- Returns:
- the name of the bond type
- Since:
- 2006.30.31/2007.06.20 (Christian Borgelt)
-
isSingle
public static boolean isSingle(int type) Check whether a bond type is single.- Parameters:
type
- the type to check- Returns:
- whether the bond type is single
- Since:
- 2009.08.13 (Christian Borgelt)
-
isAromatic
public static boolean isAromatic(int type) Check whether a bond type is aromatic.- Parameters:
type
- the type to check- Returns:
- whether the bond type is aromatic
- Since:
- 2009.08.13 (Christian Borgelt)
-
isDouble
public static boolean isDouble(int type) Check whether a bond type is double.- Parameters:
type
- the type to check- Returns:
- whether the bond type is double
- Since:
- 2009.08.13 (Christian Borgelt)
-
isTriple
public static boolean isTriple(int type) Check whether a bond type is triple.- Parameters:
type
- the type to check- Returns:
- whether the bond type is triple
- Since:
- 2009.08.13 (Christian Borgelt)
-
isRing
public static boolean isRing(int type) Check whether a bond type specifies a ring bond.- Parameters:
type
- the bond type to check- Returns:
- whether the bond type specifies a ring
- Since:
- 2009.08.13 (Christian Borgelt)
-
aromatize
Convert Kekulé representations to true aromatic rings.In a Kekulé representation an aromatic ring with 6 edges is coded with alternating single and double edges. In this function such Kekulé representations are found and turned into true aromatic rings (actual aromatic bonds).
- Parameters:
mol
- the molecule in which to convert aromatic rings- Returns:
- the number of converted rings
- Since:
- 2003.07.11 (Christian Borgelt)
-
main
Main function for testing some basic functionality.It is tried to parse the first command line argument as a bond description and the resulting code is reported.
- Parameters:
args
- the command line arguments- Since:
- 2007.06.21 (Christian Borgelt)
-