/// <summary> /// Create a perturbed hash generator using the provided seed generator to /// initialise atom invariants and using the provided stereo factory. /// </summary> /// <param name="seeds"></param> /// <param name="simple">generator to encode the initial values of atoms</param> /// <param name="pseudorandom">pseudorandom number generator used to randomise hash distribution</param> /// <param name="factory">a stereo encoder factory</param> /// <param name="finder">equivalent set finder for driving the systematic perturbation</param> /// <param name="suppression">suppression of atoms (these atoms are 'ignored' in the hash generation)</param> /// <exception cref="ArgumentException">depth was less then 0</exception> /// <exception cref="ArgumentNullException"> seed generator or pseudo random was null</exception> /// <seealso cref="SeedGenerator"/> public PerturbedAtomHashGenerator(SeedGenerator seeds, AbstractAtomHashGenerator simple, Pseudorandom pseudorandom, IStereoEncoderFactory factory, EquivalentSetFinder finder, AtomSuppression suppression) : base(pseudorandom) { this.finder = finder; this.factory = factory; this.simple = simple ?? throw new ArgumentNullException(nameof(simple), "no simple generator provided"); this.seeds = seeds ?? throw new ArgumentNullException(nameof(seeds), "no seed generator provided"); this.suppression = suppression ?? throw new ArgumentNullException(nameof(suppression), "no suppression provided, use AtomSuppression.None()"); }
/// <summary> /// Create a basic hash generator using the provided seed generator to /// initialise atom invariants and using the provided stereo factory. /// </summary> /// <param name="seedGenerator">generator to seed the initial values of atoms</param> /// <param name="pseudorandom">pseudorandom number generator used to randomise hash distribution</param> /// <param name="factory">a stereo encoder factory</param> /// <param name="suppression">defines which atoms are suppressed - that is masked from the hash</param> /// <param name="depth">depth of the hashing function, larger values take longer</param> /// <exception cref="ArgumentException">depth was less then 0</exception> /// <exception cref="ArgumentNullException"> seed generator or pseudo random was null</exception> /// <seealso cref="SeedGenerator"/> public SuppressedAtomHashGenerator( IAtomHashGenerator seedGenerator, Pseudorandom pseudorandom, IStereoEncoderFactory factory, AtomSuppression suppression, int depth) : base(pseudorandom) { if (depth < 0) { throw new ArgumentOutOfRangeException(nameof(depth), "depth cannot be less then 0"); } this.seedGenerator = seedGenerator ?? throw new ArgumentNullException(nameof(seedGenerator), "seed generator cannot be null"); this.factory = factory; this.suppression = suppression; this.depth = depth; }
/// <summary> /// 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. /// </summary> /// <returns>fluent API reference (self)</returns> public HashGeneratorMaker SuppressHydrogens() { this.suppression = AtomSuppression.AnyHydrogens; return(this); }
/// <summary> /// Create a new seed generator using the provided <see cref="IAtomEncoder"/> and /// pseudorandom number generator. /// </summary> /// <param name="encoder">a method for encoding atom invariant properties</param> /// <param name="pseudorandom">number generator to randomise initial invariants</param> /// <param name="suppression">indicates which vertices should be suppressed</param> /// <exception cref="ArgumentNullException">encoder or pseudorandom number generator was null</exception> public SeedGenerator(IAtomEncoder encoder, Pseudorandom pseudorandom, AtomSuppression suppression) : base(pseudorandom) { this.encoder = encoder ?? throw new ArgumentNullException(nameof(encoder), "encoder cannot be null"); this.suppression = suppression ?? throw new ArgumentNullException(nameof(suppression), "suppression cannot be null, use AtomSuppression.Unsuppressed()"); }
/// <summary> /// Create a new seed generator using the provided <see cref="IAtomEncoder"/>. /// </summary> /// <param name="encoder">a method for encoding atom invariant properties</param> /// <param name="suppression"></param> /// <exception cref="ArgumentNullException">encoder was null</exception> /// <seealso cref="ConjugatedAtomEncoder"/> public SeedGenerator(IAtomEncoder encoder, AtomSuppression suppression) : this(encoder, new Xorshift(), suppression) { }
/// <summary> /// Create a basic hash generator using the provided seed generator to /// initialise atom invariants and no stereo configuration. /// </summary> /// <param name="seedGenerator">generator to seed the initial values of atoms</param> /// <param name="pseudorandom">pseudorandom number generator used to randomise hash distribution</param> /// <param name="suppression">defines which atoms are suppressed (i.e. masked) from the hash code</param> /// <param name="depth">depth of the hashing function, larger values take longer</param> /// <exception cref="ArgumentException">depth was less then 0</exception> /// <exception cref="ArgumentNullException">seed generator or pseudo random was null</exception> /// <seealso cref="SeedGenerator"/> public SuppressedAtomHashGenerator(IAtomHashGenerator seedGenerator, Pseudorandom pseudorandom, AtomSuppression suppression, int depth) : this(seedGenerator, pseudorandom, StereoEncoderFactory.Empty, suppression, depth) { }