Class CDParameters

java.lang.Object
chemaxon.descriptors.MDParameters
chemaxon.descriptors.CDParameters

@PublicApi public class CDParameters extends MDParameters
Manages parameters the CustomDescriptor class.
Since:
JChem 2.3
  • Field Details

    • BINARY_DESCRIPTOR

      public static final int BINARY_DESCRIPTOR
      descriptor type constants
      See Also:
    • INTEGER_DESCRIPTOR

      public static final int INTEGER_DESCRIPTOR
      See Also:
    • FLOAT_DESCRIPTOR

      public static final int FLOAT_DESCRIPTOR
      See Also:
    • descrType

      protected int descrType
      descriptor type
    • parameters

      protected org.dom4j.Element parameters
      node in the DOM tree built from the XML configuration
  • Constructor Details

    • CDParameters

      public CDParameters()
      Creates an empty object. The type of the descriptor is not yet determined.
    • CDParameters

      public CDParameters(int type)
      Creates an empty object of the given type. Initializes to default values.
    • CDParameters

      public CDParameters(File configFile) throws MDParametersException
      Creates a new descriptor configured from the given file.
      Parameters:
      configFile - XML configuration file
      Throws:
      MDParametersException - missing or bad XML configuration
    • CDParameters

      public CDParameters(String XMLconfig) throws MDParametersException
      Creates a new object based on a given configuration string.
      Parameters:
      XMLconfig - XML configuration string
      Throws:
      MDParametersException - missing or bad XML configuration
  • Method Details

    • fromString

      public void fromString(String parameterString) throws MDParametersException
      Sets parameters from a string representation. This method processes an XML format, but derived classes may overload this and define their own format.
      Overrides:
      fromString in class MDParameters
      Parameters:
      parameterString - parameters in string
      Throws:
      MDParametersException - when the parameter string is not well-formed
    • fromFile

      public void fromFile(File parameterFile) throws MDParametersException
      Sets parameters from an XML file. Derived classes may overload this and define their own format (even other than XML).
      Overrides:
      fromFile in class MDParameters
      Parameters:
      parameterFile - initialized parameter file
      Throws:
      MDParametersException - failed to process parameter file
    • setLength

      public void setLength(int length) throws MDParametersException
      Description copied from class: MDParameters
      Sets the length (number of cells) of the descriptor.
      Overrides:
      setLength in class MDParameters
      Parameters:
      length - the required length (cell count)
      Throws:
      MDParametersException - if argument is not positive
    • initGenerator

      protected void initGenerator() throws MDParametersException
      This method is void in this class as custom descriptors are opaque, their internal structure is not known. Derived classes that implement user defined or 3rd party descriptors should overload this function and provide the procedure for descriptor generation.
      Throws:
      MDParametersException
    • init

      protected void init()
      This method is called by the constructors before processing the XML configuration. It creates a CustomDescriptor object defined in MDParameters.md. Metircs defined by the descirptor class are retrieved through this object.
    • initParameters

      protected void initParameters()
      Initializes data members that depend on the XML configuration but are not directly taken from it.
      Overrides:
      initParameters in class MDParameters
    • getDescrType

      public int getDescrType()
      Gets the type of the descriptor.
      Returns:
      type of the descriptor (BINARY_DESCRIPTOR, INTEGER_DESCRIPTOR or FLOAT_DESCRIPTOR)
    • getNumberOfWeights

      protected int getNumberOfWeights(int parametrizedMetricIndex) throws IllegalArgumentException
      Gets the number of weight factors used by the specified metric. T
      Overrides:
      getNumberOfWeights in class MDParameters
      Parameters:
      parametrizedMetricIndex - parametrized metric index
      Returns:
      number of weights the metric uses
      Throws:
      IllegalArgumentException - if the given parameter is not a valid metric index
    • getDefaultDocumentFrame

      public String getDefaultDocumentFrame()
      Gets the XML configuration string. This is needed when the optional XML configuration is not specified.
      Overrides:
      getDefaultDocumentFrame in class MDParameters
      Returns:
      default XML configuration string of the CDParameters class
    • processDocument

      protected void processDocument(boolean all) throws MDParametersException
      Processes parts of the XML configuration that are specific to CustomDescriptor. Find the node in the DOM tree and leaves the rest of the work to the parent class.
      Overrides:
      processDocument in class MDParameters
      Parameters:
      all - indicates if the entire document has to be processed in which case the existing configuration is overwritten
      Throws:
      MDParametersException
    • readValues

      protected void readValues(boolean all) throws MDParametersException
      Picks parameter values from the DOM tree.
      Overrides:
      readValues in class MDParameters
      Parameters:
      all - indicates if the entire document has to be processed in which case the existing configuration is overwritten
      Throws:
      MDParametersException