Click here to Skip to main content
15,884,099 members
Articles / Web Development / HTML

Discrete Wavelet Transforms, a Java Implementation

Rate me:
Please Sign up or sign in to vote.
4.95/5 (16 votes)
13 Nov 2014CPOL10 min read 60.5K   5.6K   19  
This article presents a Java example application that performs discrete wavelet transforms.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_03) on Fri Oct 12 20:27:18 EEST 2007 -->
<TITLE>
Library (JEL API)
</TITLE>

<META NAME="date" CONTENT="2007-10-12">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">

<SCRIPT type="text/javascript">
function windowTitle()
{
    if (location.href.indexOf('is-external=true') == -1) {
        parent.document.title="Library (JEL API)";
    }
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>

</HEAD>

<BODY BGCOLOR="white" onload="windowTitle();">
<HR>


<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Library.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../gnu/jel/ImageLoader.html" title="class in gnu.jel"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../gnu/jel/LocalField.html" title="class in gnu.jel"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../index.html?gnu/jel/Library.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="Library.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>


</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->

<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
gnu.jel</FONT>
<BR>
Class Library</H2>
<PRE>
java.lang.Object
  <IMG SRC="../../resources/inherit.gif" ALT="extended by "><B>gnu.jel.Library</B>
</PRE>
<HR>
<DL>
<DT><PRE>public class <B>Library</B><DT>extends java.lang.Object</DL>
</PRE>

<P>
A namespace for JEL expressions.
 <P> There are two types of members in the library, those which are stateless
 (i.e. their value depends only on their arguments, if there are any) and
 stateful (also called here dynamic). The result of evaluation of 
 stateful members may depend on other factors besides their arguments.

 <P>Examples of possible stateless members are : <TT>Math.sin(double)</TT>,
 <TT>Math.PI</TT>.
 <P>Examples of possible stateful members are : <TT>Math.random()</TT>,
 <TT>System.currentTimeMillis()</TT>.

 <P>Stateless members of this library are always static members of the 
 classes, which define them. The inverse is generally not true. However,
 this library goes as far as assuming that static members are stateless, 
 if this assumption does not hold for some of Your members it is possible to 
 mark them as stateful using the <TT>markStateDependent()</TT> method of
 this class.

 <P>The most crucial difference between the two kind of members of this
 library is that evaluation of stateless methods is attempted by JEL at
 a compile time during the constants folding phase.
<P>

<P>
<HR>

<P>
<!-- =========== FIELD SUMMARY =========== -->

<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Field Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;java.util.HashMap&lt;java.lang.String,java.lang.Class&gt;</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../gnu/jel/Library.html#cnmap">cnmap</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../gnu/jel/DVMap.html" title="class in gnu.jel">DVMap</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../gnu/jel/Library.html#resolver">resolver</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
</TABLE>
&nbsp;
<!-- ======== CONSTRUCTOR SUMMARY ======== -->

<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../gnu/jel/Library.html#Library(java.lang.Class[], java.lang.Class[])">Library</A></B>(java.lang.Class[]&nbsp;staticLib,
        java.lang.Class[]&nbsp;dynamicLib)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;<I>Please us 5 argument constructor with unused arguments
  set to <TT>null</TT>. This constructor is scheduled for removal in
  JEL 1.0.</I></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../gnu/jel/Library.html#Library(java.lang.Class[], java.lang.Class[], java.lang.Class[])">Library</A></B>(java.lang.Class[]&nbsp;staticLib,
        java.lang.Class[]&nbsp;dynamicLib,
        java.lang.Class[]&nbsp;dotClasses)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;<I>Please us 5 argument constructor with unused arguments
  set to <TT>null</TT>. This constructor is scheduled for removal in
  JEL 1.0.</I></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../gnu/jel/Library.html#Library(java.lang.Class[], java.lang.Class[], java.lang.Class[], gnu.jel.DVMap)">Library</A></B>(java.lang.Class[]&nbsp;staticLib,
        java.lang.Class[]&nbsp;dynamicLib,
        java.lang.Class[]&nbsp;dotClasses,
        <A HREF="../../gnu/jel/DVMap.html" title="class in gnu.jel">DVMap</A>&nbsp;resolver)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;<I>Please us 5 argument constructor with unused arguments
  set to <TT>null</TT>. This constructor is scheduled for removal in
  JEL 1.0.</I></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../gnu/jel/Library.html#Library(java.lang.Class[], java.lang.Class[], java.lang.Class[], gnu.jel.DVMap, java.util.HashMap)">Library</A></B>(java.lang.Class[]&nbsp;staticLib,
        java.lang.Class[]&nbsp;dynamicLib,
        java.lang.Class[]&nbsp;dotClasses,
        <A HREF="../../gnu/jel/DVMap.html" title="class in gnu.jel">DVMap</A>&nbsp;resolver,
        java.util.HashMap&lt;java.lang.String,java.lang.Class&gt;&nbsp;cnmap)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a library for JEL.</TD>
