org.jmol.adapter.smarter
Class SmarterJmolAdapter

java.lang.Object
  extended by org.jmol.api.JmolAdapter
      extended by org.jmol.adapter.smarter.SmarterJmolAdapter

public class SmarterJmolAdapter
extends JmolAdapter


Nested Class Summary
(package private)  class SmarterJmolAdapter.AtomIterator
           
(package private)  class SmarterJmolAdapter.BondIterator
           
 class SmarterJmolAdapter.StructureIterator
           
 
Field Summary
static java.lang.String PATH_KEY
           
static java.lang.String PATH_SEPARATOR
           
 
Fields inherited from class org.jmol.api.JmolAdapter
ORDER_AROMATIC, ORDER_AROMATIC_DOUBLE, ORDER_AROMATIC_SINGLE, ORDER_COVALENT_DOUBLE, ORDER_COVALENT_SINGLE, ORDER_COVALENT_TRIPLE, ORDER_HBOND, ORDER_PARTIAL01, ORDER_PARTIAL12, ORDER_PARTIAL23, ORDER_PARTIAL32, ORDER_STEREO_FAR, ORDER_STEREO_NEAR, ORDER_UNSPECIFIED, SHELL_D_CARTESIAN, SHELL_D_SPHERICAL, SHELL_F_CARTESIAN, SHELL_F_SPHERICAL, SHELL_L, SHELL_P, SHELL_S, SHELL_SP
 
Constructor Summary
SmarterJmolAdapter()
           
 
Method Summary
 boolean coordinatesAreFractional(java.lang.Object atomSetCollection)
          Get the boolean whether coordinates are fractional.
 void finish(java.lang.Object atomSetCollection)
           
 JmolAdapter.AtomIterator getAtomIterator(java.lang.Object atomSetCollection)
          Get an AtomIterator for retrieval of all atoms in the file.
 java.util.Hashtable getAtomSetAuxiliaryInfo(java.lang.Object atomSetCollection, int atomSetIndex)
          Get the auxiliary information for a particular atomSet.
 java.util.Hashtable getAtomSetCollectionAuxiliaryInfo(java.lang.Object atomSetCollection)
          Get the auxiliary information for this atomSetCollection.
 java.lang.Object getAtomSetCollectionFromDOM(java.lang.Object DOMNode)
           
 java.lang.Object getAtomSetCollectionFromReader(java.lang.String name, java.lang.String type, java.io.BufferedReader bufferedReader, java.util.Hashtable htParams)
          Read an atomSetCollection object from a bufferedReader and close the reader.
 java.lang.Object getAtomSetCollectionFromReaders(JmolFileReaderInterface fileReader, java.lang.String[] names, java.lang.String[] types, java.util.Hashtable[] htparamsSet)
          Associate a atomSetCollection object with an array of BufferedReader.
 java.lang.String getAtomSetCollectionName(java.lang.Object atomSetCollection)
          Get the name of the atom set collection, if known.
 java.lang.Object getAtomSetCollectionOrBufferedReaderFromZip(java.io.InputStream is, java.lang.String fileName, java.lang.String[] zipDirectory, java.util.Hashtable htParams, boolean asBufferedReader)
           
 java.util.Properties getAtomSetCollectionProperties(java.lang.Object atomSetCollection)
          Get the properties for this atomSetCollection.
 int getAtomSetCount(java.lang.Object atomSetCollection)
          Get number of atomSets in the file.
 java.lang.String getAtomSetName(java.lang.Object atomSetCollection, int atomSetIndex)
          Get the name of an atomSet.
 int getAtomSetNumber(java.lang.Object atomSetCollection, int atomSetIndex)
          Get the number identifying each atomSet.
 java.util.Properties getAtomSetProperties(java.lang.Object atomSetCollection, int atomSetIndex)
          Get the properties for an atomSet.
 JmolAdapter.BondIterator getBondIterator(java.lang.Object atomSetCollection)
          Get a BondIterator for retrieval of all bonds in the file.
 java.lang.String getClientAtomStringProperty(java.lang.Object clientAtom, java.lang.String propertyName)
          Get a property from a clientAtom.
 int getEstimatedAtomCount(java.lang.Object atomSetCollection)
          Get the estimated number of atoms contained in the file.
 java.lang.String getFileTypeName(java.lang.Object atomSetCollectionOrReader)
          Get the type of this file or molecular model, if known.
 float[] getNotionalUnitcell(java.lang.Object atomSetCollection)
          Get the notional unit cell.
 float[] getPdbScaleMatrix(java.lang.Object atomSetCollection)
          Get the PDB scale matrix.
 float[] getPdbScaleTranslate(java.lang.Object atomSetCollection)
          Get the PDB scale translation vector.
 JmolAdapter.StructureIterator getStructureIterator(java.lang.Object atomSetCollection)
          Get a StructureIterator.
 java.lang.String[] specialLoad(java.lang.String name, java.lang.String type)
           
