# 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 final String`
`PATH_KEY`
AtomSetCollectionReader.readData() will close any BufferedReader
`static final String`
`PATH_SEPARATOR`

### Fields inherited from class JmolAdapter

`cellParamNames, ORDER_AROMATIC, ORDER_AROMATIC_DOUBLE, ORDER_AROMATIC_SINGLE, ORDER_COVALENT_DOUBLE, ORDER_COVALENT_HEX, ORDER_COVALENT_QUAD, ORDER_COVALENT_QUINT, ORDER_COVALENT_SINGLE, ORDER_COVALENT_TRIPLE, ORDER_HBOND, ORDER_PARTIAL01, ORDER_PARTIAL12, ORDER_PARTIAL23, ORDER_PARTIAL32, ORDER_PYMOL_MULT, ORDER_PYMOL_SINGLE, ORDER_STEREO_EITHER, ORDER_STEREO_FAR, ORDER_STEREO_NEAR, ORDER_UNSPECIFIED`

## Constructor Summary

Constructors
Constructor
Description
`SmarterJmolAdapter()`

## Method Summary

Modifier and Type
Method
Description
`static void`
`close(Object bufferedReader)`
`boolean`
`coordinatesAreFractional(Object asc)`
Get the boolean whether coordinates are fractional.
`void`
`finish(Object asc)`
`int`
`getAtomCount(Object asc, int atomSetIndex)`
Get the number of atoms contained in the file.
`JmolAdapterAtomIterator`
`getAtomIterator(Object asc)`
/////////////////////////////////////////////////////////////
`Map<String,Object>`
`getAtomSetAuxiliaryInfo(Object asc, int atomSetIndex)`
Get the auxiliary information for a particular atomSet.
`Object`
`getAtomSetCollection(Object ascReader)`
Create the AtomSetCollection and return it
`Map<String,Object>`
`getAtomSetCollectionAuxiliaryInfo(Object asc)`
Get the auxiliary information for this atomSetCollection.
`Object`
`getAtomSetCollectionFromDOM(Object DOMNode, Map<String,Object> htParams)`
Direct DOM HTML4 page reading; Egon was interested in this at one point.
`Object`
`getAtomSetCollectionFromReader(String fname, Object readerOrDocument, Map<String,Object> htParams)`
`Object`
`getAtomSetCollectionFromSet(Object readerSet, Object atomsets, Map<String,Object> htParams)`
needed to consolidate a set of models into one model; could start with AtomSetCollectionReader[] or with AtomSetCollection[]
`Object`
`getAtomSetCollectionInline(Object molData, Map<String,Object> htParams)`
`String`
`getAtomSetCollectionName(Object asc)`
/////////////////////// post processing ////////////////////////////
`Object`
`getAtomSetCollectionReader(String name, String type, Object bufferedReader, Map<String,Object> htParams)`
Read an atomSetCollection object from a bufferedReader and close the reader.
`Object`
`getAtomSetCollectionReaders(JmolFilesReaderInterface filesReader, String[] names, String[] types, Map<String,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
`int`
`getAtomSetCount(Object asc)`
Get number of atomSets in the file or specific model index in file
`String`
`getAtomSetName(Object asc, int atomSetIndex)`
Get the name of an atomSet.
`int`
`getAtomSetNumber(Object asc, int atomSetIndex)`
Get the number identifying each atomSet.
`JmolAdapterBondIterator`
`getBondIterator(Object asc)`
Get a BondIterator for retrieval of all bonds in the file.
`String[][]`
`getBondList(Object asc)`
`String`
`getFileTypeName(Object ascOrReader)`
Just get the resolved file type; if a file, does NOT close the reader
`int`
`getHydrogenAtomCount(Object asc)`
Get the hydrogen atom count -- for ligand files
`JmolAdapterStructureIterator`
`getStructureIterator(Object asc)`
Get a StructureIterator.
`static Object`
`staticGetAtomSetCollection(AtomSetCollectionReader a)`
`static Object`
`staticGetAtomSetCollectionReader(String name, String type, Object bufferedReader, Map<String,Object> htParams)`
The primary file or string reader -- returns just the reader now

### Methods inherited from class JmolAdapter

`canonizeAlternateLocationID, canonizeInsertionCode, getAtomSetCollectionFromReaderType, getBondingRadius, getElementNumber, getElementSymbol, getNaturalIsotope, openBufferedReader, openBufferedReader, openBufferedReader`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### PATH_KEY

public static final String PATH_KEY
AtomSetCollectionReader.readData() will close any BufferedReader

See Also:
  - Constant Field Values

### PATH_SEPARATOR

public static final String PATH_SEPARATOR

## Constructor Details

### SmarterJmolAdapter

public SmarterJmolAdapter()

## Method Details

### getFileTypeName

public String getFileTypeName(Object ascOrReader)
Just get the resolved file type; if a file, does NOT close the reader

Specified by:
  `getFileTypeName` in class `JmolAdapter`
Parameters:
  `ascOrReader` -
Returns:
  a file type or null

### getAtomSetCollectionReader

public Object getAtomSetCollectionReader(String name, String type, Object bufferedReader, Map<String,Object> 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:
  `getAtomSetCollectionReader` 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

### staticGetAtomSetCollectionReader

public static Object staticGetAtomSetCollectionReader(String name, String type, Object bufferedReader, Map<String,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 Object getAtomSetCollectionFromReader(String fname, Object readerOrDocument, Map<String,Object> htParams) throws Exception

Specified by:
  `getAtomSetCollectionFromReader` in class `JmolAdapter`
Throws:
  `Exception`

### getAtomSetCollection

public Object getAtomSetCollection(Object ascReader)
Create the AtomSetCollection and return it

Specified by:
  `getAtomSetCollection` in class `JmolAdapter`
Parameters:
  `ascReader` -
Returns:
  an AtomSetCollection or an error string

### staticGetAtomSetCollection

public static Object staticGetAtomSetCollection(AtomSetCollectionReader a)

### getAtomSetCollectionReaders

public Object getAtomSetCollectionReaders(JmolFilesReaderInterface filesReader, String[] names, String[] types, Map<String,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:
  `getAtomSetCollectionReaders` in class `JmolAdapter`
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 Object getAtomSetCollectionFromSet(Object readerSet, Object atomsets, Map<String,Object> htParams)
needed to consolidate a set of models into one model; could start with AtomSetCollectionReader[] or with AtomSetCollection[]

Specified by:
  `getAtomSetCollectionFromSet` in class `JmolAdapter`
Parameters:
  `readerSet` -
  `atomsets` -
  `htParams` -
Returns:
  a single AtomSetCollection or an error string

### getAtomSetCollectionFromDOM

public Object getAtomSetCollectionFromDOM(Object DOMNode, Map<String,Object> htParams)
Direct DOM HTML4 page reading; Egon was interested in this at one point.

Specified by:
  `getAtomSetCollectionFromDOM` in class `JmolAdapter`
Parameters:
  `DOMNode` -
  `htParams` -
Returns:
  a single AtomSetCollection or an error string

### finish

public void finish(Object asc)

Specified by:
  `finish` in class `JmolAdapter`
Parameters:
  `asc` -

### getAtomSetCollectionName

public String getAtomSetCollectionName(Object asc)
/////////////////////// post processing ////////////////////////////

Specified by:
  `getAtomSetCollectionName` in class `JmolAdapter`
Parameters:
  `asc` -
Returns:
  The atom set collection name or `null`

### getAtomSetCollectionAuxiliaryInfo

public Map<String,Object> getAtomSetCollectionAuxiliaryInfo(Object asc)
Description copied from class: `JmolAdapter`
Get the auxiliary information for this atomSetCollection.

Via the smarterJmolAdapter

Specified by:
  `getAtomSetCollectionAuxiliaryInfo` in class `JmolAdapter`
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(Object asc)
Description copied from class: `JmolAdapter`
Get number of atomSets in the file or specific model index in file

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

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

### getAtomSetNumber

public int getAtomSetNumber(Object asc, 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:
  `asc` - 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 String getAtomSetName(Object asc, int atomSetIndex)
Description copied from class: `JmolAdapter`
Get the name of an atomSet.

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

### getAtomSetAuxiliaryInfo

public Map<String,Object> getAtomSetAuxiliaryInfo(Object asc, 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:
  `asc` - The client file
  `atomSetIndex` - The atom set index
Returns:
  The auxiliaryInfo Hashtable that may be available for particular filetypes for this atomSet or `null`

### getHydrogenAtomCount

public int getHydrogenAtomCount(Object asc)
Description copied from class: `JmolAdapter`
Get the hydrogen atom count -- for ligand files

Specified by:
  `getHydrogenAtomCount` in class `JmolAdapter`
Parameters:
  `asc` -
Returns:
  number of hydrogen atoms in this model

### getBondList

public String[][] getBondList(Object asc)

Specified by:
  `getBondList` in class `JmolAdapter`
Parameters:
  `asc` -
Returns:
  [ [atomName1 atomName2 order] ...]

### getAtomCount

public int getAtomCount(Object asc, int atomSetIndex)
Description copied from class: `JmolAdapter`
Get the number of atoms contained in the file.

Specified by:
  `getAtomCount` in class `JmolAdapter`
Parameters:
  `asc` - The client file
  `atomSetIndex` - if -1, then count for the whole collection, else for this set
Returns:
  The estimated number of atoms in the file

### coordinatesAreFractional

public boolean coordinatesAreFractional(Object asc)
Description copied from class: `JmolAdapter`
Get the boolean whether coordinates are fractional.

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

### getAtomIterator

public JmolAdapterAtomIterator getAtomIterator(Object asc)
/////////////////////////////////////////////////////////////

Specified by:
  `getAtomIterator` in class `JmolAdapter`
Parameters:
  `asc` - The client file
Returns:
  An AtomIterator
See Also:
  - `JmolAdapterAtomIterator`

### getBondIterator

public JmolAdapterBondIterator getBondIterator(Object asc)
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:
  `asc` - The client file
Returns:
  A BondIterator or `null`
See Also:
  - `JmolAdapterBondIterator`

### getStructureIterator

public JmolAdapterStructureIterator getStructureIterator(Object asc)
Description copied from class: `JmolAdapter`
Get a StructureIterator.

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

### close

public static void close(Object bufferedReader) throws IOException

Throws:
  `IOException`

### getAtomSetCollectionInline

public Object getAtomSetCollectionInline(Object molData, Map<String,Object> htParams)

Specified by:
  `getAtomSetCollectionInline` in class `JmolAdapter`