</TR>
</TABLE>
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->

<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../gnu/jel/Library.html#describe(java.lang.String, java.lang.Class[])">describe</A></B>(java.lang.String&nbsp;name,
         java.lang.Class[]&nbsp;params)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../gnu/jel/Library.html#getDynamicMethodClassID(java.lang.reflect.Member)">getDynamicMethodClassID</A></B>(java.lang.reflect.Member&nbsp;m)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns ID (position in the object array) of the dynamic method.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;java.lang.reflect.Member</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../gnu/jel/Library.html#getMember(java.lang.Class, java.lang.String, java.lang.Class[])">getMember</A></B>(java.lang.Class&nbsp;container,
          java.lang.String&nbsp;name,
          java.lang.Class[]&nbsp;params)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Searches the namespace defined by this library object for method or field.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.Class[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../gnu/jel/Library.html#getParameterTypes(java.lang.reflect.Member)">getParameterTypes</A></B>(java.lang.reflect.Member&nbsp;m)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Used to get types of formal parameters of a member.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../gnu/jel/Library.html#getSignature(java.lang.Class)">getSignature</A></B>(java.lang.Class&nbsp;cls)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Computes the signature of the given class.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../gnu/jel/Library.html#getSignature(java.lang.reflect.Member)">getSignature</A></B>(java.lang.reflect.Member&nbsp;m)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Computes signature of the given member.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.Class</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../gnu/jel/Library.html#getType(java.lang.reflect.Member)">getType</A></B>(java.lang.reflect.Member&nbsp;m)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Used to get return type of a class member.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../gnu/jel/Library.html#isField(java.lang.reflect.Member)">isField</A></B>(java.lang.reflect.Member&nbsp;m)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../gnu/jel/Library.html#isStateless(java.lang.reflect.Member)">isStateless</A></B>(java.lang.reflect.Member&nbsp;o)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Used to check if the given method is stateless.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../gnu/jel/Library.html#markStateDependent(java.lang.String, java.lang.Class[])">markStateDependent</A></B>(java.lang.String&nbsp;name,
                   java.lang.Class[]&nbsp;params)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This method marks a static member as having the internal state.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../gnu/jel/Library.html#toHistoricalForm(java.lang.String)">toHistoricalForm</A></B>(java.lang.String&nbsp;className)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>

<!-- ============ FIELD DETAIL =========== -->

<A NAME="field_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Field Detail</B></FONT></TH>
</TR>
</TABLE>

<A NAME="resolver"><!-- --></A><H3>
resolver</H3>
<PRE>
public <A HREF="../../gnu/jel/DVMap.html" title="class in gnu.jel">DVMap</A> <B>resolver</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>

<A NAME="cnmap"><!-- --></A><H3>
cnmap</H3>
<PRE>
public java.util.HashMap&lt;java.lang.String,java.lang.Class&gt; <B>cnmap</B></PRE>
<DL>
<DL>
</DL>
</DL>

<!-- ========= CONSTRUCTOR DETAIL ======== -->

<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>

<A NAME="Library(java.lang.Class[], java.lang.Class[])"><!-- --></A><H3>
Library</H3>
<PRE>
<FONT SIZE="-1">@Deprecated
</FONT>public <B>Library</B>(java.lang.Class[]&nbsp;staticLib,
                          java.lang.Class[]&nbsp;dynamicLib)</PRE>
<DL>
<DD><B>Deprecated.</B>&nbsp;<I>Please us 5 argument constructor with unused arguments
  set to <TT>null</TT>. This constructor is scheduled for removal in
  JEL 1.0.</I>
<P>
<DD>Creates a library for JEL.
 <P> See the three argument constructor for more info.
<P>
<DL>
<DT><B>Parameters:</B><DD><CODE>staticLib</CODE> - is the array of classes, whose public static 
  methods are exported.<DD><CODE>dynamicLib</CODE> - is the array of classes, whose public virutal
  methods are exported.</DL>
</DL>
<HR>

