chemaxon.marvin.io
Class MFieldAccessor

java.lang.Object
  extended by chemaxon.marvin.io.MFieldAccessor

public abstract class MFieldAccessor
extends java.lang.Object

Abstract class for extracting fields (properties) from input and storing them. Under development, please do not implement it yet!

Since:
Marvin 5.0, 11/08/2007
Version:
5.0, 11/12/2007
Author:
Peter Csizmadia, Tamas Vertse

Constructor Summary
MFieldAccessor()
           
 
Method Summary
abstract  void getFields(int irec, Molecule mol, java.lang.String[] keys, MProp[] values)
          Extracts properties.
abstract  java.lang.String[] getKeys(int irec, Molecule mol)
          Gets the keys in a record.
abstract  Molecule getMainMolecule(int irec, Molecule mol)
          Gets the main molecule object in a record.
abstract  boolean isEditable(int irec, Molecule mol, java.lang.String key)
          Tests whether a field is editable or not.
protected  java.lang.String propToString(MProp p)
          Converts a property to a string.
 void setField(int irec, Molecule mol, java.lang.String key, MProp p)
          Sets a property.
abstract  void setFields(int irec, Molecule mol, java.lang.String[] keys, MProp[] values)
          Sets properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MFieldAccessor

public MFieldAccessor()
Method Detail

getMainMolecule

public abstract Molecule getMainMolecule(int irec,
                                         Molecule mol)
Gets the main molecule object in a record.

Parameters:
irec - the record number
mol - input molecule, may be null in case of an implementation for which the record number is enough
Returns:
the main molecule object or null if it does not exist

getKeys

public abstract java.lang.String[] getKeys(int irec,
                                           Molecule mol)
Gets the keys in a record.

Parameters:
irec - the record number
mol - input molecule, may be null in case of an implementation for which the record number is enough
Returns:
the array of keys

getFields

public abstract void getFields(int irec,
                               Molecule mol,
                               java.lang.String[] keys,
                               MProp[] values)
Extracts properties.

Parameters:
irec - the record number
mol - input molecule, may be null in case of an implementation for which the record number is enough
keys - array of field keys
values - the output array, may contain null if a property is not found

setFields

public abstract void setFields(int irec,
                               Molecule mol,
                               java.lang.String[] keys,
                               MProp[] values)
Sets properties.

Parameters:
irec - the record number
mol - input molecule, may be null in case of an implementation for which the record number is enough
keys - array of field keys
values - array of values

isEditable

public abstract boolean isEditable(int irec,
                                   Molecule mol,
                                   java.lang.String key)
Tests whether a field is editable or not.

Parameters:
irec - the record number
mol - input molecule, may be null in case of an implementation for which the record number is enough
key - the field key
Returns:
true if setFields works for this key, false otherwise

setField

public final void setField(int irec,
                           Molecule mol,
                           java.lang.String key,
                           MProp p)
Sets a property.

Parameters:
irec - the record number
mol - input molecule, may be null in case of an implementation for which the record number is enough
key - the field key
p - the property value

propToString

protected java.lang.String propToString(MProp p)
Converts a property to a string. Utility method called by implementations.

Parameters:
p - the property
Returns:
the string value