private static java.lang.Object staticGetAtomSetCollectionFromDOM(java.lang.Object DOMNode)
           
private static java.lang.Object staticGetAtomSetCollectionFromReader(java.lang.String name, java.lang.String type, java.io.BufferedReader bufferedReader, java.util.Hashtable htParams)
           
private static java.lang.Object staticGetAtomSetCollectionFromReaders(JmolFileReaderInterface fileReader, java.lang.String[] names, java.lang.String[] types, java.util.Hashtable[] htparamsSet)
           
private static java.lang.Object staticGetAtomSetCollectionOrBufferedReaderFromZip(java.io.InputStream is, java.lang.String fileName, java.lang.String[] zipDirectory, java.util.Hashtable htParams, int subFilePtr, boolean asBufferedReader)
           
private static java.lang.String staticGetFileTypeName(java.lang.Object atomSetCollectionOrReader)
           
 
Methods inherited from class org.jmol.api.JmolAdapter
canonicalizeQuantumSubshellTag, canonizeAlphaDigit, canonizeAlternateLocationID, canonizeChainID, canonizeInsertionCode, getAdapterName, getElementNumber, getElementSymbol, getQuantumShellTagID, getQuantumShellTagIDSpherical, getQuantumSubshellTag, getQuantumSubshellTagID, isHetero, lookupGroupID, openBufferedReader, openBufferedReader, openBufferedReader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PATH_KEY

public static final java.lang.String PATH_KEY
See Also:
Constant Field Values

PATH_SEPARATOR

public static final java.lang.String PATH_SEPARATOR
Constructor Detail

SmarterJmolAdapter

public SmarterJmolAdapter()
Method Detail

finish

public void finish(java.lang.Object atomSetCollection)
Overrides:
finish in class JmolAdapter

specialLoad

public java.lang.String[] specialLoad(java.lang.String name,
                                      java.lang.String type)
Overrides:
specialLoad in class JmolAdapter

getAtomSetCollectionFromReader

public java.lang.Object getAtomSetCollectionFromReader(java.lang.String name,
                                                       java.lang.String type,
                                                       java.io.BufferedReader bufferedReader,
                                                       java.util.Hashtable htParams)
Description copied from class: JmolAdapter
Read an atomSetCollection object from a bufferedReader and close the reader.

Given the BufferedReader, return an object which represents the file contents. The parameter name is 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 the name parameter. The return value is an object which represents a atomSetCollection. This atomSetCollection will be passed back in to other methods. If the return value is instanceof String then it is considered an error condition and the returned String is the error message.

Specified by:
getAtomSetCollectionFromReader in class JmolAdapter
Parameters:
name - File name, String or URL acting as the source of the reader
type - File type, if known, or null
bufferedReader - The BufferedReader
htParams - a hash table containing parameter information
Returns:
The atomSetCollection or String with an error message

staticGetAtomSetCollectionFromReader

private static java.lang.Object staticGetAtomSetCollectionFromReader(java.lang.String name,
                                                                     java.lang.String type,
                                                                     java.io.BufferedReader bufferedReader,
                                                                     java.util.Hashtable htParams)

getAtomSetCollectionFromReaders

public java.lang.Object getAtomSetCollectionFromReaders(JmolFileReaderInterface fileReader,
                                                        java.lang.String[] names,
                                                        java.lang.String[] types,
                                                        java.util.Hashtable[] htparamsSet)
Description copied from class: JmolAdapter
Associate a atomSetCollection object with an array of BufferedReader.

Given the array of BufferedReader, return an object which represents the concatenation of every file contents. The parameter name is assumed to be the file names or URL which are the source of each reader. Note that each of 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 the name parameter. The return value is an object which represents a atomSetCollection. This atomSetCollection will be passed back in to other methods. If the return value is instanceof String then it is considered an error condition and the returned String is the error message.

Specified by:
getAtomSetCollectionFromReaders in class JmolAdapter
Parameters:
fileReader - the thread requesting a set of files if bufferedReaders is null
names - File names, String or URL acting as the source of each reader
types - File types, if known, or null
htparamsSet - The input parameters for each file to load
Returns:
The atomSetCollection or String with an error message

