public class MolsRes extends Object implements Described, HasSizeinfo
Constructor and Description |
---|
MolsRes(String description,
long time,
MasterMoleculeStorage mms,
MasterStorage<String> id,
Map<String,MolProp<?>> propsOrNull)
Construct.
|
Modifier and Type | Method and Description |
---|---|
int |
findId(String id_to_find)
Find ID.
|
String |
forceSmilesWithId(int index) |
static byte[] |
generatePlaceholderPng(int w,
int h)
Generate a placeholder image.
|
Set<String> |
getAllPropNames()
Return all property names.
|
String |
getDescription()
Human readable description of the instance.
|
Optional<String> |
getId(int index)
Get ID.
|
Optional<Molecule> |
getMol(int index)
Get molecule.
|
MoleculeInfo |
getMolInfo(String setUrl,
int index,
boolean smiles)
Fill single molecule info.
|
MoleculeInfo |
getMolInfo(String setUrl,
int index,
boolean smiles,
boolean props)
Fill single molecule info.
|
Optional<byte[]> |
getPng(int index,
int w,
int h)
Get PNG of molecule if present.
|
Optional<byte[]> |
getPng(int index,
Sink<Molecule> preprocessOrNull,
int w,
int h)
Get PNG of molecule if present.
|
MolProp<?> |
getProp(String name)
Get an additional property container.
|
MoleculeSetInfo |
getSetInfo(String setUrl,
String setName)
Fill molecule set info.
|
long |
getSize()
Size of the represented resource.
|
SizeInfoDto |
getSizeInfo(Function<Object,Long> sizeof,
Function<Object,Long> sizeof2)
Invoke size calculation.
|
Optional<String> |
getSmiles(int index)
Get SMILES source.
|
long |
getTime()
Init/load/prepare time of the represented resource.
|
int |
size()
Size of storages.
|
public MolsRes(String description, long time, MasterMoleculeStorage mms, MasterStorage<String> id, Map<String,MolProp<?>> propsOrNull)
description
- Description of the current instancetime
- Associated init/create/load timemms
- Exposed master molecule storageid
- Exposed master ID storagepropsOrNull
- Additional properties or null
public SizeInfoDto getSizeInfo(Function<Object,Long> sizeof, Function<Object,Long> sizeof2)
HasSizeinfo
getSizeInfo
in interface HasSizeinfo
sizeof
- Function for deep size calculation, expected to handle NoSize
annotations.sizeof2
- Function for deep size calculation of the large storagespublic int size()
public Set<String> getAllPropNames()
public MolProp<?> getProp(String name)
name
- Property namenull
when the given property is not presentpublic Optional<String> getId(int index) throws WuiNotFoundException
index
- IndexWuiNotFoundException
public int findId(String id_to_find) throws WuiNotFoundException
id_to_find
- ID to findWuiNotFoundException
- When ID not foundpublic Optional<Molecule> getMol(int index)
index
- Indexpublic Optional<String> getSmiles(int index)
index
- Indexpublic static byte[] generatePlaceholderPng(int w, int h)
w
- Image widthh
- Image heightpublic Optional<byte[]> getPng(int index, Sink<Molecule> preprocessOrNull, int w, int h)
index
- Molecule indexpreprocessOrNull
- Optional preprocess of the sturcturew
- Image widthh
- Image heightpublic Optional<byte[]> getPng(int index, int w, int h)
index
- Molecule indexw
- Image widthh
- Image heightpublic String forceSmilesWithId(int index) throws WuiNotFoundException
WuiNotFoundException
public String getDescription()
Described
getDescription
in interface Described
public MoleculeSetInfo getSetInfo(String setUrl, String setName)
setUrl
- URL of this
molecule set resource.setName
- Name of this
molecule set resource.public MoleculeInfo getMolInfo(String setUrl, int index, boolean smiles) throws WuiNotFoundException
setUrl
- URL of this
molecule set resourceindex
- Index of the structuresmiles
- If false no smiles lookup will be madeWuiNotFoundException
public MoleculeInfo getMolInfo(String setUrl, int index, boolean smiles, boolean props) throws WuiNotFoundException
setUrl
- URL of this
molecule set resourceindex
- Index of the structuresmiles
- If false
no smiles lookup will be madeprops
- If no properties will be includedWuiNotFoundException
public long getSize()
Described
getSize
in interface Described
ResourceInfo.sizeDescription()