Package gnu.jel

Class DVMap

java.lang.Object
gnu.jel.DVMap

public abstract class DVMap
extends java.lang.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

    Constructors 
    Constructor Description
    DVMap()  
  • Method Summary

    Modifier and Type Method Description
    abstract java.lang.String getTypeName​(java.lang.String name)
    Returns the name of the type of the named property.
    java.lang.Object translate​(java.lang.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 Details

  • Method Details

    • getTypeName

      public abstract java.lang.String getTypeName​(java.lang.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.

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

      public java.lang.Object translate​(java.lang.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.

      Parameters:
      name - Name of the variable to be translated.
      Returns:
      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.
      Since:
      0.9.9