Class SmarterJmolAdapter
- java.lang.Object
-
- org.jmol.api.JmolAdapter
-
- org.jmol.adapter.smarter.SmarterJmolAdapter
-
public class SmarterJmolAdapter extends JmolAdapter
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringPATH_KEYAtomSetCollectionReader.readData() will close any BufferedReaderstatic java.lang.StringPATH_SEPARATOR-
Fields inherited from class org.jmol.api.JmolAdapter
cellParamNames, ORDER_AROMATIC, ORDER_AROMATIC_DOUBLE, ORDER_AROMATIC_SINGLE, ORDER_COVALENT_DOUBLE, ORDER_COVALENT_QUAD, ORDER_COVALENT_SINGLE, ORDER_COVALENT_TRIPLE, ORDER_HBOND, ORDER_PARTIAL01, ORDER_PARTIAL12, ORDER_PARTIAL23, ORDER_PARTIAL32, ORDER_PYMOL_MULT, ORDER_PYMOL_SINGLE, ORDER_STEREO_FAR, ORDER_STEREO_NEAR, ORDER_UNSPECIFIED
-
-
Constructor Summary
Constructors Constructor Description SmarterJmolAdapter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidclose(java.lang.Object bufferedReader)booleancoordinatesAreFractional(java.lang.Object asc)Get the boolean whether coordinates are fractional.voidfinish(java.lang.Object asc)intgetAtomCount(java.lang.Object asc)Get the estimated number of atoms contained in the file.JmolAdapterAtomIteratorgetAtomIterator(java.lang.Object asc)Get an AtomIterator for retrieval of all atoms in the file.java.util.Map<java.lang.String,java.lang.Object>getAtomSetAuxiliaryInfo(java.lang.Object asc, int atomSetIndex)Get the auxiliary information for a particular atomSet.java.lang.ObjectgetAtomSetCollection(java.lang.Object ascReader)Create the AtomSetCollection and return itjava.util.Map<java.lang.String,java.lang.Object>getAtomSetCollectionAuxiliaryInfo(java.lang.Object asc)Get the auxiliary information for this atomSetCollection.java.lang.ObjectgetAtomSetCollectionFromDOM(java.lang.Object DOMNode, java.util.Map<java.lang.String,java.lang.Object> htParams)Direct DOM HTML4 page reading; Egon was interested in this at one point.java.lang.ObjectgetAtomSetCollectionFromReader(java.lang.String fname, java.lang.Object readerOrDocument, java.util.Map<java.lang.String,java.lang.Object> htParams)java.lang.ObjectgetAtomSetCollectionFromSet(java.lang.Object readerSet, java.lang.Object atomsets, java.util.Map<java.lang.String,java.lang.Object> htParams)needed to consolidate a set of models into one model; could start with AtomSetCollectionReader[] or with AtomSetCollection[]java.lang.StringgetAtomSetCollectionName(java.lang.Object asc)Get the name of the atom set collection, if known.java.lang.ObjectgetAtomSetCollectionReader(java.lang.String name, java.lang.String type, java.lang.Object bufferedReader, java.util.Map<java.lang.String,java.lang.Object> htParams)Read an atomSetCollection object from a bufferedReader and close the reader.java.lang.ObjectgetAtomSetCollectionReaders(JmolFilesReaderInterface filesReader, java.lang.String[] names, java.lang.String[] types, java.util.Map<java.lang.String,java.lang.Object> htParams, boolean getReadersOnly)primary for String[] or File[] reading -- two options are implemented --- return a set of simultaneously open readers, or return one single collection using a single readerintgetAtomSetCount(java.lang.Object asc)Get number of atomSets in the file.java.lang.StringgetAtomSetName(java.lang.Object asc, int atomSetIndex)Get the name of an atomSet.intgetAtomSetNumber(java.lang.Object asc, int atomSetIndex)Get the number identifying each atomSet.JmolAdapterBondIteratorgetBondIterator(java.lang.Object asc)Get a BondIterator for retrieval of all bonds in the file.java.lang.String[][]getBondList(java.lang.Object asc)java.lang.StringgetFileTypeName(java.lang.Object ascOrReader)Just get the resolved file type; if a file, does NOT close the readerintgetHydrogenAtomCount(java.lang.Object asc)Get the hydrogen atom count -- for ligand filesJmolAdapterStructureIteratorgetStructureIterator(java.lang.Object asc)Get a StructureIterator.static java.lang.ObjectstaticGetAtomSetCollection(AtomSetCollectionReader a)static java.lang.ObjectstaticGetAtomSetCollectionReader(java.lang.String name, java.lang.String type, java.lang.Object bufferedReader, java.util.Map<java.lang.String,java.lang.Object> htParams)The primary file or string reader -- returns just the reader now-
Methods inherited from class org.jmol.api.JmolAdapter
canonizeAlternateLocationID, canonizeInsertionCode, getAtomSetCollectionFromReaderType, getBondingRadius, getElementNumber, getElementSymbol, getNaturalIsotope, openBufferedReader, openBufferedReader, openBufferedReader
-
-
-
-
Field Detail
-
PATH_KEY
public static final java.lang.String PATH_KEY
AtomSetCollectionReader.readData() will close any BufferedReader- See Also:
- Constant Field Values
-
PATH_SEPARATOR
public static final java.lang.String PATH_SEPARATOR
-
-
Method Detail
-
getFileTypeName
public java.lang.String getFileTypeName(java.lang.Object ascOrReader)
Just get the resolved file type; if a file, does NOT close the reader- Specified by:
getFileTypeNamein classJmolAdapter- Parameters:
ascOrReader-- Returns:
- a file type or null
-
getAtomSetCollectionReader
public java.lang.Object getAtomSetCollectionReader(java.lang.String name, java.lang.String type, java.lang.Object bufferedReader, java.util.Map<java.lang.String,java.lang.Object> htParams)Description copied from class:JmolAdapterRead an atomSetCollection object from a bufferedReader and close the reader.Given the BufferedReader, return an object which represents the file contents. The parameter
nameis assumed to be the file name or URL which is the source of reader. Note that this 'file' may have been automatically decompressed. Also note that the name may be 'String', representing a string constant. Therefore, few assumptions should be made about thenameparameter. The return value is an object which represents aatomSetCollection. ThisatomSetCollectionwill be passed back in to other methods. If the return value isinstanceof Stringthen it is considered an error condition and the returned String is the error message.- Specified by:
getAtomSetCollectionReaderin classJmolAdapter- Parameters:
name- File name, String or URL acting as the source of the readertype- File type, if known, or nullbufferedReader- The BufferedReaderhtParams- a hash table containing parameter information- Returns:
- The atomSetCollection or String with an error message
-
staticGetAtomSetCollectionReader
public static java.lang.Object staticGetAtomSetCollectionReader(java.lang.String name, java.lang.String type, java.lang.Object bufferedReader, java.util.Map<java.lang.String,java.lang.Object> htParams)The primary file or string reader -- returns just the reader now- Parameters:
name-type-bufferedReader-htParams-- Returns:
- an AtomSetCollectionReader or an error string
-
getAtomSetCollectionFromReader
public java.lang.Object getAtomSetCollectionFromReader(java.lang.String fname, java.lang.Object readerOrDocument, java.util.Map<java.lang.String,java.lang.Object> htParams) throws java.lang.Exception- Specified by:
getAtomSetCollectionFromReaderin classJmolAdapter- Throws:
java.lang.Exception
-
getAtomSetCollection
public java.lang.Object getAtomSetCollection(java.lang.Object ascReader)
Create the AtomSetCollection and return it- Specified by:
getAtomSetCollectionin classJmolAdapter- Parameters:
ascReader-- Returns:
- an AtomSetCollection or an error string
-
staticGetAtomSetCollection
public static java.lang.Object staticGetAtomSetCollection(AtomSetCollectionReader a)
-
getAtomSetCollectionReaders
public java.lang.Object getAtomSetCollectionReaders(JmolFilesReaderInterface filesReader, java.lang.String[] names, java.lang.String[] types, java.util.Map<java.lang.String,java.lang.Object> htParams, boolean getReadersOnly)
primary for String[] or File[] reading -- two options are implemented --- return a set of simultaneously open readers, or return one single collection using a single reader- Specified by:
getAtomSetCollectionReadersin classJmolAdapter- Parameters:
filesReader-names-types-htParams-getReadersOnly- TRUE for a set of readers; FALSE for one asc- Returns:
- a set of AtomSetCollectionReaders, a single AtomSetCollection, or an error string
-
getAtomSetCollectionFromSet
public java.lang.Object getAtomSetCollectionFromSet(java.lang.Object readerSet, java.lang.Object atomsets, java.util.Map<java.lang.String,java.lang.Object> htParams)needed to consolidate a set of models into one model; could start with AtomSetCollectionReader[] or with AtomSetCollection[]- Specified by:
getAtomSetCollectionFromSetin classJmolAdapter- Parameters:
readerSet-atomsets-htParams-- Returns:
- a single AtomSetCollection or an error string
-
getAtomSetCollectionFromDOM
public java.lang.Object getAtomSetCollectionFromDOM(java.lang.Object DOMNode, java.util.Map<java.lang.String,java.lang.Object> htParams)Direct DOM HTML4 page reading; Egon was interested in this at one point.- Specified by:
getAtomSetCollectionFromDOMin classJmolAdapter- Parameters:
DOMNode-htParams-- Returns:
- a single AtomSetCollection or an error string
-
finish
public void finish(java.lang.Object asc)
- Specified by:
finishin classJmolAdapter
-
getAtomSetCollectionName
public java.lang.String getAtomSetCollectionName(java.lang.Object asc)
Description copied from class:JmolAdapterGet the name of the atom set collection, if known.Some file formats contain a formal name of the molecule in the file. If this method returns
nullthen the JmolViewer will automatically supply the file/URL name as a default.- Specified by:
getAtomSetCollectionNamein classJmolAdapter- Returns:
- The atom set collection name or
null
-
getAtomSetCollectionAuxiliaryInfo
public java.util.Map<java.lang.String,java.lang.Object> getAtomSetCollectionAuxiliaryInfo(java.lang.Object asc)
Description copied from class:JmolAdapterGet the auxiliary information for this atomSetCollection.Via the smarterJmolAdapter
- Specified by:
getAtomSetCollectionAuxiliaryInfoin classJmolAdapter- Parameters:
asc- The client file- Returns:
- The auxiliaryInfo Hashtable that may be available for particular
filetypes for this atomSetCollection or
null
-
getAtomSetCount
public int getAtomSetCount(java.lang.Object asc)
Description copied from class:JmolAdapterGet number of atomSets in the file.NOTE WARNING:
Not yet implemented everywhere, it is in the smarterJmolAdapter- Specified by:
getAtomSetCountin classJmolAdapter- Parameters:
asc- The client file- Returns:
- The number of atomSets in the file
-
getAtomSetNumber
public int getAtomSetNumber(java.lang.Object asc, int atomSetIndex)Description copied from class:JmolAdapterGet the number identifying each atomSet.For a PDB file, this is is the model number. For others it is a 1-based atomSet number.
Note that this is not currently implemented in PdbReader
- Specified by:
getAtomSetNumberin classJmolAdapter- Parameters:
asc- The client fileatomSetIndex- The atom set's index for which to get the atom set number- Returns:
- The number identifying each atom set.
-
getAtomSetName
public java.lang.String getAtomSetName(java.lang.Object asc, int atomSetIndex)Description copied from class:JmolAdapterGet the name of an atomSet.- Specified by:
getAtomSetNamein classJmolAdapter- Parameters:
asc- The client fileatomSetIndex- The atom set index- Returns:
- The name of the atom set, default the string representation of atomSetIndex
-
getAtomSetAuxiliaryInfo
public java.util.Map<java.lang.String,java.lang.Object> getAtomSetAuxiliaryInfo(java.lang.Object asc, int atomSetIndex)Description copied from class:JmolAdapterGet the auxiliary information for a particular atomSet.Via the smarterJmolAdapter
- Specified by:
getAtomSetAuxiliaryInfoin classJmolAdapter- Parameters:
asc- The client fileatomSetIndex- The atom set index- Returns:
- The auxiliaryInfo Hashtable that may be available for particular
filetypes for this atomSet or
null
-
getHydrogenAtomCount
public int getHydrogenAtomCount(java.lang.Object asc)
Description copied from class:JmolAdapterGet the hydrogen atom count -- for ligand files- Specified by:
getHydrogenAtomCountin classJmolAdapter- Returns:
- number of hydrogen atoms in this model
-
getBondList
public java.lang.String[][] getBondList(java.lang.Object asc)
- Specified by:
getBondListin classJmolAdapter- Returns:
- [ [atomName1 atomName2 order] ...]
-
getAtomCount
public int getAtomCount(java.lang.Object asc)
Description copied from class:JmolAdapterGet the estimated number of atoms contained in the file.Just return -1 if you don't know (or don't want to figure it out)
- Specified by:
getAtomCountin classJmolAdapter- Parameters:
asc- The client file- Returns:
- The estimated number of atoms in the file
-
coordinatesAreFractional
public boolean coordinatesAreFractional(java.lang.Object asc)
Description copied from class:JmolAdapterGet the boolean whether coordinates are fractional.- Specified by:
coordinatesAreFractionalin classJmolAdapter- Parameters:
asc- The client file- Returns:
- true if the coordinates are fractional, default
false
-
getAtomIterator
public JmolAdapterAtomIterator getAtomIterator(java.lang.Object asc)
Description copied from class:JmolAdapterGet an AtomIterator for retrieval of all atoms in the file.This method may not return
null.- Specified by:
getAtomIteratorin classJmolAdapter- Parameters:
asc- The client file- Returns:
- An AtomIterator
- See Also:
JmolAdapterAtomIterator
-
getBondIterator
public JmolAdapterBondIterator getBondIterator(java.lang.Object asc)
Description copied from class:JmolAdapterGet a BondIterator for retrieval of all bonds in the file.If this method returns
nulland no bonds are defined then the JmolViewer will automatically apply its rebonding code to build bonds between atoms.- Specified by:
getBondIteratorin classJmolAdapter- Parameters:
asc- The client file- Returns:
- A BondIterator or
null - See Also:
JmolAdapterBondIterator
-
getStructureIterator
public JmolAdapterStructureIterator getStructureIterator(java.lang.Object asc)
Description copied from class:JmolAdapterGet a StructureIterator.- Specified by:
getStructureIteratorin classJmolAdapter- Parameters:
asc- The client file- Returns:
- A StructureIterator or
null
-
close
public static void close(java.lang.Object bufferedReader) throws java.io.IOException- Throws:
java.io.IOException
-
-