package jsci.chemistry;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import jsci.physics.*;
/**
* A class representing molecules.
* @version 0.2
* @author Mark Hale
*/
public class Molecule extends Particle {
/**
* Atoms.
*/
private final Set atoms = new HashSet();
/**
* Constructs a molecule from a chemical formula.
*/
public Molecule(String formula) {
if(formula == null || formula.length() == 0)
throw new IllegalArgumentException("Formula cannot be null or empty.");
int startPos = 0, endPos;
boolean isNumber = false;
String symbol = null;
int count;
for(int i=1; i
Ads help maintain this website.