public class BondTypeMgr extends TypeMgr
Modifier and Type | Field and Description |
---|---|
static int |
AROMATIC
bond type: aromatic
|
static int |
BONDMASK
a mask for the type of a bond
|
static int |
DOUBLE
bond type: double
|
static int |
DOWNGRADE
a mask, to be anded (bitwise &) with a bond type
in order to downgrade an aromatic bond to a single bond
|
protected static java.lang.String[] |
names
the table of bond names; using the bond type as an index
for this table yields a printable bond description
|
static int |
NULL
bond type: null bond, that is,
a bond that does not actually connect two atoms
|
static int |
SAMETYPE
a mask, to be anded (bitwise &) with a bond type
in order to remove any distinction of bond types
|
static int |
SINGLE
bond type: single
|
static int |
TRIPLE
bond type: triple
|
static int |
UNKNOWN
bond type: unknown
|
static int |
UPGRADE
a mask, to be anded (bitwise &) with a bond type
in order to upgrade an aromatic bond to a double bond
|
Constructor and Description |
---|
BondTypeMgr()
Create a bond type manager.
|
Modifier and Type | Method and Description |
---|---|
int |
add(java.lang.String name)
Add a bond type.
|
static int |
aromatize(Graph mol)
Convert Kekulé representations to true aromatic rings.
|
static int |
getBond(int type)
Extract the raw bond type from a bond type.
|
static java.lang.String |
getBondName(int type)
Get the name of the bond type.
|
int |
getCode(java.lang.String name)
Map a bond name to the corresponding code.
|
java.lang.String |
getName(int code)
Map a code to the corresponding bond name.
|
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(java.lang.String[] args)
Main function for testing some basic functionality.
|
getBase, isSpecial, isWildcard
public static final int UNKNOWN
public static final int NULL
public static final int SINGLE
public static final int AROMATIC
public static final int DOUBLE
public static final int TRIPLE
public static final int BONDMASK
public static final int SAMETYPE
public static final int DOWNGRADE
public static final int UPGRADE
protected static java.lang.String[] names
public BondTypeMgr()
public boolean isFixed()
public int add(java.lang.String name)
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.
add
in class TypeMgr
name
- the name of the bondgetCode(String)
public int getCode(java.lang.String name)
public java.lang.String getName(int code)
public static int getBond(int 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.
type
- the type from which to extract the bond typepublic static java.lang.String getBondName(int type)
type
- the bond type for which to get the namepublic static boolean isSingle(int type)
type
- the type to checkpublic static boolean isAromatic(int type)
type
- the type to checkpublic static boolean isDouble(int type)
type
- the type to checkpublic static boolean isTriple(int type)
type
- the type to checkpublic static boolean isRing(int type)
public static int aromatize(Graph mol)
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).
mol
- the molecule in which to convert aromatic ringspublic static void main(java.lang.String[] args)
It is tried to parse the first command line argument as a bond description and the resulting code is reported.
args
- the command line arguments