Package chemaxon.alignment
Class NodeColor
java.lang.Object
chemaxon.alignment.NodeColor
- Direct Known Subclasses:
NodeColor.ExtendedAtomColoring
@PublicApi
public abstract sealed class NodeColor
extends Object
permits NodeColor.ExtendedAtomColoring (not exhaustive)
Defines the coloring of the nodes in the alignment graph. The coloring is used to determine which nodes
can be aligned to each other and how much weight the alignment of two nodes has. It is defined by
AlignmentProperties.ColoringScheme.
Thid class is used internally by AlignmentBase and its subclasses.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidaddWeight(int type1, int type2, double w) Adds a user-defined weight for the alignment of two types.static NodeColorFactory method to create a NodeColor based on the given ColoringScheme.abstract StringgetLabel()Returns a label for the coloring scheme.Returns the ColoringScheme associated with this NodeColor.doublegetWeight(int t1, int t2) Returns the weight of aligning two types based on the coloring scheme and user-defined weights.static booleanisAliphaticRingCenter(int type) Determines if the given type is an aliphatic ring center.booleanisAnchor(int type) Determines if the given type is an anchor type based on the coloring scheme.static booleanisAromaticRingCenter(int type) Determines if the given type is an aromatic ring center.abstract booleanisSameType(int type1, int type2) Determines if two types are considered the same based on the coloring scheme.booleanisSameTypeOrBothAnchor(int t1, int t2) Determines if two types are considered the same or if both are anchor types based on the coloring scheme.abstract booleanisSelected(int type) Determines if the given type is selected based on the coloring scheme.intlabelAsAnchor(int type) Labels the given type as an anchor type.abstract BitSetmarkSingleTypes(BitSet b, int t) Marks the given type in the provided BitSet according to the coloring scheme.voidSets the behavior for cases where the color of a node is not specified.abstract StringtypeLabel(int t) Returns a label for the given type based on the coloring scheme.intwithoutAnchorLabel(int type) Returns the type without the anchor label if it is an anchor type.
-
Field Details
-
ANCHOR
public static final int ANCHOR- See Also:
-
-
Method Details
-
create
public static NodeColor create(AlignmentProperties.ColoringScheme s) throws IllegalArgumentException Factory method to create a NodeColor based on the given ColoringScheme.- Parameters:
s- the ColoringScheme to create the NodeColor for- Returns:
- a NodeColor instance corresponding to the given ColoringScheme
- Throws:
IllegalArgumentException- if the provided ColoringScheme is invalid
-
getScheme
Returns the ColoringScheme associated with this NodeColor.- Returns:
- the ColoringScheme of this NodeColor
-
labelAsAnchor
public int labelAsAnchor(int type) Labels the given type as an anchor type.- Parameters:
type- the original type to label as an anchor- Returns:
- the new type labeled as an anchor
-
addWeight
public void addWeight(int type1, int type2, double w) Adds a user-defined weight for the alignment of two types.- Parameters:
type1- the first type to aligntype2- the second type to alignw- the weight of aligning type1 with type2
-
setNotSpec
Sets the behavior for cases where the color of a node is not specified.- Parameters:
notSpec- the ColorNotSpecifiedCase to set for this NodeColor
-
getWeight
Returns the weight of aligning two types based on the coloring scheme and user-defined weights.- Parameters:
t1- the first type to alignt2- the second type to align- Returns:
- the weight of aligning t1 with t2
- Throws:
AlignmentException- if the alignment is not allowed based on theAlignmentProperties.ColorNotSpecifiedCase
-
markSingleTypes
Marks the given type in the provided BitSet according to the coloring scheme.- Parameters:
b- the BitSet to mark the type int- the type to mark- Returns:
- the updated BitSet with the type marked
-
isSelected
public abstract boolean isSelected(int type) Determines if the given type is selected based on the coloring scheme.- Parameters:
type- the type to check- Returns:
- true if the type is selected, false otherwise
-
isSameType
public abstract boolean isSameType(int type1, int type2) Determines if two types are considered the same based on the coloring scheme.- Parameters:
type1- the first type to comparetype2- the second type to compare- Returns:
- true if the types are considered the same, false otherwise
-
getLabel
Returns a label for the coloring scheme.- Returns:
- a String label for the given type
-
isSameTypeOrBothAnchor
public boolean isSameTypeOrBothAnchor(int t1, int t2) Determines if two types are considered the same or if both are anchor types based on the coloring scheme.- Parameters:
t1- the first type to comparet2- the second type to compare- Returns:
- true if the types are considered the same or if both are anchor types, false otherwise
-
typeLabel
Returns a label for the given type based on the coloring scheme.- Parameters:
t- the type to label- Returns:
- a String label for the given type
-
isAnchor
public boolean isAnchor(int type) Determines if the given type is an anchor type based on the coloring scheme.- Parameters:
type- the type to check- Returns:
- true if the type is an anchor type, false otherwise
-
isAromaticRingCenter
public static boolean isAromaticRingCenter(int type) Determines if the given type is an aromatic ring center.- Parameters:
type- the type to check- Returns:
- true if the type is an aromatic ring center, false otherwise
-
isAliphaticRingCenter
public static boolean isAliphaticRingCenter(int type) Determines if the given type is an aliphatic ring center.- Parameters:
type- the type to check- Returns:
- true if the type is an aliphatic ring center, false otherwise
-
withoutAnchorLabel
public int withoutAnchorLabel(int type) Returns the type without the anchor label if it is an anchor type.- Parameters:
type- the original type to check and modify- Returns:
- the type without the anchor label if it is an anchor type, otherwise returns the original type
-