chemaxon.reaction
Class SynthesisAlgorithm

java.lang.Object
  extended by chemaxon.reaction.SynthesisAlgorithm
All Implemented Interfaces:
chemaxon.license.Licensable
Direct Known Subclasses:
ExhaustiveAlgorithm, LinearAlgorithm, RandomAlgorithm

Deprecated. Will be removed soon.

public abstract class SynthesisAlgorithm
extends java.lang.Object
implements chemaxon.license.Licensable

Abstract base class for synthesis algorithm implementations. A synthesis algorithm provides the subsequent synthesis steps for the Synthesizer. The set of reactions with reactant and product molecule sets is defined in the SynthesisGraph that is built according to the configuration XML.

Since:
JChem 3.0
Author:
Nora Mate
See Also:
SynthesisGraph

Field Summary
protected  org.dom4j.Element algorithmElement
          Deprecated. The algorithm element.
protected  Evaluator evaluator
          Deprecated. Evaluator object.
protected  java.lang.String licenseEnvironment
          Deprecated.  
protected  long logStatTime
          Deprecated. Log stat time.
protected  int mode
          Deprecated. The processing mode: Synthesizer.DBMODE, Synthesizer.FILEMODE or Synthesizer.MEMMODE.
protected  java.lang.String name
          Deprecated. The synthesis name.
protected  int phaseCount
          Deprecated. The number of phases to be processed.
protected  int rcount
          Deprecated. The number of reactions processed so far.
static int RMODE_ALL
          Deprecated. Reaction processing mode: take all reaction centers.
static int RMODE_ANY
          Deprecated. Reaction processing mode: take any of the reaction centers.
static int RMODE_SINGLE
          Deprecated. Reaction processing mode: process only if there is one reaction center list.
protected  int scount
          Deprecated. The number of steps processed so far.
protected  int stepCount
          Deprecated. The number of steps to be processed.
 
Constructor Summary
SynthesisAlgorithm()
          Deprecated. Default constructor.
 
Method Summary
protected  void addSets(MoleculeSet[] rsets, MoleculeSet[] psets)
          Deprecated. Adds reactant and product set IDs for the current step to the set list.
protected static void clearOriginCode(MolAtom atom)
          Deprecated. Clears atom origin code (currently stored as atom map).
 void close()
          Deprecated. Closes the algorithm (writers).
static SynthesisAlgorithm create(org.dom4j.Element element, chemaxon.reaction.ReactorConfiguration reactorConfig, ConnectionHandler conn, java.lang.String name)
          Deprecated. Creates the specified synthesis algorithm descendant.
protected  MolCondition createCondition(org.dom4j.Element element)
          Deprecated.  
protected abstract  void fillSetList()
          Deprecated. Fills the set list with set ID-s with reactant and product sets for each algorithm step.
protected  void flushLog()
          Deprecated. Flushes log writer.
 SynthesisGraph getGraph()
          Deprecated. Returns the synthesis graph.
protected static int getOriginCode(MolAtom atom)
          Deprecated. Returns atom origin code.
protected static int[] getOriginCodes(Molecule mol, boolean clear)
          Deprecated. Returns origin codes in an int[] array according to atom order.
 java.lang.String getSet(int i)
          Deprecated. Returns the i-th set ID in the list.
 java.lang.String[] getSetIds()
          Deprecated. Returns the set IDs, each set ID once.
 chemaxon.reaction.synthesis.TreeHandler getTree()
          Deprecated. Returns the synthesis tree.
protected  void init(org.dom4j.Element algorithmElement, chemaxon.reaction.ReactorConfiguration reactorConfig, ConnectionHandler conn, java.lang.String name)
          Deprecated. Initializes the algorithm.
 boolean isLicensed()
          Deprecated. Returns information about the licensing of the product.
protected  void postInit()
          Deprecated. Initializes the algorithm.
 void restart()
          Deprecated. Restarts the algorithm.
