|
// This class is both used to resolve the dynamic variable names and
// to provide their values. These two functions can also be
// implemented by two different classes.
public class DVResolverProvider extends gnu.jel.DVMap {
private java.util.HashMap<String,Object> properties=
new java.util.HashMap<String,Object>();
// adds a new property
protected void addProperty(String name,Object value) {
properties.put(name,value);
};
// implements the method of DVResolver interface,
// used by the compiler to query about available dynamic
// variables
public String getTypeName(String name) {
Object val=properties.get(name);
if (val==null) return null; // dynamic variable does not exist
if (val instanceof Data) return "Data";
if (val instanceof String) return "String";
// the type is not supported we say the variable is not defined
return null;
};
// Next we have those YYY getXXXProperty(String) methods described in
// the manual
public Data getDataProperty(String name) {
return (Data)properties.get(name);
};
public String getStringProperty(String name) {
return (String)properties.get(name);
};
};
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I am an analytical chemist and an educator. I program primarily to perform matrix computations for regression analysis, process signals, acquire data from sensors, and to control devices.
I participate in many open source development communities and Linux user forums. I do contract work for an environmental analytical laboratory, where I am primarily focused on LIMS programming and network administration.
I am a member of several community-interest groups such as the Prince Edward Island Watershed Alliance, the Lot 11 and Area Watershed Management Group, and the Petersham Historic Commission.