com.waveset.expression
Class ExFunction

java.lang.Object
  extended bycom.waveset.expression.ExFunction

public class ExFunction
extends java.lang.Object

A collection of built-in function classes.

We have a lot of these, so rather than try to break them all out into their own class file, we make them inner classes of ExFunction.

There's nothing magic about things in here vs. things in their own file, its just a bit easier to deal with. We can use reflection to find the classes to instantiate rather than having a huge switch bank of comparisons.


Nested Class Summary
static class ExFunction.f_add
          The function node for the <add> expression.
static class ExFunction.f_and
          The function node for the <and> expression.
static class ExFunction.f_append
          The function node for the <append> expression.
static class ExFunction.f_appendAll
          The function node for the <appendAll> expression.
static class ExFunction.f_array
           
static class ExFunction.f_break
           
static class ExFunction.f_breakpoint
           
static class ExFunction.f_case
           
static class ExFunction.f_cmp
          The function node for the <cmp> expression.
static class ExFunction.f_concat
          The function node for the <concat> expression.
static class ExFunction.f_cond
           
static class ExFunction.f_contains
           
static class ExFunction.f_containsAll
           
static class ExFunction.f_containsAny
           
static class ExFunction.f_div
          The function node for the <div> expression.
static class ExFunction.f_dolist
           
static class ExFunction.f_downcase
          The function node for the <downcase> expression.
static class ExFunction.f_eq
          The function node for the <eq> expression.
static class ExFunction.f_expand
           
static class ExFunction.f_filterdup
          The function node for the <filterdup> expression.
static class ExFunction.f_filternull
          The function node for the <filternull> expression.
static class ExFunction.f_getobj
          The function node for the <getobj> expression.
static class ExFunction.f_gt
          The function node for the <gt> expression.
static class ExFunction.f_gte
          The function node for the <gte> expression.
static class ExFunction.f_index
           
static class ExFunction.f_indexOf
          The function node for the <indexOf> expression.
static class ExFunction.f_insert
          The function node for the <insert> expression.
static class ExFunction.f_instanceof
           
static class ExFunction.f_isFalse
           
static class ExFunction.f_isnull
          The function node for the <isnull> expression.
static class ExFunction.f_isTrue
          Semi kludge to test for logical truth.
static class ExFunction.f_join
           
static class ExFunction.f_lconcat
          The function node for the <lconcat> expression.
static class ExFunction.f_length
          The function node for the <length> expression.
static class ExFunction.f_list
           
static class ExFunction.f_lt
          The function node for the <lt> expression.
static class ExFunction.f_lte
          The function node for the <lte> expression.
static class ExFunction.f_ltrim
          The function node for the <ltrim> expression.
static class ExFunction.f_map
           
static class ExFunction.f_match
           
static class ExFunction.f_member
           
static class ExFunction.f_message
           
static class ExFunction.f_mod
          The function node for the <mod> expression.
static class ExFunction.f_mult
          The function node for the <mult> expression.
static class ExFunction.f_ncmp
          The function node for the <ncmp> expression.
static class ExFunction.f_neq
          The function node for the <neq> expression.
static class ExFunction.f_not
          The function node for the <not> expression.
static class ExFunction.f_notnull
          The function node for the <notnull> expression.
static class ExFunction.f_null
          The function node for the <null> expression.
static class ExFunction.f_or
          The function node for the <or> expression.
static class ExFunction.f_pad
          The function node for the <pad> expression.
static class ExFunction.f_remove
          The function node for the <remove> expression.
static class ExFunction.f_removeAll
          The function node for the <removeAll> expression.
static class ExFunction.f_retainAll
           
static class ExFunction.f_rtrim
          The function node for the <rtrim> expression.
static class ExFunction.f_select
           
static class ExFunction.f_split
          The function node for the <split> expression.
static class ExFunction.f_sub
          The function node for the <sub> expression.
static class ExFunction.f_substr
          The function node for the <substr> expression.
static class ExFunction.f_switch
           
static class ExFunction.f_trace
           
static class ExFunction.f_trim
          The function node for the <trim> expression.
static class ExFunction.f_upcase
          The function node for the <upcase> expression.
static class ExFunction.f_while
           
static class ExFunction.f_ztrim
          The function node for the <ztrim> expression.
static class ExFunction.ListMutator
          Abstract superclass for a function node that may modify a list.
 
Field Summary
static java.lang.String code_id
           
 
Constructor Summary
ExFunction()
           
 
Method Summary
static boolean compare(ExValue v1, ExValue v2)
          Equality comparison utility.
static ExValue compareEqual(ExState state, ExNode node, boolean invert)
          Shared equality checker for f_eq and f_neq.
static ExNode parse(org.w3c.dom.Element el)
          Build an appropriate ExNode class for the function element.
static ExValue xtrim(ExState state, ExNode[] children, boolean left, boolean right)
          Shared implemenation of a method that can perform various trimming operations.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

code_id

public static final java.lang.String code_id
See Also:
Constant Field Values
Constructor Detail

ExFunction

public ExFunction()
Method Detail

parse

public static ExNode parse(org.w3c.dom.Element el)
                    throws WavesetException
Build an appropriate ExNode class for the function element.

This is a static method, since we're not an ExNode class, and we don't know what class to build until we look at the XML.

Throws:
WavesetException

compare

public static boolean compare(ExValue v1,
                              ExValue v2)
Equality comparison utility. Use ExValue.compare if both are non-null, otherwise treat null pointers and null objects as the same. !! NOTE: this logic will cause a comparison with null and 0 to be false. In almost every other case, null is automatically coerced to 0 when used with integer functions (as is with C). It is arguably more consistent to treat null as zero here, but that raises other issues, as then null and "0" ought to be equal since 0 and "0" are equal.


compareEqual

public static ExValue compareEqual(ExState state,
                                   ExNode node,
                                   boolean invert)
                            throws WavesetException
Shared equality checker for f_eq and f_neq.

Throws:
WavesetException

xtrim

public static ExValue xtrim(ExState state,
                            ExNode[] children,
                            boolean left,
                            boolean right)
                     throws WavesetException
Shared implemenation of a method that can perform various trimming operations.

There is more we could do here to minimize allocation. If ExValue had its own raw char[] array we could directly manipulate it.

Throws:
WavesetException