Class Cif2DataParser
java.lang.Object
javajs.util.CifDataParser
org.jmol.adapter.readers.cif.Cif2DataParser
- All Implemented Interfaces:
GenericCifDataParser
Fully implemented 2016.12.1
see http://journals.iucr.org/j/issues/2016/01/00/aj5269/index.html
Will deliver JSON versions of the data while file reading and Java List/Map structures when
called by
x = getProperty("cifInfo", filename)
Validated using the test-data suite by John Bollinger (John.Bollinger@stjude.org)
found at https://github.com/COMCIFS/cif_api
- Author:
- Bob Hanson hansonr@stolaf.edu
-
Field Summary
Fields inherited from class CifDataParser
asObject, cch, columnCount, columnNames, cterm, debugging, haveData, htFields, ich, KEY_MAX, line, nullString, str, wasUnquotedFields inherited from interface GenericCifDataParser
EMPTY, NONE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic double[]getArrayFromStringList(String s, int n) turn "[1,2,3]" into [1.0,2.0,3.0] array will be truncated to n elements, or filled with zeros to pad to n, as necessary.static int[]getIntArrayFromStringList(String s, int n) turn "[1,2,3]" into [1,2,3] array will be truncated to n elements, or filled with zeros to pad to n, as necessary.protected ObjectgetQuotedStringOrObject(char ch) final get for quoted objectprotected intprotected booleanisQuote(char ch) Includes all possible operator tokensprotected Stringinitial processing; returns a string bounded by \1protected StringSets a multiline semicolon-eclipsed string to be parsed from the beginning, allowing for CIF 2.0-type prefixed text lines and removing line folding.Read a CIF 2.0 table into either a JSON string or a java data structureThere is no need to convert to unicode in CIF 2.0.protected ObjectHandle unquoted value as Integer or Float if we can.Methods inherited from class CifDataParser
fixKey, getAllCifData, getAllCifDataType, getColumnCount, getColumnData, getColumnName, getData, getFileHeader, getNextDataToken, getNextToken, getNextTokenObject, getNextTokenProtected, getTokenPeeked, isTerminator, parseDataBlockParameters, peekToken, prepareNextLine, preprocessSemiString, readLine, readList, set, setNullValue, setString, skipLoop, skipNextToken
-
Constructor Details
-
Cif2DataParser
public Cif2DataParser()
-
-
Method Details
-
getVersion
protected int getVersion()- Overrides:
getVersionin classCifDataParser
-
toUnicode
There is no need to convert to unicode in CIF 2.0.- Specified by:
toUnicodein interfaceGenericCifDataParser- Overrides:
toUnicodein classCifDataParser- Parameters:
data-- Returns:
- cleaned string
-
isQuote
protected boolean isQuote(char ch) Includes all possible operator tokens- Overrides:
isQuotein classCifDataParser- Parameters:
ch-- Returns:
- true if this character is a (starting) quote
-
getQuotedStringOrObject
final get for quoted object- Overrides:
getQuotedStringOrObjectin classCifDataParser- Parameters:
ch- current character being pointed to- Returns:
- a String data object
-
preprocessString
initial processing; returns a string bounded by \1- Overrides:
preprocessStringin classCifDataParser- Returns:
- escaped part with attached extra data
- Throws:
Exception
-
processSemiString
-
readTable
-
unquoted
Handle unquoted value as Integer or Float if we can.- Overrides:
unquotedin classCifDataParser- Parameters:
s- unquoted string- Returns:
- unchanged value
-
getArrayFromStringList
turn "[1,2,3]" into [1.0,2.0,3.0] array will be truncated to n elements, or filled with zeros to pad to n, as necessary.- Parameters:
s-n-- Returns:
- double[] array
-
getIntArrayFromStringList
turn "[1,2,3]" into [1,2,3] array will be truncated to n elements, or filled with zeros to pad to n, as necessary.- Parameters:
s-n-- Returns:
- int[] array
-