abstract  void setExcludedIDs(java.lang.String[] ids)
          Deprecated. Sets phase/step IDs to be excluded.
 void setGraph(SynthesisGraph graph)
          Deprecated. Sets the synthesis graph.
 void setLicenseEnvironment(java.lang.String env)
          Deprecated. Every license can have a modifier environment that's tipically an integration environment.
 void setLogging(boolean log)
          Deprecated. Sets logging.
 void setLogStatTime(long logStatTime)
          Deprecated. Sets log statistics interval (in minutes).
protected static void setOriginCode(MolAtom atom, int code)
          Deprecated. Sets atom origin code.
protected static void setOriginCodes(Molecule mol, int code)
          Deprecated. Sets atom codes in the new atoms of the molecule as atom maps: an atom gets the specified new code if its stored origin code is 0 or there is no stored origin code.
protected static void setOriginCodes(Molecule mol, int[] codes, int code)
          Deprecated. Sets atom codes in the atoms of the molecule as atom maps: an atom gets the origin code with the corresponding index if it is not 0, gets the specified new code if the origin code is 0.
 void setPhaseCount(int count)
          Deprecated. Sets the number of phases to be processed (the meaning of a phase depends on the algorithm, default: same as substep).
 void setProgressDisplay(boolean progressDisplay)
          Deprecated. Sets progress display in status line on System.err.
 void setStepCount(int count)
          Deprecated. Sets the number of substeps to be processed (the meaning of a substep depends on the algorithm).
 boolean step()
          Deprecated. Performs the next synthesis phase.
protected  void writeLog(java.lang.String msg)
          Deprecated. Writes log message if logging is enabled.
protected  void writeLog(java.lang.String msg, Molecule mol)
          Deprecated. Writes molecule in log if logging is enabled.
protected  void writeLog(java.lang.Throwable e)
          Deprecated. Logs exception stack trace.
protected  void writeProgress(java.lang.String msg)
          Deprecated. Writes progress message to status line if progress display is enabled.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RMODE_ANY

public static final int RMODE_ANY
Deprecated. 
Reaction processing mode: take any of the reaction centers.

See Also:
Constant Field Values

RMODE_SINGLE

public static final int RMODE_SINGLE
Deprecated. 
Reaction processing mode: process only if there is one reaction center list.

See Also:
Constant Field Values

RMODE_ALL

public static final int RMODE_ALL
Deprecated. 
Reaction processing mode: take all reaction centers.

See Also:
Constant Field Values

name

protected java.lang.String name
Deprecated. 
The synthesis name.


mode

protected int mode
Deprecated. 
The processing mode: Synthesizer.DBMODE, Synthesizer.FILEMODE or Synthesizer.MEMMODE.


algorithmElement

protected org.dom4j.Element algorithmElement
Deprecated. 
The algorithm element.


evaluator

protected Evaluator evaluator
Deprecated. 
Evaluator object.


rcount

protected int rcount
Deprecated. 
The number of reactions processed so far.


scount

protected int scount
Deprecated. 
The number of steps processed so far.


stepCount

protected int stepCount
Deprecated. 
The number of steps to be processed.


phaseCount

protected int phaseCount
Deprecated. 
The number of phases to be processed.


logStatTime

protected long logStatTime
Deprecated. 
Log stat time.


licenseEnvironment

protected java.lang.String licenseEnvironment
Deprecated. 
Constructor Detail

SynthesisAlgorithm

public SynthesisAlgorithm()
Deprecated. 
Default constructor.

Method Detail

create

public static SynthesisAlgorithm create(org.dom4j.Element element,
                                        chemaxon.reaction.ReactorConfiguration reactorConfig,
                                        ConnectionHandler conn,
                                        java.lang.String name)
                                 throws ReactionException
Deprecated. 
Creates the specified synthesis algorithm descendant.

Parameters:
element - is the configuration DOM element
reactorConfig - is the reactor configuration object
conn - is the db connection handler, or null if memory based synthesis
name - is the synthesis name
Throws:
ReactionException - on error

restart

public void restart()
Deprecated. 
Restarts the algorithm.


init