<A NAME="Library(java.lang.Class[], java.lang.Class[], java.lang.Class[])"><!-- --></A><H3>
Library</H3>
<PRE>
<FONT SIZE="-1">@Deprecated
</FONT>public <B>Library</B>(java.lang.Class[]&nbsp;staticLib,
                          java.lang.Class[]&nbsp;dynamicLib,
                          java.lang.Class[]&nbsp;dotClasses)</PRE>
<DL>
<DD><B>Deprecated.</B>&nbsp;<I>Please us 5 argument constructor with unused arguments
  set to <TT>null</TT>. This constructor is scheduled for removal in
  JEL 1.0.</I>
<P>
<DD>Creates a library for JEL.
 <P> See the three argument constructor for more info.
<P>
<DL>
<DT><B>Parameters:</B><DD><CODE>staticLib</CODE> - is the array of classes, whose public static 
  methods are exported.<DD><CODE>dynamicLib</CODE> - is the array of classes, whose public virutal
  methods are exported.<DD><CODE>dotClasses</CODE> - Controls access to the "dot" operator on classes.</DL>
</DL>
<HR>

<A NAME="Library(java.lang.Class[], java.lang.Class[], java.lang.Class[], gnu.jel.DVMap)"><!-- --></A><H3>
Library</H3>
<PRE>
<FONT SIZE="-1">@Deprecated
</FONT>public <B>Library</B>(java.lang.Class[]&nbsp;staticLib,
                          java.lang.Class[]&nbsp;dynamicLib,
                          java.lang.Class[]&nbsp;dotClasses,
                          <A HREF="../../gnu/jel/DVMap.html" title="class in gnu.jel">DVMap</A>&nbsp;resolver)</PRE>
<DL>
<DD><B>Deprecated.</B>&nbsp;<I>Please us 5 argument constructor with unused arguments
  set to <TT>null</TT>. This constructor is scheduled for removal in
  JEL 1.0.</I>
<P>
<DD>Creates a library for JEL.
 <P> See the three argument constructor for more info.
<P>
<DL>
<DT><B>Parameters:</B><DD><CODE>staticLib</CODE> - is the array of classes, whose public static 
  methods are exported.<DD><CODE>dynamicLib</CODE> - is the array of classes, whose public virutal
  methods are exported.<DD><CODE>dotClasses</CODE> - Controls access to the "dot" operator on classes.<DD><CODE>resolver</CODE> - Controls resolution of dynamic variables.</DL>
</DL>
<HR>

<A NAME="Library(java.lang.Class[], java.lang.Class[], java.lang.Class[], gnu.jel.DVMap, java.util.HashMap)"><!-- --></A><H3>
Library</H3>
<PRE>
public <B>Library</B>(java.lang.Class[]&nbsp;staticLib,
               java.lang.Class[]&nbsp;dynamicLib,
               java.lang.Class[]&nbsp;dotClasses,
               <A HREF="../../gnu/jel/DVMap.html" title="class in gnu.jel">DVMap</A>&nbsp;resolver,
               java.util.HashMap&lt;java.lang.String,java.lang.Class&gt;&nbsp;cnmap)</PRE>
<DL>
<DD>Creates a library for JEL.
 <P> The following should be kept in mind when constructing a library:
 <OL>
 <LI>This constructor may throw IllegalArgumentException if it does not
 like something in Your library. The requirements to the method names
 are somewhat more strict, than in Java because members of several
 classes can be merged in root namespace.
 <LI>When calling the 
 <TT>CompiledExpression.evaluate(Object[] dynalib)</TT> of the
 expression, using dynamic library methods it is needed to pass as
  <TT>dynalib</TT> parameter the array of objects, of the classes 
 _exactly_ in the same order as they are appearing in the
 <TT>dynamicLib</TT> parameter of this constructor. If You do not
 allow to call dynamic methods (there is no sense, then, to use a compiler)
 it is possible to pass <TT>null</TT> istead of <TT>dynalib</TT>.
 <LI> Generally speaking, this class should not let You to create wrong
 libraries. It's methods will throw exceptions, return <TT>false</TT>'s , 
 ignore Your actions,... ;)
 </OL>
 If methods in the library classes conflict with each other, the last
 conflicting method will be skipped. You will not get any messages unless
 debugging is ON (see <TT>gnu.jel.debug.Debug.enabled</TT>). This is
 done to avoid unnecessary error messages in the production code of the
 compiler.
 <P>The array (dotClasses), which is the third argument of 
 this constructor determines how (and whether) to compile the 
 dot operators encountered in expressions. These operators are
 of the form &lt;object&gt;.(&lt;method&gt;|&lt;field&gt;), 
 which means to call method (access field)
 of an &lt;object&gt;. There can be three types of the behaviour: 
 <P>1) dot operators are prohibited (<TT>dotClasses==null</TT>),
 this is behaviour of older version of JEL.
 <P>2) dot operators are allowed on all classes
 (<tt>dotClasses==new Class[0]</tt>, an empty array).
 Depending on the types of objects returned by the static/dynamic library
 classes this may pose a security risk.
 <P>3) dot operators are allowed only on some classes. This is achieved 
 by listing these classes in the dotClasses array.
