|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object peakml.chemistry.MolecularFormula
public class MolecularFormula
Implementation of a container keeping track of the atom counts for a molecular formula. Several convenience methods are provided, including a string parser, validity checks and molecular formula math (subtraction and addition of other molecular formulae to this molecular formula).
Nested Class Summary | |
---|---|
static class |
MolecularFormula.SubFormula
|
Constructor Summary | |
---|---|
MolecularFormula()
Constructs an empty formula. |
|
MolecularFormula(MolecularFormula formula)
Copy-constructor, which copies the complete contents of the given instance. |
|
MolecularFormula(java.lang.String formula)
Constructs a new class with the given formula by calling Init(String,String) . |
|
MolecularFormula(java.lang.String iontype,
java.lang.String formula)
|
Method Summary | |
---|---|
boolean |
equals(java.lang.Object other)
|
int |
getCharge()
Returns the charge on the molecule. |
double |
getMass(Mass masstype)
Calculates the mass for this molecular formula. |
double |
getMassVariance()
Calculates the mass-variance of the molecule. |
int |
getNrAtoms()
Counts the total amount of atoms in the molecule, without taking an atom type into account. |
int |
getNrAtoms(int atomid)
|
int |
getNrAtoms(int atomid,
int subformulaindex)
|
java.util.Vector<MolecularFormula.SubFormula> |
getSubFormulas()
|
boolean |
isValid()
Validity check for molecular formulae. |
static void |
main(java.lang.String[] args)
|
void |
setNrAtoms(int atomid,
int count)
|
void |
setNrAtoms(int atomid,
int count,
int subformulaindex)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MolecularFormula()
Init(String,String)
function
can be used to initialize a real molecular formula.
public MolecularFormula(java.lang.String formula)
Init(String,String)
.
formula
- The molecular formula to initialize to.public MolecularFormula(java.lang.String iontype, java.lang.String formula)
public MolecularFormula(MolecularFormula formula)
formula
- The molecular formula instance to copy.Method Detail |
---|
public java.util.Vector<MolecularFormula.SubFormula> getSubFormulas()
public int getCharge()
public int getNrAtoms()
public int getNrAtoms(int atomid)
public int getNrAtoms(int atomid, int subformulaindex)
public void setNrAtoms(int atomid, int count)
public void setNrAtoms(int atomid, int count, int subformulaindex)
public double getMass(Mass masstype)
masstype
- Indicates whether to use molecular or monoisotopic weight.public double getMassVariance()
public boolean isValid()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |