chemaxon.jep
Class Evaluator

java.lang.Object
  extended bychemaxon.jep.Evaluator

public class Evaluator
extends java.lang.Object

Evaluates chemical expressions. Provides command line interface or creates ChemJEP objects according to configuration.

Since:
JChem 2.2
Version:
5.0.1 01/16/2007
Author:
Nora Mate, Zsolt Mohacsi

Field Summary
static java.lang.String DEFAULT_TAG_NAME
          Default SDFile tag to store the evaluation result.
static java.lang.String EVALUATOR_DEFAULTS_FILE
          Default Function/Plugin settings filename.
static java.lang.String EVALUATOR_NAMED_MOLS_FILE
          Default named molecule set filename.
static java.lang.String EVALUATOR_SCRIPT_FILE
          Initial script filename.
static java.lang.String JCHEM_CONFIG_DIR
          Default directory under jchem directory for storing configuration files.
 
Constructor Summary
Evaluator()
          Default constructor.
Evaluator(org.dom4j.Element element)
          Deprecated. for internal use only
Evaluator(org.dom4j.Element element, java.lang.String dir)
          Deprecated. for internal use only
Evaluator(org.dom4j.Element element, java.lang.String dir, Standardizer standardizer)
          Deprecated. for internal use only
Evaluator(java.io.File file)
          Constructor.
Evaluator(java.io.File file, Standardizer standardizer)
          Constructor.
Evaluator(java.io.File file, Standardizer standardizer, MolImporter importer, java.lang.String script)
          Constructor.
Evaluator(Standardizer standardizer)
          Constructor.
Evaluator(java.lang.String configString)
          Constructor.
Evaluator(java.lang.String configString, Standardizer standardizer)
          Constructor.
Evaluator(java.lang.String configString, Standardizer standardizer, MolImporter importer, java.lang.String script)
          Constructor.
 
Method Summary
 ChemJEP compile(java.lang.String expression)
          Compiles the expression, creates ChemJEP object.
 ChemJEP compile(java.lang.String expression, java.lang.Class contextClass)
          Compiles the expression, creates ChemJEP object.
 ChemJEP compile(java.lang.String expression, java.lang.Class contextClass, chemaxon.nfunk.jep.SymbolTable stab)
          Compiles the expression, creates ChemJEP object.
 java.util.Hashtable getFunctionParameterData()
          Returns user parameter data for each function.
 java.lang.String[] getPluginIDs()
          Returns the plugin function IDs from the Plugins section of the configuration XML.
 chemaxon.nfunk.jep.SymbolTable getSymbolTable()
          Returns the symbol table of predefined constants (molecules, molecule sets and other constants defined in the built-in and the user-defined jep.script).
static void main(java.lang.String[] args)
          The command line version entry point.
 void runScript(java.lang.String script)
          Runs a script, variables will be added to the base variable table and can be referenced by chemical expressions.
 void setFingerprintGenerator(chemaxon.sss.screen.CombinedFingerprint cf)
          Sets the fingerprint generator object (needed for query strings).
 void setVerbose(boolean verbose)
          Sets verbose mode.
static java.lang.String toString(java.lang.Object o)
          Returns String representation of an object using default decimal format with 2 fractional digits.
static java.lang.String toString(java.lang.Object o, java.text.DecimalFormat df)
          Returns String representation of an object.
static java.lang.String toString(java.lang.Object o, int precision)
          Returns String representation of an object using default decimal format with given number of fractional digits.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EVALUATOR_DEFAULTS_FILE

public static final java.lang.String EVALUATOR_DEFAULTS_FILE
Default Function/Plugin settings filename.

See Also:
Constant Field Values

EVALUATOR_NAMED_MOLS_FILE

public static final java.lang.String EVALUATOR_NAMED_MOLS_FILE
Default named molecule set filename.

See Also:
Constant Field Values

JCHEM_CONFIG_DIR

public static final java.lang.String JCHEM_CONFIG_DIR
Default directory under jchem directory for storing configuration files.

See Also:
Constant Field Values

EVALUATOR_SCRIPT_FILE

public static final java.lang.String EVALUATOR_SCRIPT_FILE
Initial script filename.

See Also:
Constant Field Values

DEFAULT_TAG_NAME

public static final java.lang.String DEFAULT_TAG_NAME
Default SDFile tag to store the evaluation result.

See Also:
Constant Field Values
Constructor Detail

