|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectchemaxon.descriptors.MDReader
public abstract class MDReader
Base class definitions for MDSet input streams.
Different descriptors types (as fingerprints, pharmacophore fingerprints)
are handled in the same, a transparent manner. Derived classes may differ
in the source of initial data they handle: standard molecular structure file,
chemical descriptor set file (written by an MDWrite derivative),
or database.
Each element read can either get a unique identifier (ID) from the source it
comes from, or alternatively an ID can also be generated by the reader.
An MDSet object is returned by the reader in each call. This set
can either be re-used or a new instance can be created. This behaviour is
determined by setCloneResult( boolean ).
| Field Summary | |
|---|---|
protected boolean |
cloneResult
indicates if mdSet is cloned or not in next() |
protected int |
firstId
starting value of id |
protected boolean |
generateDescriptor
Generates descriptor from molecule if true, direct read otherwise. |
protected boolean |
generateId
generate unique identifiers |
protected int |
id
unique identifier (ID) of the current element read |
protected java.lang.String |
idTagName
name of the tag in the SDfile input which stored the unique structure id |
protected Molecule |
lastReadMolecule
the molecule last read from the structure table |
protected MDSet |
mdSet
the schema mdSet if descriptors are generated on-the-fly |
protected java.util.ArrayList |
takeTags
names of tags that have to be taken from the input Molecule |
| Constructor Summary | |
|---|---|
protected |
MDReader()
Creates an new, empty object. |
protected |
MDReader(MDSet mdSet)
Creates a molecular structure file or database table reader. |
| Method Summary | |
|---|---|
abstract void |
close()
Closes down the descriptor stream. |
protected void |
createMDSetComponent(int i,
java.lang.String type,
java.lang.String settings)
Creates and sets the given component of the internal MDSet
object of the given type and specified parameter settings. |
boolean |
getCloneResult()
Gets the current value of the cloning policy flag. |
MDSet |
getMDSet()
Gets the molecular descriptor set. |
Molecule |
getMolecule()
Gets the current molecular structure as read from the input file (that is before any transformation were applied). |
abstract MDSet |
next()
Reads the next element from the input and stores it in the
MDSet object passed as parameter. |
void |
reset()
Initializes the MDSet input stream. |
void |
setCloneResult(boolean cloneResult)
Sets the cloning policy of the next() method. |
void |
setFirstId(int firstId)
Sets the ID of the first MDSet. |
void |
setGenerateId(boolean generateId)
Sets whether ID-s are generated or not. |
void |
setIdTagName(java.lang.String tagName)
Sets the name of the ID tag in the SDfile. |
void |
setTakeTag(int cdSetComponent,
java.lang.String tagName)
Sets the tag name of a MDSet component. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected int id
protected int firstId
protected boolean generateId
protected boolean generateDescriptor
protected Molecule lastReadMolecule
protected MDSet mdSet
protected boolean cloneResult
next()
protected java.util.ArrayList takeTags
protected java.lang.String idTagName
| Constructor Detail |
|---|
protected MDReader(MDSet mdSet)
MDSet
parameter passed.
mdSet - a sample MDSet object that defines what
should be read from the input sourceprotected MDReader()
| Method Detail |
|---|
public void setGenerateId(boolean generateId)
generateId - ID-s are generated if true, otherwise ID-s are read
from the input source
public void setTakeTag(int cdSetComponent,
java.lang.String tagName)
MDSet component. If the name is not
null, the value of the tag is taken from an SDfile input, otherwise, or
in the case when the tag named does not exists in the input file, the
desciptor of the specified component is generated.
cdSetComponent - index of a component of the MDSettagName - name of the tag to take the value of the
descriptor frompublic void setIdTagName(java.lang.String tagName)
tagName - name of the ID tagpublic void setFirstId(int firstId)
MDSet. If not set, ID numeration
starts from 1.
firstId - value of the of the ID of the first MDSetpublic void setCloneResult(boolean cloneResult)
next() method. If set to true
returned MDSet objects are new ones, otherswise always the
same object is reused and returned (typically, this is passed in the
constructor of the class derived from MDReader).
By default, cloning policy is set to true. This is the safer option,
though it might result in slower operation.
cloneResult - indicates cloning behaviourpublic boolean getCloneResult()
public MDSet getMDSet()
MDSet object
public void reset()
throws MDReaderException
MDSet input stream. If the stream
is not empty, the subsequent call to next( MDSet cds )
returns the first element.
MDReaderException - when failed to reset the reader
public abstract MDSet next()
throws MDReaderException
MDSet object passed as parameter.
This method should be called by the next( )
method of the derived class as the first statement. It clones the
internal MDSet instance if needed and increments the
id (if id-s are generated).
MDSet to be filled in with the next descriptor
MDReaderException - when failed reading the next descriptor set
public Molecule getMolecule()
throws MDReaderException
MDReader
subclasses can implement this method in a meaningful way, therefore it is
not an abstract method (just for the sake of ease).
MDReaderException
public abstract void close()
throws MDReaderException
MDReaderException - when failed to close the input stream
protected void createMDSetComponent(int i,
java.lang.String type,
java.lang.String settings)
throws MDParametersException
MDSet
object of the given type and specified parameter settings.
i - index of the componenttype - class name of the componentsettings - parameter settings
MDParametersException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||