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
    Modifier and Type
    Class
    Description
    static final class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addWeight(int type1, int type2, double w)
    Adds a user-defined weight for the alignment of two types.
    static NodeColor
    Factory method to create a NodeColor based on the given ColoringScheme.
    abstract String
    Returns a label for the coloring scheme.
    Returns the ColoringScheme associated with this NodeColor.
    double
    getWeight(int t1, int t2)
    Returns the weight of aligning two types based on the coloring scheme and user-defined weights.
    static boolean
    Determines if the given type is an aliphatic ring center.
    boolean
    isAnchor(int type)
    Determines if the given type is an anchor type based on the coloring scheme.
    static boolean
    Determines if the given type is an aromatic ring center.
    abstract boolean
    isSameType(int type1, int type2)
    Determines if two types are considered the same based on the coloring scheme.
    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.
    abstract boolean
    isSelected(int type)
    Determines if the given type is selected based on the coloring scheme.
    int
    labelAsAnchor(int type)
    Labels the given type as an anchor type.
    abstract BitSet
    Marks the given type in the provided BitSet according to the coloring scheme.
    void
    Sets the behavior for cases where the color of a node is not specified.
    abstract String
    typeLabel(int t)
    Returns a label for the given type based on the coloring scheme.
    int
    Returns the type without the anchor label if it is an anchor type.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • create

      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 align
      type2 - the second type to align
      w - the weight of aligning type1 with type2
    • setNotSpec

      public void setNotSpec(AlignmentProperties.ColorNotSpecifiedCase notSpec)
      Sets the behavior for cases where the color of a node is not specified.
      Parameters:
      notSpec - the ColorNotSpecifiedCase to set for this NodeColor
    • getWeight

      public double getWeight(int t1, int t2) throws AlignmentException
      Returns the weight of aligning two types based on the coloring scheme and user-defined weights.
      Parameters:
      t1 - the first type to align
      t2 - the second type to align
      Returns:
      the weight of aligning t1 with t2
      Throws:
      AlignmentException - if the alignment is not allowed based on the AlignmentProperties.ColorNotSpecifiedCase
    • markSingleTypes

      public abstract BitSet markSingleTypes(BitSet b, int t)
      Marks the given type in the provided BitSet according to the coloring scheme.
      Parameters:
      b - the BitSet to mark the type in
      t - 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 compare
      type2 - the second type to compare
      Returns:
      true if the types are considered the same, false otherwise
    • getLabel

      public abstract String 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 compare
      t2 - the second type to compare
      Returns:
      true if the types are considered the same or if both are anchor types, false otherwise
    • typeLabel

      public abstract String typeLabel(int t)
      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