Evaluator

public Evaluator()
          throws chemaxon.nfunk.jep.ParseException
Default constructor.


Evaluator

public Evaluator(Standardizer standardizer)
          throws chemaxon.nfunk.jep.ParseException
Constructor. Loads default configuration with standardizer, loads default named molecule sets and runs default initial scripts.

Parameters:
standardizer - is the standardizer object
Throws:
chemaxon.nfunk.jep.ParseException - on error
Since:
JChem 3.1.4

Evaluator

public Evaluator(java.io.File file)
          throws chemaxon.nfunk.jep.ParseException
Constructor. Loads default configuration and configuration from specified file, loads default named molecule sets and runs default initial scripts.

Parameters:
file - is the XML configuration file
Throws:
chemaxon.nfunk.jep.ParseException - on error

Evaluator

public Evaluator(org.dom4j.Element element)
          throws chemaxon.nfunk.jep.ParseException
Deprecated. for internal use only

Constructor. Loads default configuration and configuration from specified XML element node, loads default named molecule sets and runs default initial scripts.

Parameters:
element - is the configuration root element
Throws:
chemaxon.nfunk.jep.ParseException - on error

Evaluator

public Evaluator(java.lang.String configString)
          throws chemaxon.nfunk.jep.ParseException
Constructor. Loads default configuration and configuration from specified XML configuration string, loads default named molecule sets and runs default initial scripts.

Parameters:
configString - is the XML configuration string
Throws:
chemaxon.nfunk.jep.ParseException - on error
Since:
JChem 5.0

Evaluator

public Evaluator(org.dom4j.Element element,
                 java.lang.String dir)
          throws chemaxon.nfunk.jep.ParseException
Deprecated. for internal use only

Constructor. Loads default configuration and configuration from specified XML element node, loads default named molecule sets and runs default initial scripts.

Parameters:
element - is the configuration root element
dir - is the root directory
Throws:
chemaxon.nfunk.jep.ParseException - on error

Evaluator

public Evaluator(java.io.File file,
                 Standardizer standardizer)
          throws chemaxon.nfunk.jep.ParseException
Constructor. Loads default configuration and configuration from specified file with standardizer. Loads also default named molecule sets and runs default initial scripts.

Parameters:
file - is the XML configuration file
standardizer - is the standardizer object
Throws:
chemaxon.nfunk.jep.ParseException - on error

Evaluator

public Evaluator(java.io.File file,
                 Standardizer standardizer,
                 MolImporter importer,
                 java.lang.String script)
          throws chemaxon.nfunk.jep.ParseException
Constructor. Loads default configuration and configuration from specified file with standardizer. Loads also default named molecule sets and named molecule sets from the specified importer. Runs initial scripts.

Parameters:
file - is the XML configuration file
standardizer - is the standardizer object
importer - is the MolImporter object used for loading named molecule sets (if null, then default molecule sets are loaded)
script - is the initial script (Chemical Terms expression; if null, then default initial scripts are run)
Throws:
chemaxon.nfunk.jep.ParseException - on error
Since:
JChem 5.0

Evaluator

public Evaluator(org.dom4j.Element element,
                 java.lang.String dir,
                 Standardizer standardizer)
          throws chemaxon.nfunk.jep.ParseException
Deprecated. for internal use only

Constructor. Loads default configuration and configuration from specified XML element node with standardizer. Loads also default named molecule sets and runs default initial scripts.

Parameters:
element - is the configuration root element
dir - is the root directory
standardizer - is the standardizer object
Throws:
chemaxon.nfunk.jep.ParseException - on error

Evaluator

public Evaluator(java.lang.String configString,
                 Standardizer standardizer)
          throws chemaxon.nfunk.jep.ParseException
Constructor. Loads default configuration and configuration from specified XML configuration string with standardizer. Loads also default named molecule sets and runs default initial scripts.

Parameters:
configString - is the XML configuration string
standardizer - is the standardizer object
Throws:
chemaxon.nfunk.jep.ParseException - on error
Since:
JChem 5.0

Evaluator

public Evaluator(java.lang.String configString,
                 Standardizer standardizer,
                 MolImporter importer,
                 java.lang.String script)
          throws chemaxon.nfunk.jep.ParseException
Constructor. Loads default configuration and configuration from specified XML configuration string with standardizer. Loads also default named molecule sets and named molecule sets from the specified importer. Runs initial scripts.

