Class DVMap

  extended by gnu.jel.DVMap

public abstract class DVMap
extends Object

Provides the information about defined dynamic variables.

Allows to translate variable names into constants of Java primitive types at compile-time. See the section of the manual on dynamic variables.

Constructor Summary
Method Summary
abstract  String getTypeName(String name)
          Returns the name of the type of the named property.
 Object translate(String name)
          Translates the variable name (a String) to a constant of any primtive type (e.g.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public DVMap()
Method Detail


public abstract String getTypeName(String name)
Returns the name of the type of the named property.

The dot ('.') symbol can be present in the property name to denote hierarchical naming scheme.

If hierarchical naming scheme is used and the variable x.y is defined the variable x must also be defined.

name - is the name of the property.
the XXX in the name of the corresponding getXXXProperty() method of dynamic library, null if the variable with the given name is not defined.


public Object translate(String name)
Translates the variable name (a String) to a constant of any primtive type (e.g. a number).

The performance of the compiled code can be sometimes improved by letting it not to deal with strings. For example, in older JEL <=0.9.8 this method was absent, and, if the underlying representation of the dynamic variables storage was an array, the translation of variable name (represented by String) into integer index had to happen at run-time, taking up the valuable processor cycles. Defining the proper DVMap.translate one can perform the translation "variable name(String)"->"slot number(int)" at compile time. There can be also other clever ways of using translation to improve performance even if variables are not stored in an array or vector.

The default implementation provides the identity translation, which simulates the behaviour of older versions of JEL.

name - Name of the variable to be translated.
Object representing the translated name, this object must be either a reflection type wrapping a primitive (e.g. java.lang.Integer, java.lang.Byte) or String. No other object is allowed, othwerwise an exception will emerge at compile-time. This limitation is due to Java class file format not allowing to store constants of types other than specified above.

Copyright © 1998-2009 Konstantin L. Metlov All Rights Reserved.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the JEL manual.