public class MonomerFactory extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
ATTACHMENT_LIST_ELEMENT |
static String |
DEFAULT_NAME_SPACE |
static String |
EXTERNAL_SCHEMA_LOCATION_KEY |
static String |
MONOMER_CACHE_FILE_NAME |
static String |
MONOMER_CACHE_FILE_PATH |
static String |
MONOMER_DB_FILE_NAME |
static String |
MONOMER_DB_FILE_PATH |
static String |
MONOMER_DB_SCHEMA_RESOURCE |
static String |
MONOMER_DB_XML_RESOURCE |
protected MonomerStore |
monomerStore |
static String |
NOTATION_DIRECTORY |
static String |
POLYMER_ELEMENT |
static String |
POLYMER_LIST_ELEMENT |
static String |
POLYMER_TYPE_ATTRIBUTE |
static String |
XML_SCHEMA_VALIDATION_FEATURE |
| Modifier and Type | Method and Description |
|---|---|
void |
addNewMonomer(Monomer monomer)
To add new monomer into monomerCache
|
MonomerCache |
buildMonomerCacheFromXML(String monomerDBXML)
Build an MonomerCache object with monomerDBXML String
|
static void |
finalizeMonomerCache() |
Map<String,Attachment> |
getAttachmentDB() |
Map<String,List<String>> |
getAttachmentLabelIDs() |
Map<Monomer,Monomer> |
getConflictedMonomerMap(MonomerCache remoteMonomerCache) |
static MonomerFactory |
getInstance()
Initialize MonomerCache and returns the singleton Factory class
|
Map<String,Map<String,Monomer>> |
getMonomerDB()
retruns the monomer database
|
Map<String,Map<String,Monomer>> |
getMonomerDB(boolean includeNewMonomers)
returns the monomer database including monomers that where temporary marked
as new, else without those monomers
|
MonomerStore |
getMonomerStore()
create a MonomerStore instance based on MonomerFactory's monomerDB and
smilesMonomerDB
|
List<String> |
getMonomerTypes() |
List<String> |
getPolymerTypes() |
Map<String,Monomer> |
getSmilesMonomerDB() |
Map<String,Monomer> |
getSmilesMonomerDB(boolean includeNewMonomers) |
static boolean |
hasDBChanged()
Returns whether one of the stored databases has changed, for example by
adding or removing monomers.
|
void |
merge(MonomerCache remoteMonomerCache)
merge remote monomerCache with local monomerCache, will throw exception if
conflicts found.
|
static void |
refreshMonomerCache() |
static void |
resetDBChanged() |
void |
saveMonomerCache()
save monomerCache to disk file
|
static void |
setDBChanged(boolean isChanged) |
void |
setMonomerCache(MonomerCache remoteMonomerCache)
replace local cache with remote one completely, may cause loss of data
|
static void |
setupBuilder() |
public static final String NOTATION_DIRECTORY
public static final String MONOMER_CACHE_FILE_NAME
public static final String MONOMER_CACHE_FILE_PATH
public static final String MONOMER_DB_FILE_NAME
public static final String MONOMER_DB_FILE_PATH
public static final String MONOMER_DB_XML_RESOURCE
public static final String MONOMER_DB_SCHEMA_RESOURCE
public static final String XML_SCHEMA_VALIDATION_FEATURE
public static final String EXTERNAL_SCHEMA_LOCATION_KEY
public static final String DEFAULT_NAME_SPACE
public static final String POLYMER_LIST_ELEMENT
public static final String POLYMER_ELEMENT
public static final String POLYMER_TYPE_ATTRIBUTE
public static final String ATTACHMENT_LIST_ELEMENT
protected MonomerStore monomerStore
public Map<String,Map<String,Monomer>> getMonomerDB()
Map<String, Map<String, Monomer>>public Map<String,Map<String,Monomer>> getMonomerDB(boolean includeNewMonomers)
includeNewMonomers - if true, then the new monomers will be added to the monomer dbMap<String, Map<String, Monomer>>public MonomerStore getMonomerStore()
public Map<String,Attachment> getAttachmentDB()
public static void setupBuilder()
public static MonomerFactory getInstance() throws MonomerLoadingException, ChemistryException
MonomerLoadingException - if the monomer could not be loaded from the sourceChemistryException - if the chemistry could not be initializedpublic static void refreshMonomerCache()
throws MonomerLoadingException,
ChemistryException
public static void setDBChanged(boolean isChanged)
public static boolean hasDBChanged()
public static void resetDBChanged()
public void addNewMonomer(Monomer monomer) throws IOException, MonomerException
monomer - given MonomerIOException - if monomer store can not be readMonomerException - if monomer is not validpublic MonomerCache buildMonomerCacheFromXML(String monomerDBXML) throws MonomerException, IOException, org.jdom2.JDOMException, ChemistryException, org.helm.chemtoolkit.CTKException
monomerDBXML - monomer db in xml format as stringMonomerException - if monomer is not validIOException - if string can not be readorg.jdom2.JDOMException - if xml file is not validChemistryException - if chemistry could not be initializedorg.helm.chemtoolkit.CTKException - general ChemToolKit exception passed to HELMToolKitpublic void merge(MonomerCache remoteMonomerCache) throws IOException, MonomerException
remoteMonomerCache - remote monomer cacheIOException - if monomer store can not be readMonomerException - if monomer is not validpublic void setMonomerCache(MonomerCache remoteMonomerCache) throws IOException, MonomerException
remoteMonomerCache - remote monomer cacheIOException - if monomer store can not be readMonomerException - if monomer is not validpublic Map<Monomer,Monomer> getConflictedMonomerMap(MonomerCache remoteMonomerCache) throws IOException, MonomerException
remoteMonomerCache - remoteMonomerCacheIOException - if monomer store can not be readMonomerException - if monomer is not validpublic void saveMonomerCache()
throws IOException,
MonomerException
IOException - if the monomer can not be saved to disk fileMonomerException - if monomer is not validpublic static void finalizeMonomerCache()
Copyright © 2017. All rights reserved.