<P>
<DL>
<DT><B>Parameters:</B><DD><CODE>staticLib</CODE> - is the array of classes, whose public static 
  methods are exported.<DD><CODE>dynamicLib</CODE> - is the array of classes, whose public virutal
  methods are exported.<DD><CODE>dotClasses</CODE> - is the array of classes on which the dot ('.')
 operation is allowed.<DD><CODE>resolver</CODE> - is the object used to resolve the names.<DD><CODE>cnmap</CODE> - Maps class names into classes for non-primitive type casts.</DL>
</DL>

<!-- ============ METHOD DETAIL ========== -->

<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>

<A NAME="markStateDependent(java.lang.String, java.lang.Class[])"><!-- --></A><H3>
markStateDependent</H3>
<PRE>
public void <B>markStateDependent</B>(java.lang.String&nbsp;name,
                               java.lang.Class[]&nbsp;params)
                        throws <A HREF="../../gnu/jel/CompilationException.html" title="class in gnu.jel">CompilationException</A></PRE>
<DL>
<DD>This method marks a static member as having the internal state.
 <P> If <TT>java.lang.Math</TT> is included into the library it is
 necessary to mark <TT>java.lang.Math.random()</TT> as having the
 state. This can be done by calling
 <TT>markStateDependent("random",null)</TT>.
 <P> Please specify parameters as close as possible, otherwise you can
 accidentally mark another function.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>name</CODE> - is the function name.<DD><CODE>params</CODE> - are the possible invocation parameters of the function.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../gnu/jel/CompilationException.html" title="class in gnu.jel">CompilationException</A></CODE> - if the method can't be resolved</DL>
</DD>
</DL>
<HR>

<A NAME="isStateless(java.lang.reflect.Member)"><!-- --></A><H3>
isStateless</H3>
<PRE>
public boolean <B>isStateless</B>(java.lang.reflect.Member&nbsp;o)</PRE>
<DL>
<DD>Used to check if the given method is stateless.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>o</CODE> - is method or field to check.
<DT><B>Returns:</B><DD>true if the method is stateless and can be invoked at
    compile time.</DL>
</DD>
</DL>
<HR>

<A NAME="getMember(java.lang.Class, java.lang.String, java.lang.Class[])"><!-- --></A><H3>
getMember</H3>
<PRE>
public java.lang.reflect.Member <B>getMember</B>(java.lang.Class&nbsp;container,
                                          java.lang.String&nbsp;name,
                                          java.lang.Class[]&nbsp;params)
                                   throws <A HREF="../../gnu/jel/CompilationException.html" title="class in gnu.jel">CompilationException</A></PRE>
<DL>
<DD>Searches the namespace defined by this library object for method or field.
 <P> The method with the same name, and closest (convertible) parameter
 types is returned. If there are several methods the most specific one
 is used. 
 <P>Ambiguities are detected. Example of detectable ambiguity:<BR>
 you ask for a call <TT>someName(int, int)</TT>, but there are two
 applicable methods <TT>someName(int, double)</TT> and
 <TT>someName(double, int)</TT>. Requirements to parameter types
 of both can be satisfied by _widening_ conversions. Thus, there
 is no most specific method of these two in terms of Java Language
 Specification (15.11.2.2). It means, that an ambiguity is present,
 and null will be returned.
 <P> Java compiler normally would not allow to define such ambiguous 
 methods in the same class. However, as this library is assembled from
 several Java classes, such ambiguities can happen, and should be
 detected.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>container</CODE> - the class to search the method within, if <TT>null</TT>
                  the root namespace is searched.<DD><CODE>name</CODE> - is the name of the method to find.<DD><CODE>params</CODE> - are the types of formal parameters in the method invocation.