protected void init(org.dom4j.Element algorithmElement,
                    chemaxon.reaction.ReactorConfiguration reactorConfig,
                    ConnectionHandler conn,
                    java.lang.String name)
             throws ReactionException
Deprecated. 
Initializes the algorithm. The default implementation creates the synthesis tree.

Parameters:
algorithmElement - is the configuration DOM element
reactorConfig - is the reactor configuration object
conn - is the db connection handler, or null if memory based synthesis
name - is the synthesis name
Throws:
ReactionException - on error

postInit

protected void postInit()
                 throws ReactionException
Deprecated. 
Initializes the algorithm. Called after the synthesis graph is set and the set list is filled. The default implementation does nothing.

Throws:
ReactionException - on error

createCondition

protected final MolCondition createCondition(org.dom4j.Element element)
                                      throws ReactionException
Deprecated. 
Throws:
ReactionException

setProgressDisplay

public void setProgressDisplay(boolean progressDisplay)
Deprecated. 
Sets progress display in status line on System.err.

Parameters:
progressDisplay - is true is progress count is to be displayed in status line
Since:
JChem 3.1

setStepCount

public void setStepCount(int count)
Deprecated. 
Sets the number of substeps to be processed (the meaning of a substep depends on the algorithm). Default: Integer.MAX_VALUE, all substeps are processed.

Parameters:
count - is the number of steps to be processed

setPhaseCount

public void setPhaseCount(int count)
Deprecated. 
Sets the number of phases to be processed (the meaning of a phase depends on the algorithm, default: same as substep). Default: Integer.MAX_VALUE, all phases are processed.

Parameters:
count - is the number of phases to be processed

setOriginCode

protected static final void setOriginCode(MolAtom atom,
                                          int code)
                                   throws ReactionException
Deprecated. 
Sets atom origin code. Currently uses the atom map for this purpose.

Parameters:
atom - is the atom object
code - is the origin code
Throws:
ReactionException - if the code exceeds the max atom map (1023)

getOriginCode

protected static final int getOriginCode(MolAtom atom)
Deprecated. 
Returns atom origin code. Currently the atom map stores the origin code.

Parameters:
atom - is the atom object
Returns:
the atom origin code

clearOriginCode

protected static final void clearOriginCode(MolAtom atom)
Deprecated. 
Clears atom origin code (currently stored as atom map). To be called before the molecule is exported.

Parameters:
atom - is the atom object

setOriginCodes

protected static void setOriginCodes(Molecule mol,
                                     int[] codes,
                                     int code)
                              throws ReactionException
Deprecated. 
Sets atom codes in the atoms of the molecule as atom maps: an atom gets the origin code with the corresponding index if it is not 0, gets the specified new code if the origin code is 0.

Parameters:
mol - is the molceule
codes - is the origin code array (one code for each atom)
code - is the atom code for new atoms (with origin code 0)
Throws:
ReactionException - if code is out of range (greater than 1023)

setOriginCodes

protected static void setOriginCodes(Molecule mol,
                                     int code)
                              throws ReactionException
Deprecated. 
Sets atom codes in the new atoms of the molecule as atom maps: an atom gets the specified new code if its stored origin code is 0 or there is no stored origin code.

Parameters:
mol - is the molceule
code - is the atom code for new atoms (with origin code 0)
Throws:
ReactionException - if code is out of range (greater than 1023)

getOriginCodes

protected static int[] getOriginCodes(Molecule mol,
                                      boolean clear)
Deprecated. 
Returns origin codes in an int[] array according to atom order. Clears origin codes if required.

Parameters:
mol - is the molecule
clear - is true if origin codes should be cleared
Returns:
the origin codes

addSets

protected final void addSets(MoleculeSet[] rsets,
                             MoleculeSet[] psets)
Deprecated. 
Adds reactant and product set IDs for the current step to the set list.

Parameters:
rsets - is the reactant set array
psets - is the product set array

getSet

public java.lang.String getSet(int i)
Deprecated. 
Returns the i-th set ID in the list.

