// Path: source/org/helm/notation/NotationException.java
// public class NotationException extends Exception {
// 
// 	/**
// 	 * Creates a new instance of <code>NotationException</code> without detail
// 	 * message.
// 	 */
// 	public NotationException() {
// 	}
// 
// 	/**
// 	 * Constructs an instance of <code>NotationException</code> with the
// 	 * specified detail message.
// 	 * 
// 	 * @param msg
// 	 *            the detail message.
// 	 */
// 	public NotationException(String msg) {
// 		super(msg);
// 	}
// 
// 	public NotationException(String msg, Throwable err) {
// 		super(msg, err);
// 	}
// }
// 
// Path: source/org/helm/notation/StructureException.java
// public class StructureException extends Exception {
// 
// 	/**
// 	 * Creates a new instance of <code>StructureException</code> without detail
// 	 * message.
// 	 */
// 	public StructureException() {
// 	}
// 
// 	/**
// 	 * Constructs an instance of <code>StructureException</code> with the
// 	 * specified detail message.
// 	 * 
// 	 * @param msg
// 	 *            the detail message.
// 	 */
// 	public StructureException(String msg) {
// 		super(msg);
// 	}
// 
// 	public StructureException(String msg, Throwable err) {
// 		super(msg, err);
// 	}
// }
// 
// Path: source/org/helm/notation/model/MoleculeInfo.java
// public class MoleculeInfo {
// 	private double molecularWeight;
// 	private String molecularFormula;
// 	private double exactMass;
// 
// 	public double getMolecularWeight() {
// 		return molecularWeight;
// 	}
// 
// 	public void setMolecularWeight(double molecularWeight) {
// 		this.molecularWeight = molecularWeight;
// 	}
// 
// 	public String getMolecularFormula() {
// 		return molecularFormula;
// 	}
// 
// 	public void setMolecularFormula(String molecularFormula) {
// 		this.molecularFormula = molecularFormula;
// 	}
// 
// 	public double getExactMass() {
// 		return exactMass;
// 	}
// 
// 	public void setExactMass(double exactMass) {
// 		this.exactMass = exactMass;
// 	}
// }


import org.helm.notation.model.MoleculeInfo;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.TreeMap;
import chemaxon.formats.MolImporter;
import chemaxon.marvin.calculations.ElementalAnalyserPlugin;
import chemaxon.marvin.plugin.PluginException;
import chemaxon.struc.MolAtom;
import chemaxon.struc.MolBond;
import chemaxon.struc.Molecule;
import org.helm.notation.NotationException;
import org.helm.notation.StructureException;

	 * 
	 * @param smiles
	 *            SMILES string to be validated
	 * @return true or false
	 * @throws java.io.IOException
	 */
	public static boolean validateSmiles(String smiles) throws IOException {
		Molecule mol = getMolecule(smiles);
		for (int i = 0; i < mol.getAtomCount(); i++) {
			MolAtom a = mol.getAtom(i);
			a.valenceCheck();
			if (a.hasValenceError()) {
				return false;
			}
		}
		return true;
	}

	/**
	 * This method removes everything in ChemAxon Extended SMILES extension, but
	 * Atom Position Input: [*][H].O[*].OC1=CC=C(C[C@H](N[*])C([*])=O)C=C1
	 * |r,$_R1;;;_R2;;;;;;;;;_R1;;_R2;;;$,c:14,t:3,5| Output:
	 * [*][H].O[*].OC1=CC=C(C[C@H](N[*])C([*])=O)C=C1
	 * |$_R1;;;_R2;;;;;;;;;_R1;;_R2;;;$|
	 * 
	 * @param extendedSMILES
	 * @return simpleExtendedSMILES
	 * @throws org.helm.notation.StructureException
	 */
	public static String getSimpleExtendedSMILES(String extendedSMILES)

// Path: source/org/helm/notation/NotationException.java
// public class NotationException extends Exception {
// 
// 	/**
// 	 * Creates a new instance of <code>NotationException</code> without detail
// 	 * message.
// 	 */
// 	public NotationException() {
// 	}
// 
// 	/**
// 	 * Constructs an instance of <code>NotationException</code> with the
// 	 * specified detail message.
// 	 * 
// 	 * @param msg
// 	 *            the detail message.
// 	 */
// 	public NotationException(String msg) {
// 		super(msg);
// 	}
// 
// 	public NotationException(String msg, Throwable err) {
// 		super(msg, err);
// 	}
// }
// 
// Path: source/org/helm/notation/StructureException.java
// public class StructureException extends Exception {
// 
// 	/**
// 	 * Creates a new instance of <code>StructureException</code> without detail
// 	 * message.
// 	 */
// 	public StructureException() {
// 	}
// 
// 	/**
// 	 * Constructs an instance of <code>StructureException</code> with the
// 	 * specified detail message.
// 	 * 
// 	 * @param msg
// 	 *            the detail message.
// 	 */
// 	public StructureException(String msg) {
// 		super(msg);
// 	}
// 
// 	public StructureException(String msg, Throwable err) {
// 		super(msg, err);
// 	}
// }
// 
// Path: source/org/helm/notation/model/MoleculeInfo.java
// public class MoleculeInfo {
// 	private double molecularWeight;
// 	private String molecularFormula;
// 	private double exactMass;
// 
// 	public double getMolecularWeight() {
// 		return molecularWeight;
// 	}
// 
// 	public void setMolecularWeight(double molecularWeight) {
// 		this.molecularWeight = molecularWeight;
// 	}
// 
// 	public String getMolecularFormula() {
// 		return molecularFormula;
// 	}
// 
// 	public void setMolecularFormula(String molecularFormula) {
// 		this.molecularFormula = molecularFormula;
// 	}
// 
// 	public double getExactMass() {
// 		return exactMass;
// 	}
// 
// 	public void setExactMass(double exactMass) {
// 		this.exactMass = exactMass;
// 	}
// }


// Path: source/org/helm/notation/tools/StructureParser.java
import org.helm.notation.model.MoleculeInfo;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.TreeMap;
import chemaxon.formats.MolImporter;
import chemaxon.marvin.calculations.ElementalAnalyserPlugin;
import chemaxon.marvin.plugin.PluginException;
import chemaxon.struc.MolAtom;
import chemaxon.struc.MolBond;
import chemaxon.struc.Molecule;
import org.helm.notation.NotationException;
import org.helm.notation.StructureException;

	 * 
	 * @param smiles
	 *            SMILES string to be validated
	 * @return true or false
	 * @throws java.io.IOException
	 */
	public static boolean validateSmiles(String smiles) throws IOException {
		Molecule mol = getMolecule(smiles);
		for (int i = 0; i < mol.getAtomCount(); i++) {
			MolAtom a = mol.getAtom(i);
			a.valenceCheck();
			if (a.hasValenceError()) {
				return false;
			}
		}
		return true;
	}

	/**
	 * This method removes everything in ChemAxon Extended SMILES extension, but
	 * Atom Position Input: [*][H].O[*].OC1=CC=C(C[C@H](N[*])C([*])=O)C=C1
	 * |r,$_R1;;;_R2;;;;;;;;;_R1;;_R2;;;$,c:14,t:3,5| Output:
	 * [*][H].O[*].OC1=CC=C(C[C@H](N[*])C([*])=O)C=C1
	 * |$_R1;;;_R2;;;;;;;;;_R1;;_R2;;;$|
	 * 
	 * @param extendedSMILES
	 * @return simpleExtendedSMILES
	 * @throws org.helm.notation.StructureException
	 */
	public static String getSimpleExtendedSMILES(String extendedSMILES)

			throws StructureException {
