public class AtomChain extends Object implements Serializable
Constructor and Description |
---|
AtomChain()
Creates an empty atom chain.
|
AtomChain(boolean addition)
Creates an empty atom chain.
|
AtomChain(String chain)
Constructor for a monoisotopic chain as a string of additions, e.g.
|
AtomChain(String chain,
boolean addition)
Constructor for a monoisotopic chain as a string, e.g.
|
Modifier and Type | Method and Description |
---|---|
void |
append(AtomImpl atom)
Appends an atom to the chain of atoms.
|
void |
append(AtomImpl atom,
int occurrence)
Appends an atom to the chain of atoms.
|
AtomChain |
clone() |
Boolean |
getAddition()
Returns true of the given atomic chain consists of additions, i.e., all
atoms are added when calculating the mass, false, means that all atoms
are subtracted.
|
ArrayList<AtomImpl> |
getAtomChain()
Returns the atom chain as a list of AtomImpl.
|
Double |
getMass()
Returns the mass of the atomic chain as sum of the individual atoms.
|
int |
getOccurrence(Atom atom,
Integer isotope)
Returns the occurrence of a given atom in the chain.
|
boolean |
isSameCompositionAs(AtomChain anotherChain)
Indicates whether two atom chains are of the same composition by
comparing their string and type.
|
void |
remove(Atom atom,
Integer isotope)
Removes all the occurrences of the given atom.
|
void |
setAddition(Boolean addition)
Set if the given atomic chain consists of additions, i.e., all atoms are
added when calculating the mass, false, means that all atoms are
subtracted.
|
void |
setOccurrence(Atom atom,
Integer isotope,
Integer occurrence)
Sets the occurrence of a given atom.
|
int |
size()
Returns the number of atoms in this atom chain.
|
String |
toString() |
public AtomChain()
public AtomChain(boolean addition)
addition
- if the atom chain consists of additionspublic AtomChain(String chain) throws IllegalArgumentException
chain
- the atomic chain as a stringIllegalArgumentException
- if an illegal atom is usedpublic AtomChain(String chain, boolean addition) throws IllegalArgumentException
chain
- the atomic chain as a stringaddition
- if the atom chain consists of additionsIllegalArgumentException
- if an illegal atom is usedpublic void append(AtomImpl atom)
atom
- a new atompublic void append(AtomImpl atom, int occurrence)
atom
- a new atomoccurrence
- the number of times this atom should be addedpublic ArrayList<AtomImpl> getAtomChain()
public Double getMass()
public int size()
public int getOccurrence(Atom atom, Integer isotope)
atom
- the atom of interestisotope
- the isotope to look forpublic void remove(Atom atom, Integer isotope)
atom
- the atomisotope
- the isotopepublic void setOccurrence(Atom atom, Integer isotope, Integer occurrence)
atom
- the atomisotope
- the isotope numberoccurrence
- the occurrencepublic boolean isSameCompositionAs(AtomChain anotherChain)
anotherChain
- another atom chainpublic Boolean getAddition()
public void setAddition(Boolean addition)
addition
- true if the given atomic chain consists of additionsCopyright © 2016. All rights reserved.