Parameters:
i - is the set index in the list
Returns:
the set ID

getSetIds

public java.lang.String[] getSetIds()
Deprecated. 
Returns the set IDs, each set ID once.

Returns:
the set IDs

setGraph

public void setGraph(SynthesisGraph graph)
Deprecated. 
Sets the synthesis graph.

Parameters:
graph - is the synthesis graph

getGraph

public final SynthesisGraph getGraph()
Deprecated. 
Returns the synthesis graph.

Returns:
the synthesis graph

getTree

public final chemaxon.reaction.synthesis.TreeHandler getTree()
Deprecated. 
Returns the synthesis tree.

Returns:
the synthesis tree

close

public void close()
           throws ReactionException
Deprecated. 
Closes the algorithm (writers).

Throws:
ReactionException - on error

setLogging

public void setLogging(boolean log)
                throws java.io.IOException
Deprecated. 
Sets logging. Log file: <synthesis name>.log Currently log messages are written only in case of RandomAlgorithm, database mode.

Parameters:
log - is true if logging enabled
Throws:
java.io.IOException
Since:
JChem 3.1

setLogStatTime

public void setLogStatTime(long logStatTime)
                    throws java.io.IOException
Deprecated. 
Sets log statistics interval (in minutes). If set, various log events are summerized in the statistics file: <synthesis name>.log.stat If not set (i.e., set to -1), no log statistics is written. Currently implemented only in RandomAlgorithm, database mode.

Parameters:
logStatTime - the log statistics interval (in minutes)
Throws:
java.io.IOException
Since:
JChem 3.1

writeLog

protected void writeLog(java.lang.String msg)
Deprecated. 
Writes log message if logging is enabled.

Parameters:
msg - is the log message

writeLog

protected void writeLog(java.lang.String msg,
                        Molecule mol)
Deprecated. 
Writes molecule in log if logging is enabled.

Parameters:
msg - is the log message
mol - is the molecule

writeLog

protected void writeLog(java.lang.Throwable e)
Deprecated. 
Logs exception stack trace.

Parameters:
e - is the throwable object

writeProgress

protected void writeProgress(java.lang.String msg)
Deprecated. 
Writes progress message to status line if progress display is enabled.

Parameters:
msg - is the progress message
Since:
JChem 3.1

flushLog

protected void flushLog()
Deprecated. 
Flushes log writer.


setExcludedIDs

public abstract void setExcludedIDs(java.lang.String[] ids)
Deprecated. 
Sets phase/step IDs to be excluded.

Parameters:
ids - the phase/step IDs to be excluded

step

public boolean step()
             throws ReactionException
Deprecated. 
Performs the next synthesis phase. The default implementation calls postInit() if needed.

Returns:
true if there are more phases, false if end of synthesis
Throws:
ReactionException - on error

fillSetList

protected abstract void fillSetList()
                             throws ReactionException
Deprecated. 
Fills the set list with set ID-s with reactant and product sets for each algorithm step. Used for coloring atoms by origin code.

Throws:
ReactionException - on error

setLicenseEnvironment

public void setLicenseEnvironment(java.lang.String env)
Deprecated. 
Description copied from interface: chemaxon.license.Licensable
Every license can have a modifier environment that's tipically an integration environment. All being Licensable should be prepared to store and show a set environment to the LicenseHandler. Example implementation:
 private String licenseEnvironment = "";
 public void setLicenseEnvironment(String env) {
     licenseEnvironment = env;
 }
 

Specified by:
setLicenseEnvironment in interface chemaxon.license.Licensable
Parameters:
env - environment String to be stored and passed to the LicenseHandler in the isLicensed method

isLicensed

public boolean isLicensed()
Deprecated. 
Description copied from interface: chemaxon.license.Licensable
Returns information about the licensing of the product. Example implementation: return LicenseHandler.getInstance().isLicensed( LicenseHandler.MY_IDENTIFIER, licenseEnvironment );

Specified by:
isLicensed in interface chemaxon.license.Licensable
Returns:
true if the product is correctly licensed