C# Class CSMSL.Chemistry.ChemicalFormulaGenerator

A chemical formula generator for constructing all possible chemical formulas within a mass range given restraints on the total number of isotopes.
Datei anzeigen Open project: dbaileychess/CSMSL Class Usage Examples

Public Methods

Method Description
AddConstraint ( ChemicalFormula minimumChemicalFormula, ChemicalFormula maximumChemicalFormula ) : void
AddConstraint ( Isotope isotope, Range range ) : void
AddConstraint ( Isotope isotope, int min, int max ) : void
AllFormulas ( ) : IEnumerable

Generate all formulas regardless of mass between the min and max formula

ChemicalFormulaGenerator ( ) : System

Create a empty generator, which will produce no formulas unless a constraint is added

ChemicalFormulaGenerator ( ChemicalFormula maximumChemicalFormula ) : System

Creates a generator with a maximum chemical formula allowed

ChemicalFormulaGenerator ( ChemicalFormula minimumChemicalFormula, ChemicalFormula maximumChemicalFormula ) : System

Creates a generator with a maximum chemical formula allowed

ClearConstraints ( ) : void
FromMass ( IRange massRange, int maxNumberOfResults = int.MaxValue, bool sort = true ) : IEnumerable
FromMass ( double lowMass, double highMass, int maxNumberOfResults = int.MaxValue, bool sort = true ) : IEnumerable
RemoveConstraint ( Isotope isotope ) : void

Private Methods

Method Description
GenerateFormulaHelper ( double lowMass, double highMass, double masses, int max, int index, int currentFormula, List formulas ) : void

Method Details

AddConstraint() public method

public AddConstraint ( ChemicalFormula minimumChemicalFormula, ChemicalFormula maximumChemicalFormula ) : void
minimumChemicalFormula ChemicalFormula
maximumChemicalFormula ChemicalFormula
return void

AddConstraint() public method

public AddConstraint ( Isotope isotope, Range range ) : void
isotope Isotope
range Range
return void

AddConstraint() public method

public AddConstraint ( Isotope isotope, int min, int max ) : void
isotope Isotope
min int
max int
return void

AllFormulas() public method

Generate all formulas regardless of mass between the min and max formula
public AllFormulas ( ) : IEnumerable
return IEnumerable

ChemicalFormulaGenerator() public method

Create a empty generator, which will produce no formulas unless a constraint is added
public ChemicalFormulaGenerator ( ) : System
return System

ChemicalFormulaGenerator() public method

Creates a generator with a maximum chemical formula allowed
public ChemicalFormulaGenerator ( ChemicalFormula maximumChemicalFormula ) : System
maximumChemicalFormula ChemicalFormula The maximum chemical formula to generate
return System

ChemicalFormulaGenerator() public method

Creates a generator with a maximum chemical formula allowed
public ChemicalFormulaGenerator ( ChemicalFormula minimumChemicalFormula, ChemicalFormula maximumChemicalFormula ) : System
minimumChemicalFormula ChemicalFormula
maximumChemicalFormula ChemicalFormula The maximum chemical formula to generate
return System

ClearConstraints() public method

public ClearConstraints ( ) : void
return void

FromMass() public method

public FromMass ( IRange massRange, int maxNumberOfResults = int.MaxValue, bool sort = true ) : IEnumerable
massRange IRange
maxNumberOfResults int
sort bool
return IEnumerable

FromMass() public method

public FromMass ( double lowMass, double highMass, int maxNumberOfResults = int.MaxValue, bool sort = true ) : IEnumerable
lowMass double
highMass double
maxNumberOfResults int
sort bool
return IEnumerable

RemoveConstraint() public method

public RemoveConstraint ( Isotope isotope ) : void
isotope Isotope
return void