Package chemaxon.jep.context
Class MolContext
- java.lang.Object
-
- chemaxon.jep.context.MolContext
-
- All Implemented Interfaces:
ChemContext
,chemaxon.marvin.util.CallbackIface
,Serializable
- Direct Known Subclasses:
AtomContext
@PublicAPI public class MolContext extends Object implements ChemContext
Expression evaluation context containing a single molecule. Provides function names for accessing context elements through theCallbackIface
.- Since:
- JChem 2.2, Marvin 5.1
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description MolContext()
Constructor.MolContext(Molecule m)
Creates a MolContext with the given input molecule.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
callback(String method, Object arg)
ImplementsCallbackIface
.void
clear()
Clears the context.String[]
getContextFunctionNames()
Returns {"mol", "fingerprint"}.int[]
getFingerprint()
Returns the input molecule fingerprint.protected int[]
getFingerprint(Object arg)
Returns the input molecule fingerprint if argument is the input molecule,null
otherwise.Molecule
getMolecule()
Returns the input molecule.void
setFingerprint(int[] fingerprint)
Sets the fingerprint of the input molecule.void
setMolecule(Molecule mol)
Sets the input molecule.void
setSupplier(com.google.common.base.Supplier<Molecule> supplier)
-
-
-
Constructor Detail
-
MolContext
public MolContext()
Constructor.
-
MolContext
public MolContext(Molecule m)
Creates a MolContext with the given input molecule.- Since:
- Marvin 5.2
-
-
Method Detail
-
getContextFunctionNames
public String[] getContextFunctionNames()
Returns {"mol", "fingerprint"}. This is the accessor function name for getting the molecule.- Specified by:
getContextFunctionNames
in interfaceChemContext
- Returns:
- {"mol", "fingerprint"}
-
callback
public Object callback(String method, Object arg)
ImplementsCallbackIface
. Returnsnull
for unimplemented callbacks. Implemented callbacks:method arg return value "mol" null
the input molecule "fingerprint" null
the input molecule fingerprint - Specified by:
callback
in interfacechemaxon.marvin.util.CallbackIface
- Specified by:
callback
in interfaceChemContext
- Parameters:
method
- is the accessor method namearg
- is the accessor method argument (the JEP parameter stack asnull
, a single parameter object or a parameter object array depending on the number of parameters on the stack)- Returns:
- the context element
-
setMolecule
public void setMolecule(Molecule mol)
Sets the input molecule.- Parameters:
mol
- is the input molecule
-
setSupplier
public void setSupplier(com.google.common.base.Supplier<Molecule> supplier)
-
getMolecule
public Molecule getMolecule()
Returns the input molecule.- Returns:
- the input molecule
-
setFingerprint
public void setFingerprint(int[] fingerprint)
Sets the fingerprint of the input molecule.- Parameters:
fingerprint
- is the fingerprint
-
getFingerprint
public int[] getFingerprint()
Returns the input molecule fingerprint.- Returns:
- the input molecule fingerprint
-
getFingerprint
protected int[] getFingerprint(Object arg)
Returns the input molecule fingerprint if argument is the input molecule,null
otherwise.- Parameters:
arg
- is the argument to be checked against the input molecule- Returns:
- the input molecule fingerprint or
null
-
clear
public void clear()
Clears the context.- Specified by:
clear
in interfaceChemContext
-
-