public class WeightedAtomicComposition
extends java.lang.Object
implements java.io.Serializable
This class stores the weighted atomic composition of a composite material.
The weighted atomic composition of a material is a key-sorted map containing its constituting elements(keys) and their contribution by weight.
H2O is stored as:
Constructor and Description |
---|
WeightedAtomicComposition()
Create an empty weighted atomic composition table.
|
WeightedAtomicComposition(java.lang.String formula)
Create a new weighted atomic composition table by parsing formula and determining the atomic composition by weight.
|
WeightedAtomicComposition(java.lang.String formula,
double proportion)
Create a new weighted atomic composition table by parsing formula and determining the atomic composition by weight scaled by proportion.
|
Modifier and Type | Method and Description |
---|---|
void |
add(java.lang.String formula,
double proportion)
Add an element to table.
|
void |
addUniqueElement(java.lang.String formula,
double weight)
To be used if there exists only one instance of element in formula.
|
java.util.TreeMap<java.lang.String,java.lang.Double> |
getCompositionTable()
Retrieve a composition table describing the elemental make up of material of interest
|
java.util.Iterator<java.lang.String> |
keysIterator()
Iterate through the elements constituting the material of interest
|
void |
setCompositionTable(java.util.TreeMap<java.lang.String,java.lang.Double> composition)
Set a pre-initialized composition table
|
int |
size()
Returns the number of elements that constitute the material of interest
|
java.util.Iterator<java.lang.Double> |
valuesIterator()
Iterate through the composition of elements constituting the material of interest
|
public WeightedAtomicComposition()
public WeightedAtomicComposition(java.lang.String formula)
formula
- is formula of materialpublic WeightedAtomicComposition(java.lang.String formula, double proportion)
formula
- is formula of a constituent of the material to be described by composition tableproportion
- is proportion by weight of the material defined by formulapublic void add(java.lang.String formula, double proportion)
formula
- is formula of elementproportion
- is atomic contribution by weight. For a compound, proportion = number of atoms * atomic weight;public void addUniqueElement(java.lang.String formula, double weight)
To be used if there exists only one instance of element in formula. This method by rebuildDatabase for bootstrapping.
formula
- is formula of elementweight
- is atomic weight of elementpublic void setCompositionTable(java.util.TreeMap<java.lang.String,java.lang.Double> composition)
composition
- is composition table describing the elemental makeup of the material of interestpublic java.util.TreeMap<java.lang.String,java.lang.Double> getCompositionTable()
public int size()
public java.util.Iterator<java.lang.Double> valuesIterator()
public java.util.Iterator<java.lang.String> keysIterator()