Package org.rcsb.cif
Class CifOptions.CifOptionsBuilder
- java.lang.Object
-
- org.rcsb.cif.CifOptions.CifOptionsBuilder
-
- Enclosing class:
- CifOptions
public static class CifOptions.CifOptionsBuilder extends Object
Internal class to handle the option building process.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCifOptions.CifOptionsBuilder.FileFormatSupported file formats.
-
Constructor Summary
Constructors Constructor Description CifOptionsBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CifOptionsbuild()Exit this builder and retrieve the actual, immutableCifOptionsinstance.CifOptions.CifOptionsBuildercategoryBlacklist(String... categoryBlacklist)Add entries to the category blacklist.CifOptions.CifOptionsBuildercategoryBlacklist(List<String> categoryBlacklist)Add entries to the category blacklist.CifOptions.CifOptionsBuildercategoryWhitelist(String... categoryWhitelist)Add entries to the category whitelist.CifOptions.CifOptionsBuildercategoryWhitelist(List<String> categoryWhitelist)Add entries to the category whitelist.CifOptions.CifOptionsBuildercolumnBlacklist(String... columnBlacklist)Add entries to the column blacklist.CifOptions.CifOptionsBuildercolumnBlacklist(List<String> columnBlacklist)Add entries to the column blacklist.CifOptions.CifOptionsBuildercolumnWhitelist(String... columnWhitelist)Add entries to the column whitelist.CifOptions.CifOptionsBuildercolumnWhitelist(List<String> columnWhitelist)Add entries to the column whitelist.CifOptions.CifOptionsBuilderencoder(String encoder)The name of the encoder which should be written to files.CifOptions.CifOptionsBuilderencodingStrategyHint(String json)ReadEncodingStrategyHintdata from a JSON string.CifOptions.CifOptionsBuilderencodingStrategyHint(String categoryName, String columnName, String encoding, int precision)Manually specify encoding strategy and precision for a column.CifOptions.CifOptionsBuilderencodingStrategyHint(Path path)ReadEncodingStrategyHintdata from a JSON file.CifOptions.CifOptionsBuilderencodingStrategyHint(List<EncodingStrategyHint> encodingStrategyHints)Manually specify encoding strategy and precision for a column.CifOptions.CifOptionsBuilderencodingStrategyHint(EncodingStrategyHint... encodingStrategyHints)Manually specify encoding strategy and precision for a column.CifOptions.CifOptionsBuilderfetchUrl(String fetchUrl)The URL from which files should be fetched - must follow the pattern:www.source.com/%s.cif, where%srepresents the pdbId to be inserted into the URL to fetch the correct file.CifOptions.CifOptionsBuilderfileFormatHint(CifOptions.CifOptionsBuilder.FileFormat fileFormat)The library can automatically detect compression and file format.CifOptions.CifOptionsBuildergeneric(boolean generic)Allow for 'generic' reading: no types will be inferred and all categories and columns will be the untyped, 'generic' base implementations of categories and columns.CifOptions.CifOptionsBuildergzip(boolean gzip)Allows for downstream GZIP operations.
-
-
-
Method Detail
-
generic
public CifOptions.CifOptionsBuilder generic(boolean generic)
Allow for 'generic' reading: no types will be inferred and all categories and columns will be the untyped, 'generic' base implementations of categories and columns. Be careful: this will cause any previously type-safe method (e.g.Block.getAtomSite()to now throw aClassCastException. The only way to access categories/column is by getting them explicitly by name.- Parameters:
generic-truewill omit type-safe access to categories and columns- Returns:
- this builder instance
-
gzip
public CifOptions.CifOptionsBuilder gzip(boolean gzip)
Allows for downstream GZIP operations.- Parameters:
gzip-trueif the output should be gzipped- Returns:
- this builder instance
-
encoder
public CifOptions.CifOptionsBuilder encoder(String encoder)
The name of the encoder which should be written to files.- Parameters:
encoder- String representing the encoder name- Returns:
- this builder instance
-
fetchUrl
public CifOptions.CifOptionsBuilder fetchUrl(String fetchUrl)
The URL from which files should be fetched - must follow the pattern:www.source.com/%s.cif, where%srepresents the pdbId to be inserted into the URL to fetch the correct file.- Parameters:
fetchUrl- the specified fetch URL- Returns:
- this builder instance
-
categoryWhitelist
public CifOptions.CifOptionsBuilder categoryWhitelist(String... categoryWhitelist)
Add entries to the category whitelist. If the whitelist has any entries, the category must be explicitly contained for the category to appear in the output.- Parameters:
categoryWhitelist- a collection of String values to explicitly include in the output, all other possible entries will be implicitly excluded- Returns:
- this builder instance
-
categoryWhitelist
public CifOptions.CifOptionsBuilder categoryWhitelist(List<String> categoryWhitelist)
Add entries to the category whitelist. If the whitelist has any entries, the category must be explicitly contained for the category to appear in the output.- Parameters:
categoryWhitelist- a collection of String values to explicitly include in the output, all other possible entries will be implicitly excluded- Returns:
- this builder instance
-
categoryBlacklist
public CifOptions.CifOptionsBuilder categoryBlacklist(String... categoryBlacklist)
Add entries to the category blacklist. Any entries will be ignored when composing the output.- Parameters:
categoryBlacklist- a collection of String values to explicitly exclude from the output, all other possible entries will be implicitly included- Returns:
- this builder instance
-
categoryBlacklist
public CifOptions.CifOptionsBuilder categoryBlacklist(List<String> categoryBlacklist)
Add entries to the category blacklist. Any entries will be ignored when composing the output.- Parameters:
categoryBlacklist- a collection of String values to explicitly exclude from the output, all other possible entries will be implicitly included- Returns:
- this builder instance
-
columnWhitelist
public CifOptions.CifOptionsBuilder columnWhitelist(String... columnWhitelist)
Add entries to the column whitelist. If the whitelist has any entries, the column must be explicitly contained for the column to appear in the output. Names follow the patterncategory_name.column_name.- Parameters:
columnWhitelist- a collection of String values to explicitly include in the output, all other possible entries will be implicitly excluded- Returns:
- this builder instance
-
columnWhitelist
public CifOptions.CifOptionsBuilder columnWhitelist(List<String> columnWhitelist)
Add entries to the column whitelist. If the whitelist has any entries, the column must be explicitly contained for the column to appear in the output. Names follow the patterncategory_name.column_name.- Parameters:
columnWhitelist- a collection of String values to explicitly include in the output, all other possible entries will be implicitly excluded- Returns:
- this builder instance
-
columnBlacklist
public CifOptions.CifOptionsBuilder columnBlacklist(String... columnBlacklist)
Add entries to the column blacklist. Any entries will be ignored when composing the output. Names follow the patterncategory_name.column_name.- Parameters:
columnBlacklist- a collection of String values to explicitly exclude from the output, all other possible entries will be implicitly included- Returns:
- this builder instance
-
columnBlacklist
public CifOptions.CifOptionsBuilder columnBlacklist(List<String> columnBlacklist)
Add entries to the column blacklist. Any entries will be ignored when composing the output. Names follow the patterncategory_name.column_name.- Parameters:
columnBlacklist- a collection of String values to explicitly exclude from the output, all other possible entries will be implicitly included- Returns:
- this builder instance
-
encodingStrategyHint
public CifOptions.CifOptionsBuilder encodingStrategyHint(Path path)
ReadEncodingStrategyHintdata from a JSON file.- Parameters:
path- the file to read- Returns:
- this builder instance
-
encodingStrategyHint
public CifOptions.CifOptionsBuilder encodingStrategyHint(String json)
ReadEncodingStrategyHintdata from a JSON string.- Parameters:
json- the string to read- Returns:
- this builder instance
-
encodingStrategyHint
public CifOptions.CifOptionsBuilder encodingStrategyHint(String categoryName, String columnName, String encoding, int precision)
Manually specify encoding strategy and precision for a column.- Parameters:
categoryName- the category namecolumnName- the column nameencoding- the encoding to employ: "pack" | "rle" | "delta" | "delta-rle"precision- the number of decimal places to keep duringFixedPointEncoding- Returns:
- this builder instance
-
encodingStrategyHint
public CifOptions.CifOptionsBuilder encodingStrategyHint(EncodingStrategyHint... encodingStrategyHints)
Manually specify encoding strategy and precision for a column.- Parameters:
encodingStrategyHints- the hints to process- Returns:
- this builder instance
-
encodingStrategyHint
public CifOptions.CifOptionsBuilder encodingStrategyHint(List<EncodingStrategyHint> encodingStrategyHints)
Manually specify encoding strategy and precision for a column.- Parameters:
encodingStrategyHints- the hints to process- Returns:
- this builder instance
-
fileFormatHint
public CifOptions.CifOptionsBuilder fileFormatHint(CifOptions.CifOptionsBuilder.FileFormat fileFormat)
The library can automatically detect compression and file format. This involves some guessing and can be omitted by specifying the format explicitly. This may increase performance and will improve safety when malformed or unexpected files are handled.- Parameters:
fileFormat- an instance of the supported file formats- Returns:
- this builder instance
-
build
public CifOptions build()
Exit this builder and retrieve the actual, immutableCifOptionsinstance.- Returns:
- a
CifOptionsinstance
-
-