<DT><B>Returns:</B><DD>the method/field object of the resolved method/field.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../gnu/jel/CompilationException.html" title="class in gnu.jel">CompilationException</A></CODE> - if the method can't be resolved</DL>
</DD>
</DL>
<HR>

<A NAME="describe(java.lang.String, java.lang.Class[])"><!-- --></A><H3>
describe</H3>
<PRE>
protected static java.lang.String <B>describe</B>(java.lang.String&nbsp;name,
                                           java.lang.Class[]&nbsp;params)</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="getDynamicMethodClassID(java.lang.reflect.Member)"><!-- --></A><H3>
getDynamicMethodClassID</H3>
<PRE>
public int <B>getDynamicMethodClassID</B>(java.lang.reflect.Member&nbsp;m)</PRE>
<DL>
<DD>Returns ID (position in the object array) of the dynamic method.
 <P> ID's are used to locate the pointers to the objects, implementing
 dynamic methods, in the array, argument of evaluate(Object[]) function.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>m</CODE> - method to get an ID of.
<DT><B>Returns:</B><DD>the ID of the method or -1 if the method is static.
<DT><B>Throws:</B>
<DD><CODE>java.lang.NullPointerException</CODE> - if method is not a dynamic method of
            this library.</DL>
</DD>
</DL>
<HR>

<A NAME="getType(java.lang.reflect.Member)"><!-- --></A><H3>
getType</H3>
<PRE>
public static java.lang.Class <B>getType</B>(java.lang.reflect.Member&nbsp;m)</PRE>
<DL>
<DD>Used to get return type of a class member.
 <P>The type of a method is its return type, the type of a constructor is
 void.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>m</CODE> - member whose type is to be determined
<DT><B>Returns:</B><DD>type of the member</DL>
</DD>
</DL>
<HR>

<A NAME="getParameterTypes(java.lang.reflect.Member)"><!-- --></A><H3>
getParameterTypes</H3>
<PRE>
public static java.lang.Class[] <B>getParameterTypes</B>(java.lang.reflect.Member&nbsp;m)</PRE>
<DL>
<DD>Used to get types of formal parameters of a member.
 <P> The reference to the class instance "this" is not counted by
 this method.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>m</CODE> - member whose formal parameters are to be obtained
<DT><B>Returns:</B><DD>array of formal parameter types (empty array if none).</DL>
</DD>
</DL>
<HR>

<A NAME="getSignature(java.lang.reflect.Member)"><!-- --></A><H3>
getSignature</H3>
<PRE>
public static java.lang.String <B>getSignature</B>(java.lang.reflect.Member&nbsp;m)</PRE>
<DL>
<DD>Computes signature of the given member.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>m</CODE> - the member to compute the sugnature of.
<DT><B>Returns:</B><DD>the signature.</DL>
</DD>
</DL>
<HR>

<A NAME="isField(java.lang.reflect.Member)"><!-- --></A><H3>
isField</H3>
<PRE>
public static boolean <B>isField</B>(java.lang.reflect.Member&nbsp;m)</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="getSignature(java.lang.Class)"><!-- --></A><H3>
getSignature</H3>
<PRE>
public static java.lang.String <B>getSignature</B>(java.lang.Class&nbsp;cls)</PRE>
<DL>
<DD>Computes the signature of the given class.
 <P> The signature of the class (Field descriptor) is the string and 
 it's format is described in the paragraph 4.3.2 of the Java VM 
 specification (ISBN 0-201-63451-1).
 <P>The same can be done using <TT>java.lang.Class.getName()</TT> by 
 converting it's result into the "historical form".
 <P> This utility method can be used outside of the JEL package
 it does not involve any JEL specific assumptions and should follow
 JVM Specification precisely.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>cls</CODE> - is the class to compute the signature of. Can be primitive or
            array type.
<DT><B>Returns:</B><DD>the class signature.</DL>
</DD>
</DL>
<HR>

<A NAME="toHistoricalForm(java.lang.String)"><!-- --></A><H3>
toHistoricalForm</H3>
<PRE>
public static java.lang.String <B>toHistoricalForm</B>(java.lang.String&nbsp;className)</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>


<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Library.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../gnu/jel/ImageLoader.html" title="class in gnu.jel"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../gnu/jel/LocalField.html" title="class in gnu.jel"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../index.html?gnu/jel/Library.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="Library.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>


</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->

<HR>
<i>Copyright &#169; 1998-2007 Konstantin L. Metlov All Rights Reserved.</i>
</BODY>
</HTML>

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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Founder PEI Watershed Alliance, Inc.
United States United States
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.

Comments and Discussions