Parameters:
configString - is the XML configuration string
standardizer - is the standardizer object
importer - is the MolImporter object used for loading named molecule sets (if null, then default molecule sets are loaded)
script - is the initial script (Chemical Terms expression; if null, then default initial scripts are run)
Throws:
chemaxon.nfunk.jep.ParseException - on error
Since:
JChem 5.0
Method Detail

runScript

public void runScript(java.lang.String script)
               throws chemaxon.nfunk.jep.ParseException
Runs a script, variables will be added to the base variable table and can be referenced by chemical expressions.

Parameters:
script - is the script (Chemical Terms expression)
Throws:
chemaxon.nfunk.jep.ParseException - on error
Since:
JChem 3.2

getFunctionParameterData

public java.util.Hashtable getFunctionParameterData()
                                             throws chemaxon.nfunk.jep.ParseException
Returns user parameter data for each function. The table is built according to the UserParam sections of the configuration XML. The keys are the function IDs, the values are the corresponding parameter record arrays:
 
 <function ID> -< UserParam[]
 

Returns:
the user parameter data for each function
Throws:
chemaxon.nfunk.jep.ParseException - on configuration error
Since:
JChem 3.2

getPluginIDs

public java.lang.String[] getPluginIDs()
                                throws chemaxon.nfunk.jep.ParseException
Returns the plugin function IDs from the Plugins section of the configuration XML.

Returns:
the plugin function IDs
Throws:
chemaxon.nfunk.jep.ParseException - on configuration error
Since:
JChem 3.2

getSymbolTable

public chemaxon.nfunk.jep.SymbolTable getSymbolTable()
Returns the symbol table of predefined constants (molecules, molecule sets and other constants defined in the built-in and the user-defined jep.script).

Returns:
the symbol table of predefined constants
Since:
JChem 3.2

setFingerprintGenerator

public void setFingerprintGenerator(chemaxon.sss.screen.CombinedFingerprint cf)
Sets the fingerprint generator object (needed for query strings).

Parameters:
cf - is the fingerprint generator object

setVerbose

public void setVerbose(boolean verbose)
Sets verbose mode.

Parameters:
verbose - is true if verbose mode

compile

public ChemJEP compile(java.lang.String expression)
                throws chemaxon.nfunk.jep.ParseException
Compiles the expression, creates ChemJEP object. Call ChemJEP.evaluate(ChemContext) to evaluate the expression.

Parameters:
expression - is the expression string
Returns:
the created ChemJEP object
Throws:
chemaxon.nfunk.jep.ParseException - on compile error

compile

public ChemJEP compile(java.lang.String expression,
                       java.lang.Class contextClass)
                throws chemaxon.nfunk.jep.ParseException
Compiles the expression, creates ChemJEP object. Call ChemJEP.evaluate(ChemContext) to evaluate the expression.

Parameters:
expression - is the expression string
contextClass - is the evaluation context class object
Returns:
the created ChemJEP object
Throws:
chemaxon.nfunk.jep.ParseException - on compile error

compile

public ChemJEP compile(java.lang.String expression,
                       java.lang.Class contextClass,
                       chemaxon.nfunk.jep.SymbolTable stab)
                throws chemaxon.nfunk.jep.ParseException
Compiles the expression, creates ChemJEP object. Call ChemJEP.evaluate(ChemContext) to evaluate the expression.

Parameters:
expression - is the expression string
contextClass - is the evaluation context class object
stab - is the vaiable table, null if the default varibale table should be used
Returns:
the created ChemJEP object
Throws:
chemaxon.nfunk.jep.ParseException - on compile error

toString

public static java.lang.String toString(java.lang.Object o)
Returns String representation of an object using default decimal format with 2 fractional digits.

Parameters:
o - is the object
Returns:
the string representation of the object

toString

public static java.lang.String toString(java.lang.Object o,
                                        int precision)
Returns String representation of an object using default decimal format with given number of fractional digits.

Parameters:
o - is the object
precision - is the number of fractional digits
Returns:
the string representation of the object

toString

public static java.lang.String toString(java.lang.Object o,
                                        java.text.DecimalFormat df)
Returns String representation of an object.

Parameters:
o - is the object
df - is the real-number formatter
Returns:
the string representation of the object

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
The command line version entry point. Parameter parsing, initialization then start.

Parameters:
args - the command line parameters
Throws:
java.lang.Exception