public static final class Composition.Builder extends Object
| Constructor and Description |
|---|
Composition.Builder()
Construct a new Builder
|
Composition.Builder(AtomicSymbol atom)
Construct a new Builder and add the
atom |
Composition.Builder(AtomicSymbol atom,
int count)
Construct a new Builder and add the
atom count times |
| Modifier and Type | Method and Description |
|---|---|
Composition.Builder |
add(AtomicSymbol atom)
Add an atom for the specified AtomicSymbol
|
Composition.Builder |
add(AtomicSymbol atom,
int count)
Add
count atoms for the specified AtomicSymbol |
Composition.Builder |
add(Atom atom,
int count)
Add the
atom count times. |
Composition.Builder |
addAll(Composition composition)
Add all of the atoms in
composition to this |
Composition.Builder |
addIsotope(AtomicSymbol symbol,
int isotope)
Add an atom for the specified symbol and isotope
|
Composition.Builder |
addIsotope(AtomicSymbol symbol,
int isotope,
int count)
Add an atom
count |
Composition |
build()
Build the composition
|
Composition.Builder |
charge(int charge)
Set the charge.
|
boolean |
isEmpty()
Returns true if there are no atoms in this builder and the charge is 0
|
static String |
makeFormula(gnu.trove.map.TObjectIntMap<Atom> atomCounterMap,
int charge)
Make the atomic formula given an
atomCounterMap and charge |
String |
toString()
Return the atomic composition string defined in AtomicCompositionParser
|
public Composition.Builder()
public Composition.Builder(AtomicSymbol atom)
atomatom - the first atom to add to the builderpublic Composition.Builder(AtomicSymbol atom, int count)
atom count timesatom - the first atom to add to the buildercount - the number of times to add the atompublic Composition.Builder charge(int charge)
public Composition.Builder add(AtomicSymbol atom)
atom - the symbol of the atom to addpublic Composition.Builder add(AtomicSymbol atom, int count)
count atoms for the specified AtomicSymbolatom - the symbol of the atom to addcount - the number of times that the atom is to be addedpublic Composition.Builder addIsotope(AtomicSymbol symbol, int isotope)
symbol - the symbol of the atom to addisotope - the isotope numberpublic Composition.Builder addIsotope(AtomicSymbol symbol, int isotope, int count)
count times for the specified symbol and isotopesymbol - the symbol of the atom to addisotope - the isotope numbercount - the number of times to add the atompublic Composition.Builder add(Atom atom, int count)
atom count times.atom - the atom to addcount - the number of atoms to addpublic Composition build()
public String toString()
toString in class ObjectAtomicCompositionParserpublic static String makeFormula(gnu.trove.map.TObjectIntMap<Atom> atomCounterMap, int charge)
atomCounterMap and chargeatomCounterMap - map containing the counts for the atomscharge - the chargepublic Composition.Builder addAll(Composition composition)
composition to thiscomposition - the compositionpublic boolean isEmpty()
Copyright © 2016. All Rights Reserved.