public class Chemical Sample
The ChemicalSample class contains CAChe chemical samples. It reads
samples from an input stream and provides access to the data. The ChemicalSample
class uses ObjectClass.class and Property.class.
The compiled *.class files are freeware and may be used and distributed
with your own software.
Built with Symantec Cafe 1.8 and JDK 1.0.2.
Constructors
ChemicalSample()
Create and initialize a new empty chemical sample object.
Methods
read(InputStream is) throws Exception
Read the chemical sample from the input stream. Example:
String chemicalSampleName = "chemical.csf";
ChemicalSample chemSamp = new ChemicalSample();
try {
InputStream is = new URL(getDocumentBase(),
chemicalSampleName).openStream();
chemSamp.read(is);
} catch(Exception e) {
System.out.println("Error: Unable to read the chemical
sample.");
};
Object get(String objectClass, String propertyName, int i) throws Exception
Return the ith value of the property in the object class as an object.
Example:
Integer atomicNumber = (Integer) chemSamp.get("atom","anum", 0);
int objectClassSize(String objectClass) throws Exception
Return the number of objects in the object class as an int. Example:
int numberOfObjects = chemSamp.objectClassSize("atom");