Package org.lifstools.jgoslin.domain
Class ElementTable
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<Element,
Integer>
Accounting table for chemical element frequency. This is used to calculate
sum formulas and total masses for a given chemical element distribution, e.g.
in a lipid.
- Author:
- Dominik Kopczynski, Nils Hoffmann
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,
V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(ElementTable elements) Add all elements and counts to those in this element table.void
add
(ElementTable elements, int multiplier) Add all alements and counts to those in this element table, but use the count argument to multiply count values in the provided table.copy()
Copy all entries in this element table.getChargedMass
(int charge) Returns the total summed mass per number of elements, corrected for charge counts * electron rest mass.getMass()
Returns the total summed mass per number of elements.Returns the individual total mass for the provided element.Returns the sum formula for all elements in this table.static ElementTable
Create a new element table from the provided entries.Methods inherited from class java.util.EnumMap
clear, clone, containsKey, containsValue, entrySet, equals, get, hashCode, keySet, put, putAll, remove, size, values
Methods inherited from class java.util.AbstractMap
isEmpty, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
ElementTable
public ElementTable()Create a new element table.
-
-
Method Details
-
of
Create a new element table from the provided entries.- Parameters:
entries
- the entries- Returns:
- a new element table.
-
add
Add all elements and counts to those in this element table.- Parameters:
elements
- the table to add to this one.
-
add
Add all alements and counts to those in this element table, but use the count argument to multiply count values in the provided table.- Parameters:
elements
-multiplier
-
-
copy
Copy all entries in this element table. The copy will be completely independent of this instance.- Returns:
- a copy of this element table.
-
getSumFormula
Returns the sum formula for all elements in this table.- Returns:
- the sum formula. Returns an empty string if the table is empty.
-
getMass
Returns the individual total mass for the provided element.- Parameters:
element
- the element to calculate the total mass for.- Returns:
- the total mass for the given element, or 0.
-
getMass
Returns the total summed mass per number of elements.- Returns:
- the total summed mass for this element table. Returns 0 if the table is empty.
-
getChargedMass
Returns the total summed mass per number of elements, corrected for charge counts * electron rest mass.- Parameters:
charge
- the charge of the molecule- Returns:
- the total summed mass for this element table. Returns 0 if the table is empty.
-