staticGetAtomSetCollectionFromReaders

private static java.lang.Object staticGetAtomSetCollectionFromReaders(JmolFileReaderInterface fileReader,
                                                                      java.lang.String[] names,
                                                                      java.lang.String[] types,
                                                                      java.util.Hashtable[] htparamsSet)

getAtomSetCollectionOrBufferedReaderFromZip

public java.lang.Object getAtomSetCollectionOrBufferedReaderFromZip(java.io.InputStream is,
                                                                    java.lang.String fileName,
                                                                    java.lang.String[] zipDirectory,
                                                                    java.util.Hashtable htParams,
                                                                    boolean asBufferedReader)
Specified by:
getAtomSetCollectionOrBufferedReaderFromZip in class JmolAdapter

staticGetAtomSetCollectionOrBufferedReaderFromZip

private static java.lang.Object staticGetAtomSetCollectionOrBufferedReaderFromZip(java.io.InputStream is,
                                                                                  java.lang.String fileName,
                                                                                  java.lang.String[] zipDirectory,
                                                                                  java.util.Hashtable htParams,
                                                                                  int subFilePtr,
                                                                                  boolean asBufferedReader)

getAtomSetCollectionFromDOM

public java.lang.Object getAtomSetCollectionFromDOM(java.lang.Object DOMNode)
Specified by:
getAtomSetCollectionFromDOM in class JmolAdapter

staticGetAtomSetCollectionFromDOM

private static java.lang.Object staticGetAtomSetCollectionFromDOM(java.lang.Object DOMNode)

getFileTypeName

public java.lang.String getFileTypeName(java.lang.Object atomSetCollectionOrReader)
Description copied from class: JmolAdapter
Get the type of this file or molecular model, if known.

Specified by:
getFileTypeName in class JmolAdapter
Parameters:
atomSetCollectionOrReader - The client file
Returns:
The type of this file or molecular model, default "unknown"

staticGetFileTypeName

private static java.lang.String staticGetFileTypeName(java.lang.Object atomSetCollectionOrReader)

getAtomSetCollectionName

public java.lang.String getAtomSetCollectionName(java.lang.Object atomSetCollection)
Description copied from class: JmolAdapter
Get 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 null then the JmolViewer will automatically supply the file/URL name as a default.

Specified by:
getAtomSetCollectionName in class JmolAdapter
Returns:
The atom set collection name or null

getAtomSetCollectionProperties

public java.util.Properties getAtomSetCollectionProperties(java.lang.Object atomSetCollection)
Description copied from class: JmolAdapter
Get the properties for this atomSetCollection.

Not yet implemented everywhere, it is in the smarterJmolAdapter

Specified by:
getAtomSetCollectionProperties in class JmolAdapter
Parameters:
atomSetCollection - The client file
Returns:
The properties for this atomSetCollection or null

getAtomSetCollectionAuxiliaryInfo

public java.util.Hashtable getAtomSetCollectionAuxiliaryInfo(java.lang.Object atomSetCollection)
Description copied from class: JmolAdapter
Get the auxiliary information for this atomSetCollection.

Via the smarterJmolAdapter

Specified by:
getAtomSetCollectionAuxiliaryInfo in class JmolAdapter
Parameters:
atomSetCollection - 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 atomSetCollection)
Description copied from class: JmolAdapter
Get number of atomSets in the file.

NOTE WARNING:
Not yet implemented everywhere, it is in the smarterJmolAdapter

Specified by:
getAtomSetCount in class JmolAdapter
Parameters:
atomSetCollection - The client file
Returns:
The number of atomSets in the file

getAtomSetNumber

public int getAtomSetNumber(java.lang.Object atomSetCollection,
                            int atomSetIndex)
Description copied from class: JmolAdapter
Get 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:
getAtomSetNumber in class JmolAdapter
Parameters:
atomSetCollection - The client file
atomSetIndex - 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 atomSetCollection,
                                       int atomSetIndex)
Description copied from class: JmolAdapter
Get the name of an atomSet.

Specified by:
getAtomSetName in class JmolAdapter
Parameters:
atomSetCollection - The client file
atomSetIndex - The atom set index
Returns:
The name of the atom set, default the string representation of atomSetIndex

getAtomSetProperties

public java.util.Properties getAtomSetProperties(java.lang.Object atomSetCollection,
                                                 int atomSetIndex)
