Package org.openscience.cdk.hash
Class HashGeneratorMaker
- java.lang.Object
-
- org.openscience.cdk.hash.HashGeneratorMaker
-
public final class HashGeneratorMaker extends Object
Fluent API for creating hash generators. The maker is first configured with one or more attributes. Once fully configured the generator is made by invokingatomic()
,molecular()
orensemble()
. The order of the built-in configuration methods does not matter however when specifying custom encoders withencode(AtomEncoder)
the order they are added is the order they will be used. Therefore one can expect different hash codes if there is a change in the order they are specified.
Examples// simple MoleculeHashGenerator generator = new HashGeneratorMaker().depth(16) .elemental() .molecular(); // fast MoleculeHashGenerator generator = new HashGeneratorMaker().depth(8) .elemental() .isotopic() .charged() .orbital() .molecular(); // comprehensive MoleculeHashGenerator generator = new HashGeneratorMaker().depth(32) .elemental() .isotopic() .charged() .chiral() .perturbed() .molecular();
- Author:
- John May
- Source code:
- main
- Belongs to CDK module:
- hash
-
-
Constructor Summary
Constructors Constructor Description HashGeneratorMaker()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AtomHashGenerator
atomic()
Given the current configuration create anAtomHashGenerator
.HashGeneratorMaker
charged()
Discriminate protonation states.HashGeneratorMaker
chiral()
Generate different hash codes for stereoisomers.HashGeneratorMaker
depth(int depth)
Specify the depth of the hash generator.HashGeneratorMaker
elemental()
Discriminate elements.HashGeneratorMaker
encode(AtomEncoder encoder)
Add a custom encoder to the hash generator which will be built.EnsembleHashGenerator
ensemble()
Given the current configuration create anEnsembleHashGenerator
.HashGeneratorMaker
isotopic()
Discriminate isotopes.MoleculeHashGenerator
molecular()
Given the current configuration create anMoleculeHashGenerator
.HashGeneratorMaker
orbital()
Discriminate atomic orbitals.HashGeneratorMaker
perturbed()
Discriminate atoms experiencing uniform environments.HashGeneratorMaker
radical()
Discriminate free radicals.HashGeneratorMaker
suppressHydrogens()
Suppress any explicit hydrogens in the encoding of hash values.
-
-
-
Method Detail
-
depth
public HashGeneratorMaker depth(int depth)
Specify the depth of the hash generator. Larger values discriminate more molecules.- Parameters:
depth
- how deep should the generator hash- Returns:
- reference for fluent API
- Throws:
IllegalArgumentException
- if the depth was less then zero
-
elemental
public HashGeneratorMaker elemental()
Discriminate elements.- Returns:
- fluent API reference (self)
- See Also:
BasicAtomEncoder.ATOMIC_NUMBER
-
isotopic
public HashGeneratorMaker isotopic()
Discriminate isotopes.- Returns:
- fluent API reference (self)
- See Also:
BasicAtomEncoder.MASS_NUMBER
-
charged
public HashGeneratorMaker charged()
Discriminate protonation states.- Returns:
- fluent API reference (self)
- See Also:
BasicAtomEncoder.FORMAL_CHARGE
-
orbital
public HashGeneratorMaker orbital()
Discriminate atomic orbitals.- Returns:
- fluent API reference (self)
- See Also:
BasicAtomEncoder.ORBITAL_HYBRIDIZATION
-
radical
public HashGeneratorMaker radical()
Discriminate free radicals.- Returns:
- fluent API reference (self)
- See Also:
BasicAtomEncoder.FREE_RADICALS
-
chiral
public HashGeneratorMaker chiral()
Generate different hash codes for stereoisomers. The currently supported geometries are:- Tetrahedral
- Double Bond
- Cumulative Double Bonds
- Returns:
- fluent API reference (self)
-
suppressHydrogens
public HashGeneratorMaker suppressHydrogens()
Suppress any explicit hydrogens in the encoding of hash values. The generation of hashes acts as though the hydrogens are not present and as such preserves stereo-encoding.- Returns:
- fluent API reference (self)
-
perturbed
public HashGeneratorMaker perturbed()
Discriminate atoms experiencing uniform environments. This method usesMinimumEquivalentCyclicSet
to break symmetry but depending on application one may need a more comprehensive method. Please refer toperturbWith(EquivalentSetFinder)
for further configuration details.- Returns:
- fluent API reference (self)
- See Also:
MinimumEquivalentCyclicSet
,perturbWith(EquivalentSetFinder)
-
encode
public HashGeneratorMaker encode(AtomEncoder encoder)
Add a custom encoder to the hash generator which will be built. Although not enforced, the encoder should be stateless and should not modify any passed inputs.- Parameters:
encoder
- an atom encoder- Returns:
- fluent API reference (self)
- Throws:
NullPointerException
- no encoder provided
-
ensemble
public EnsembleHashGenerator ensemble()
Given the current configuration create anEnsembleHashGenerator
.- Returns:
- instance of the generator
- Throws:
IllegalArgumentException
- no depth or encoders were configured
-
molecular
public MoleculeHashGenerator molecular()
Given the current configuration create anMoleculeHashGenerator
.- Returns:
- instance of the generator
- Throws:
IllegalArgumentException
- no depth or encoders were configured
-
atomic
public AtomHashGenerator atomic()
Given the current configuration create anAtomHashGenerator
.- Returns:
- instance of the generator
- Throws:
IllegalArgumentException
- no depth or encoders were configured
-
-