chemaxon.descriptors
Class CDParameters

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

public class CDParameters
extends MDParameters

Manages parameters the CustomDescriptor class.

Since:
JChem 2.3
Author:
Miklos Vargyas

Field Summary
static int BINARY_DESCRIPTOR
          descriptor type constants
protected  int descrType
          descriptor type
static int FLOAT_DESCRIPTOR
           
static int INTEGER_DESCRIPTOR
           
protected  org.dom4j.Element parameters
           node in the DOM tree built from the XML configuration
 
Fields inherited from class chemaxon.descriptors.MDParameters
asymmetryFactors, cellSize, cellwiseWeights, configFilePath, currentMetricIndex, data, decForm, DEFAULT_ASYMMETRY_FACTOR, DEFAULT_OUTPUT_PRECISION, DEFAULT_SCALE_FACTOR, DEFAULT_WEIGHT, defaultWeight, document, generator, internalSize, length, md, metricIndexes, normalized, outputPrecision, parametrizedMetricNodes, parametrizedMetrics, parametrizedMetricsNode, scaleFactors, screeningConfigurationNode, similarityNode, standardizer, standardizerConfigurationNode, thresholds, tverskyA, tverskyB, weights
 
Constructor Summary
CDParameters()
          Creates an empty object.
CDParameters(java.io.File configFile)
          Creates a new descriptor configured from the given file.
CDParameters(int type)
          Creates an empty object of the given type.
CDParameters(java.lang.String XMLconfig)
          Creates a new object based on a given configuration string.
 
Method Summary
 void fromFile(java.io.File parameterFile)
          Sets parameters from an XML file.
 void fromString(java.lang.String parameterString)
          Sets parameters from a string representation.
 java.lang.String getDefaultDocumentFrame()
          Gets the XML configuration string.
 int getDescrType()
          Gets the type of the descriptor.
protected  int getNumberOfWeights(int parametrizedMetricIndex)
          Gets the number of weight factors used by the specified metric.
protected  void init()
          This method is called by the constructors before processing the XML configuration.
protected  void initGenerator()
          This method is void in this class as custom descriptors are opaque, their internal structure is not known.
protected  void initParameters()
          Initializes data members that depend on the XML configuration but are not directly taken from it.
protected  void processDocument(boolean all)
          Processes parts of the XML configuration that are specific to CustomDescriptor.
protected  void readValues(boolean all)
          Picks parameter values from the DOM tree.
 void setLength(int length)
          Sets the length (number of cells) of the descriptor.
 
Methods inherited from class chemaxon.descriptors.MDParameters
addParameters, addParameters, addParametrizedMetric, addParametrizedMetricNode, addParametrizedMetricsNode, appendParametrizedMetric, checkDocumentVersion, getAsymmetryFactor, getCellSize, getCurrentMetricIndex, getData, getDecForm, getDefaultStandardizerConfiguration, getDescriptorTypeName, getInternalMetricIndex, getInternalSize, getLength, getMetricIndex, getMetricName, getMetricName, getNumberOfMetrics, getNumberOfWeights, getScaleFactor, getScalingHypothesis, getScreeningConfigurationString, getThreshold, getThreshold, getTverskyAlpha, getTverskyBeta, getWeights, importNodes, isAsymmetric, isCellwiseWeights, isNormalized, isScaled, isStandardizationMandatory, isWeighted, readFromXmlFile, readFromXmlString, readMetricParameters, readMetricWeights, setAsymmetryFactor, setCellSize, setCellwiseWeights, setCreateStatistics, setCurrentParametrizedMetric, setNormalized, setOutputPrecision, setParameters, setParameters, setScaleFactor, setScalingHypothesis, setThreshold, setWeights, standardize, toString, toString, writeMetricParameter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BINARY_DESCRIPTOR

public static final int BINARY_DESCRIPTOR
descriptor type constants

See Also:
Constant Field Values

INTEGER_DESCRIPTOR

public static final int INTEGER_DESCRIPTOR
See Also:
Constant Field Values

FLOAT_DESCRIPTOR

public static final int FLOAT_DESCRIPTOR
See Also:
Constant Field Values

descrType

protected int descrType
descriptor type


parameters

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

Constructor Detail

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(java.io.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(java.lang.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 Detail

fromString

public void fromString(java.lang.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(java.io.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 java.lang.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:
java.lang.IllegalArgumentException - if the given parameter is not a valid metric index

getDefaultDocumentFrame

public java.lang.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