Description copied from class: JmolAdapter
Get the properties for an atomSet.

Specified by:
getAtomSetProperties in class JmolAdapter
Parameters:
atomSetCollection - The client file
atomSetIndex - The atom set index
Returns:
The properties for an atom set or null

getAtomSetAuxiliaryInfo

public java.util.Hashtable getAtomSetAuxiliaryInfo(java.lang.Object atomSetCollection,
                                                   int atomSetIndex)
Description copied from class: JmolAdapter
Get the auxiliary information for a particular atomSet.

Via the smarterJmolAdapter

Specified by:
getAtomSetAuxiliaryInfo in class JmolAdapter
Parameters:
atomSetCollection - The client file
atomSetIndex - The atom set index
Returns:
The auxiliaryInfo Hashtable that may be available for particular filetypes for this atomSet or null

getEstimatedAtomCount

public int getEstimatedAtomCount(java.lang.Object atomSetCollection)
Description copied from class: JmolAdapter
Get 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:
getEstimatedAtomCount in class JmolAdapter
Parameters:
atomSetCollection - The client file
Returns:
The estimated number of atoms in the file

coordinatesAreFractional

public boolean coordinatesAreFractional(java.lang.Object atomSetCollection)
Description copied from class: JmolAdapter
Get the boolean whether coordinates are fractional.

Specified by:
coordinatesAreFractional in class JmolAdapter
Parameters:
atomSetCollection - The client file
Returns:
true if the coordinates are fractional, default false

getNotionalUnitcell

public float[] getNotionalUnitcell(java.lang.Object atomSetCollection)
Description copied from class: JmolAdapter
Get the notional unit cell.

This method returns the parameters that define a crystal unitcell the parameters are returned in a float[] in the following order a, b, c, alpha, beta, gamma
a, b, c : angstroms
alpha, beta, gamma : degrees
if there is no unit cell data then return null

Specified by:
getNotionalUnitcell in class JmolAdapter
Parameters:
atomSetCollection - The client file
Returns:
The array of the values or null

getPdbScaleMatrix

public float[] getPdbScaleMatrix(java.lang.Object atomSetCollection)
Description copied from class: JmolAdapter
Get the PDB scale matrix.

Does not seem to be overriden by any descendent

Specified by:
getPdbScaleMatrix in class JmolAdapter
Parameters:
atomSetCollection - The client file
Returns:
The array of 9 floats for the matrix or null

getPdbScaleTranslate

public float[] getPdbScaleTranslate(java.lang.Object atomSetCollection)
Description copied from class: JmolAdapter
Get the PDB scale translation vector.

Does not seem to be overriden by any descendent

Specified by:
getPdbScaleTranslate in class JmolAdapter
Parameters:
atomSetCollection - The client file
Returns:
The x, y and z translation values or null

getClientAtomStringProperty

public java.lang.String getClientAtomStringProperty(java.lang.Object clientAtom,
                                                    java.lang.String propertyName)
Description copied from class: JmolAdapter
Get a property from a clientAtom.

Specified by:
getClientAtomStringProperty in class JmolAdapter
Parameters:
clientAtom - The clientAtom
propertyName - the key of the property
Returns:
The value of the property

getAtomIterator

public JmolAdapter.AtomIterator getAtomIterator(java.lang.Object atomSetCollection)
Description copied from class: JmolAdapter
Get an AtomIterator for retrieval of all atoms in the file.

This method may not return null.

Specified by:
getAtomIterator in class JmolAdapter
Parameters:
atomSetCollection - The client file
Returns:
An AtomIterator
See Also:
JmolAdapter.AtomIterator

getBondIterator

public JmolAdapter.BondIterator getBondIterator(java.lang.Object atomSetCollection)
Description copied from class: JmolAdapter
Get a BondIterator for retrieval of all bonds in the file.

If this method returns null and no bonds are defined then the JmolViewer will automatically apply its rebonding code to build bonds between atoms.

Specified by:
getBondIterator in class JmolAdapter
Parameters:
atomSetCollection - The client file
Returns:
A BondIterator or null
See Also:
JmolAdapter.BondIterator

getStructureIterator

public JmolAdapter.StructureIterator getStructureIterator(java.lang.Object atomSetCollection)
Description copied from class: JmolAdapter
Get a StructureIterator.

Specified by:
getStructureIterator in class JmolAdapter
Parameters:
atomSetCollection - The client file
Returns:
A StructureIterator or null