jaxp/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/compiler/FunctionTable.java
author dfuchs
Tue, 30 Jun 2015 12:04:27 +0200
changeset 31497 4a6b2e733c0d
parent 31204 9afdbf18ad38
child 36520 cb52aa47ff0a
permissions -rw-r--r--
8130051: Cleanup usage of reflection in jaxp Summary: replaced usage of reflection with direct access where possible, removed obsolete code where possible. Reviewed-by: joehw
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6
7f561c08de6b Initial load
duke
parents:
diff changeset
     1
/*
31204
9afdbf18ad38 8087283: Add support for the XML Signature here() function to the JDK XPath implementation
mullan
parents: 25868
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
6
7f561c08de6b Initial load
duke
parents:
diff changeset
     3
 */
31204
9afdbf18ad38 8087283: Add support for the XML Signature here() function to the JDK XPath implementation
mullan
parents: 25868
diff changeset
     4
/**
9afdbf18ad38 8087283: Add support for the XML Signature here() function to the JDK XPath implementation
mullan
parents: 25868
diff changeset
     5
 * Licensed to the Apache Software Foundation (ASF) under one
9afdbf18ad38 8087283: Add support for the XML Signature here() function to the JDK XPath implementation
mullan
parents: 25868
diff changeset
     6
 * or more contributor license agreements. See the NOTICE file
9afdbf18ad38 8087283: Add support for the XML Signature here() function to the JDK XPath implementation
mullan
parents: 25868
diff changeset
     7
 * distributed with this work for additional information
9afdbf18ad38 8087283: Add support for the XML Signature here() function to the JDK XPath implementation
mullan
parents: 25868
diff changeset
     8
 * regarding copyright ownership. The ASF licenses this file
9afdbf18ad38 8087283: Add support for the XML Signature here() function to the JDK XPath implementation
mullan
parents: 25868
diff changeset
     9
 * to you under the Apache License, Version 2.0 (the
9afdbf18ad38 8087283: Add support for the XML Signature here() function to the JDK XPath implementation
mullan
parents: 25868
diff changeset
    10
 * "License"); you may not use this file except in compliance
9afdbf18ad38 8087283: Add support for the XML Signature here() function to the JDK XPath implementation
mullan
parents: 25868
diff changeset
    11
 * with the License. You may obtain a copy of the License at
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    12
 *
31204
9afdbf18ad38 8087283: Add support for the XML Signature here() function to the JDK XPath implementation
mullan
parents: 25868
diff changeset
    13
 * http://www.apache.org/licenses/LICENSE-2.0
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    14
 *
31204
9afdbf18ad38 8087283: Add support for the XML Signature here() function to the JDK XPath implementation
mullan
parents: 25868
diff changeset
    15
 * Unless required by applicable law or agreed to in writing,
9afdbf18ad38 8087283: Add support for the XML Signature here() function to the JDK XPath implementation
mullan
parents: 25868
diff changeset
    16
 * software distributed under the License is distributed on an
9afdbf18ad38 8087283: Add support for the XML Signature here() function to the JDK XPath implementation
mullan
parents: 25868
diff changeset
    17
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
9afdbf18ad38 8087283: Add support for the XML Signature here() function to the JDK XPath implementation
mullan
parents: 25868
diff changeset
    18
 * KIND, either express or implied. See the License for the
9afdbf18ad38 8087283: Add support for the XML Signature here() function to the JDK XPath implementation
mullan
parents: 25868
diff changeset
    19
 * specific language governing permissions and limitations
9afdbf18ad38 8087283: Add support for the XML Signature here() function to the JDK XPath implementation
mullan
parents: 25868
diff changeset
    20
 * under the License.
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    21
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    22
/*
7f561c08de6b Initial load
duke
parents:
diff changeset
    23
 * $Id: FunctionTable.java,v 1.3 2005/09/28 13:49:34 pvedula Exp $
7f561c08de6b Initial load
duke
parents:
diff changeset
    24
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    25
package com.sun.org.apache.xpath.internal.compiler;
7f561c08de6b Initial load
duke
parents:
diff changeset
    26
7f561c08de6b Initial load
duke
parents:
diff changeset
    27
import com.sun.org.apache.xpath.internal.Expression;
7f561c08de6b Initial load
duke
parents:
diff changeset
    28
import com.sun.org.apache.xpath.internal.functions.Function;
7f561c08de6b Initial load
duke
parents:
diff changeset
    29
import java.util.HashMap;
7f561c08de6b Initial load
duke
parents:
diff changeset
    30
import javax.xml.transform.TransformerException;
7f561c08de6b Initial load
duke
parents:
diff changeset
    31
7f561c08de6b Initial load
duke
parents:
diff changeset
    32
/**
7f561c08de6b Initial load
duke
parents:
diff changeset
    33
 * The function table for XPath.
7f561c08de6b Initial load
duke
parents:
diff changeset
    34
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    35
public class FunctionTable
7f561c08de6b Initial load
duke
parents:
diff changeset
    36
{
7f561c08de6b Initial load
duke
parents:
diff changeset
    37
7f561c08de6b Initial load
duke
parents:
diff changeset
    38
  /** The 'current()' id. */
7f561c08de6b Initial load
duke
parents:
diff changeset
    39
  public static final int FUNC_CURRENT = 0;
7f561c08de6b Initial load
duke
parents:
diff changeset
    40
7f561c08de6b Initial load
duke
parents:
diff changeset
    41
  /** The 'last()' id. */
7f561c08de6b Initial load
duke
parents:
diff changeset
    42
  public static final int FUNC_LAST = 1;
7f561c08de6b Initial load
duke
parents:
diff changeset
    43
7f561c08de6b Initial load
duke
parents:
diff changeset
    44
  /** The 'position()' id. */
7f561c08de6b Initial load
duke
parents:
diff changeset
    45
  public static final int FUNC_POSITION = 2;
7f561c08de6b Initial load
duke
parents:
diff changeset
    46
7f561c08de6b Initial load
duke
parents:
diff changeset
    47
  /** The 'count()' id. */
7f561c08de6b Initial load
duke
parents:
diff changeset
    48
  public static final int FUNC_COUNT = 3;
7f561c08de6b Initial load
duke
parents:
diff changeset
    49
7f561c08de6b Initial load
duke
parents:
diff changeset
    50
  /** The 'id()' id. */
7f561c08de6b Initial load
duke
parents:
diff changeset
    51
  public static final int FUNC_ID = 4;
7f561c08de6b Initial load
duke
parents:
diff changeset
    52
7f561c08de6b Initial load
duke
parents:
diff changeset
    53
  /** The 'key()' id (XSLT). */
7f561c08de6b Initial load
duke
parents:
diff changeset
    54
  public static final int FUNC_KEY = 5;
7f561c08de6b Initial load
duke
parents:
diff changeset
    55
7f561c08de6b Initial load
duke
parents:
diff changeset
    56
  /** The 'local-name()' id. */
7f561c08de6b Initial load
duke
parents:
diff changeset
    57
  public static final int FUNC_LOCAL_PART = 7;
7f561c08de6b Initial load
duke
parents:
diff changeset
    58
7f561c08de6b Initial load
duke
parents:
diff changeset
    59
  /** The 'namespace-uri()' id. */
7f561c08de6b Initial load
duke
parents:
diff changeset
    60
  public static final int FUNC_NAMESPACE = 8;
7f561c08de6b Initial load
duke
parents:
diff changeset
    61
7f561c08de6b Initial load
duke
parents:
diff changeset
    62
  /** The 'name()' id. */
7f561c08de6b Initial load
duke
parents:
diff changeset
    63
  public static final int FUNC_QNAME = 9;
7f561c08de6b Initial load
duke
parents:
diff changeset
    64
7f561c08de6b Initial load
duke
parents:
diff changeset
    65
  /** The 'generate-id()' id. */
7f561c08de6b Initial load
duke
parents:
diff changeset
    66
  public static final int FUNC_GENERATE_ID = 10;
7f561c08de6b Initial load
duke
parents:
diff changeset
    67
7f561c08de6b Initial load
duke
parents:
diff changeset
    68
  /** The 'not()' id. */
7f561c08de6b Initial load
duke
parents:
diff changeset
    69
  public static final int FUNC_NOT = 11;
7f561c08de6b Initial load
duke
parents:
diff changeset
    70
7f561c08de6b Initial load
duke
parents:
diff changeset
    71
  /** The 'true()' id. */
7f561c08de6b Initial load
duke
parents:
diff changeset
    72
  public static final int FUNC_TRUE = 12;
7f561c08de6b Initial load
duke
parents:
diff changeset
    73
7f561c08de6b Initial load
duke
parents:
diff changeset
    74
  /** The 'false()' id. */
7f561c08de6b Initial load
duke
parents:
diff changeset
    75
  public static final int FUNC_FALSE = 13;
7f561c08de6b Initial load
duke
parents:
diff changeset
    76
7f561c08de6b Initial load
duke
parents:
diff changeset
    77
  /** The 'boolean()' id. */
7f561c08de6b Initial load
duke
parents:
diff changeset
    78
  public static final int FUNC_BOOLEAN = 14;
7f561c08de6b Initial load
duke
parents:
diff changeset
    79
7f561c08de6b Initial load
duke
parents:
diff changeset
    80
  /** The 'number()' id. */
7f561c08de6b Initial load
duke
parents:
diff changeset
    81
  public static final int FUNC_NUMBER = 15;
7f561c08de6b Initial load
duke
parents:
diff changeset
    82
7f561c08de6b Initial load
duke
parents:
diff changeset
    83
  /** The 'floor()' id. */
7f561c08de6b Initial load
duke
parents:
diff changeset
    84
  public static final int FUNC_FLOOR = 16;
7f561c08de6b Initial load
duke
parents:
diff changeset
    85
7f561c08de6b Initial load
duke
parents:
diff changeset
    86
  /** The 'ceiling()' id. */
7f561c08de6b Initial load
duke
parents:
diff changeset
    87
  public static final int FUNC_CEILING = 17;
7f561c08de6b Initial load
duke
parents:
diff changeset
    88
7f561c08de6b Initial load
duke
parents:
diff changeset
    89
  /** The 'round()' id. */
7f561c08de6b Initial load
duke
parents:
diff changeset
    90
  public static final int FUNC_ROUND = 18;
7f561c08de6b Initial load
duke
parents:
diff changeset
    91
7f561c08de6b Initial load
duke
parents:
diff changeset
    92
  /** The 'sum()' id. */
7f561c08de6b Initial load
duke
parents:
diff changeset
    93
  public static final int FUNC_SUM = 19;
7f561c08de6b Initial load
duke
parents:
diff changeset
    94
7f561c08de6b Initial load
duke
parents:
diff changeset
    95
  /** The 'string()' id. */
7f561c08de6b Initial load
duke
parents:
diff changeset
    96
  public static final int FUNC_STRING = 20;
7f561c08de6b Initial load
duke
parents:
diff changeset
    97
7f561c08de6b Initial load
duke
parents:
diff changeset
    98
  /** The 'starts-with()' id. */
7f561c08de6b Initial load
duke
parents:
diff changeset
    99
  public static final int FUNC_STARTS_WITH = 21;
7f561c08de6b Initial load
duke
parents:
diff changeset
   100
7f561c08de6b Initial load
duke
parents:
diff changeset
   101
  /** The 'contains()' id. */
7f561c08de6b Initial load
duke
parents:
diff changeset
   102
  public static final int FUNC_CONTAINS = 22;
7f561c08de6b Initial load
duke
parents:
diff changeset
   103
7f561c08de6b Initial load
duke
parents:
diff changeset
   104
  /** The 'substring-before()' id. */
7f561c08de6b Initial load
duke
parents:
diff changeset
   105
  public static final int FUNC_SUBSTRING_BEFORE = 23;
7f561c08de6b Initial load
duke
parents:
diff changeset
   106
7f561c08de6b Initial load
duke
parents:
diff changeset
   107
  /** The 'substring-after()' id. */
7f561c08de6b Initial load
duke
parents:
diff changeset
   108
  public static final int FUNC_SUBSTRING_AFTER = 24;
7f561c08de6b Initial load
duke
parents:
diff changeset
   109
7f561c08de6b Initial load
duke
parents:
diff changeset
   110
  /** The 'normalize-space()' id. */
7f561c08de6b Initial load
duke
parents:
diff changeset
   111
  public static final int FUNC_NORMALIZE_SPACE = 25;
7f561c08de6b Initial load
duke
parents:
diff changeset
   112
7f561c08de6b Initial load
duke
parents:
diff changeset
   113
  /** The 'translate()' id. */
7f561c08de6b Initial load
duke
parents:
diff changeset
   114
  public static final int FUNC_TRANSLATE = 26;
7f561c08de6b Initial load
duke
parents:
diff changeset
   115
7f561c08de6b Initial load
duke
parents:
diff changeset
   116
  /** The 'concat()' id. */
7f561c08de6b Initial load
duke
parents:
diff changeset
   117
  public static final int FUNC_CONCAT = 27;
7f561c08de6b Initial load
duke
parents:
diff changeset
   118
7f561c08de6b Initial load
duke
parents:
diff changeset
   119
  /** The 'substring()' id. */
7f561c08de6b Initial load
duke
parents:
diff changeset
   120
  public static final int FUNC_SUBSTRING = 29;
7f561c08de6b Initial load
duke
parents:
diff changeset
   121
7f561c08de6b Initial load
duke
parents:
diff changeset
   122
  /** The 'string-length()' id. */
7f561c08de6b Initial load
duke
parents:
diff changeset
   123
  public static final int FUNC_STRING_LENGTH = 30;
7f561c08de6b Initial load
duke
parents:
diff changeset
   124
7f561c08de6b Initial load
duke
parents:
diff changeset
   125
  /** The 'system-property()' id. */
7f561c08de6b Initial load
duke
parents:
diff changeset
   126
  public static final int FUNC_SYSTEM_PROPERTY = 31;
7f561c08de6b Initial load
duke
parents:
diff changeset
   127
7f561c08de6b Initial load
duke
parents:
diff changeset
   128
  /** The 'lang()' id. */
7f561c08de6b Initial load
duke
parents:
diff changeset
   129
  public static final int FUNC_LANG = 32;
7f561c08de6b Initial load
duke
parents:
diff changeset
   130
7f561c08de6b Initial load
duke
parents:
diff changeset
   131
  /** The 'function-available()' id (XSLT). */
7f561c08de6b Initial load
duke
parents:
diff changeset
   132
  public static final int FUNC_EXT_FUNCTION_AVAILABLE = 33;
7f561c08de6b Initial load
duke
parents:
diff changeset
   133
7f561c08de6b Initial load
duke
parents:
diff changeset
   134
  /** The 'element-available()' id (XSLT). */
7f561c08de6b Initial load
duke
parents:
diff changeset
   135
  public static final int FUNC_EXT_ELEM_AVAILABLE = 34;
7f561c08de6b Initial load
duke
parents:
diff changeset
   136
7f561c08de6b Initial load
duke
parents:
diff changeset
   137
  /** The 'unparsed-entity-uri()' id (XSLT). */
7f561c08de6b Initial load
duke
parents:
diff changeset
   138
  public static final int FUNC_UNPARSED_ENTITY_URI = 36;
7f561c08de6b Initial load
duke
parents:
diff changeset
   139
31204
9afdbf18ad38 8087283: Add support for the XML Signature here() function to the JDK XPath implementation
mullan
parents: 25868
diff changeset
   140
  /** The 'here()' id (XML Signature). */
9afdbf18ad38 8087283: Add support for the XML Signature here() function to the JDK XPath implementation
mullan
parents: 25868
diff changeset
   141
  public static final int FUNC_HERE = 37;
9afdbf18ad38 8087283: Add support for the XML Signature here() function to the JDK XPath implementation
mullan
parents: 25868
diff changeset
   142
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   143
  // Proprietary
7f561c08de6b Initial load
duke
parents:
diff changeset
   144
7f561c08de6b Initial load
duke
parents:
diff changeset
   145
  /** The 'document-location()' id (Proprietary). */
7f561c08de6b Initial load
duke
parents:
diff changeset
   146
  public static final int FUNC_DOCLOCATION = 35;
7f561c08de6b Initial load
duke
parents:
diff changeset
   147
7f561c08de6b Initial load
duke
parents:
diff changeset
   148
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   149
   * The function table.
7f561c08de6b Initial load
duke
parents:
diff changeset
   150
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   151
  private static Class m_functions[];
7f561c08de6b Initial load
duke
parents:
diff changeset
   152
7f561c08de6b Initial load
duke
parents:
diff changeset
   153
  /** Table of function name to function ID associations. */
7f561c08de6b Initial load
duke
parents:
diff changeset
   154
  private static HashMap m_functionID = new HashMap();
7f561c08de6b Initial load
duke
parents:
diff changeset
   155
7f561c08de6b Initial load
duke
parents:
diff changeset
   156
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   157
   * The function table contains customized functions
7f561c08de6b Initial load
duke
parents:
diff changeset
   158
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   159
  private Class m_functions_customer[] = new Class[NUM_ALLOWABLE_ADDINS];
7f561c08de6b Initial load
duke
parents:
diff changeset
   160
7f561c08de6b Initial load
duke
parents:
diff changeset
   161
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   162
   * Table of function name to function ID associations for customized functions
7f561c08de6b Initial load
duke
parents:
diff changeset
   163
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   164
  private HashMap m_functionID_customer = new HashMap();
7f561c08de6b Initial load
duke
parents:
diff changeset
   165
7f561c08de6b Initial load
duke
parents:
diff changeset
   166
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   167
   * Number of built in functions.  Be sure to update this as
7f561c08de6b Initial load
duke
parents:
diff changeset
   168
   * built-in functions are added.
7f561c08de6b Initial load
duke
parents:
diff changeset
   169
   */
31204
9afdbf18ad38 8087283: Add support for the XML Signature here() function to the JDK XPath implementation
mullan
parents: 25868
diff changeset
   170
  private static final int NUM_BUILT_IN_FUNCS = 38;
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   171
7f561c08de6b Initial load
duke
parents:
diff changeset
   172
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   173
   * Number of built-in functions that may be added.
7f561c08de6b Initial load
duke
parents:
diff changeset
   174
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   175
  private static final int NUM_ALLOWABLE_ADDINS = 30;
7f561c08de6b Initial load
duke
parents:
diff changeset
   176
7f561c08de6b Initial load
duke
parents:
diff changeset
   177
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   178
   * The index to the next free function index.
7f561c08de6b Initial load
duke
parents:
diff changeset
   179
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   180
  private int m_funcNextFreeIndex = NUM_BUILT_IN_FUNCS;
7f561c08de6b Initial load
duke
parents:
diff changeset
   181
7f561c08de6b Initial load
duke
parents:
diff changeset
   182
  static
7f561c08de6b Initial load
duke
parents:
diff changeset
   183
  {
7f561c08de6b Initial load
duke
parents:
diff changeset
   184
    m_functions = new Class[NUM_BUILT_IN_FUNCS];
7f561c08de6b Initial load
duke
parents:
diff changeset
   185
    m_functions[FUNC_CURRENT] = com.sun.org.apache.xpath.internal.functions.FuncCurrent.class;
7f561c08de6b Initial load
duke
parents:
diff changeset
   186
    m_functions[FUNC_LAST] = com.sun.org.apache.xpath.internal.functions.FuncLast.class;
7f561c08de6b Initial load
duke
parents:
diff changeset
   187
    m_functions[FUNC_POSITION] = com.sun.org.apache.xpath.internal.functions.FuncPosition.class;
7f561c08de6b Initial load
duke
parents:
diff changeset
   188
    m_functions[FUNC_COUNT] = com.sun.org.apache.xpath.internal.functions.FuncCount.class;
7f561c08de6b Initial load
duke
parents:
diff changeset
   189
    m_functions[FUNC_ID] = com.sun.org.apache.xpath.internal.functions.FuncId.class;
7f561c08de6b Initial load
duke
parents:
diff changeset
   190
    // J2SE does not support Xalan interpretive
7f561c08de6b Initial load
duke
parents:
diff changeset
   191
    // m_functions[FUNC_KEY] =
7f561c08de6b Initial load
duke
parents:
diff changeset
   192
    //   com.sun.org.apache.xalan.internal.templates.FuncKey.class;
7f561c08de6b Initial load
duke
parents:
diff changeset
   193
    m_functions[FUNC_LOCAL_PART] =
7f561c08de6b Initial load
duke
parents:
diff changeset
   194
      com.sun.org.apache.xpath.internal.functions.FuncLocalPart.class;
7f561c08de6b Initial load
duke
parents:
diff changeset
   195
    m_functions[FUNC_NAMESPACE] =
7f561c08de6b Initial load
duke
parents:
diff changeset
   196
      com.sun.org.apache.xpath.internal.functions.FuncNamespace.class;
7f561c08de6b Initial load
duke
parents:
diff changeset
   197
    m_functions[FUNC_QNAME] = com.sun.org.apache.xpath.internal.functions.FuncQname.class;
7f561c08de6b Initial load
duke
parents:
diff changeset
   198
    m_functions[FUNC_GENERATE_ID] =
7f561c08de6b Initial load
duke
parents:
diff changeset
   199
      com.sun.org.apache.xpath.internal.functions.FuncGenerateId.class;
7f561c08de6b Initial load
duke
parents:
diff changeset
   200
    m_functions[FUNC_NOT] = com.sun.org.apache.xpath.internal.functions.FuncNot.class;
7f561c08de6b Initial load
duke
parents:
diff changeset
   201
    m_functions[FUNC_TRUE] = com.sun.org.apache.xpath.internal.functions.FuncTrue.class;
7f561c08de6b Initial load
duke
parents:
diff changeset
   202
    m_functions[FUNC_FALSE] = com.sun.org.apache.xpath.internal.functions.FuncFalse.class;
7f561c08de6b Initial load
duke
parents:
diff changeset
   203
    m_functions[FUNC_BOOLEAN] = com.sun.org.apache.xpath.internal.functions.FuncBoolean.class;
7f561c08de6b Initial load
duke
parents:
diff changeset
   204
    m_functions[FUNC_LANG] = com.sun.org.apache.xpath.internal.functions.FuncLang.class;
7f561c08de6b Initial load
duke
parents:
diff changeset
   205
    m_functions[FUNC_NUMBER] = com.sun.org.apache.xpath.internal.functions.FuncNumber.class;
7f561c08de6b Initial load
duke
parents:
diff changeset
   206
    m_functions[FUNC_FLOOR] = com.sun.org.apache.xpath.internal.functions.FuncFloor.class;
7f561c08de6b Initial load
duke
parents:
diff changeset
   207
    m_functions[FUNC_CEILING] = com.sun.org.apache.xpath.internal.functions.FuncCeiling.class;
7f561c08de6b Initial load
duke
parents:
diff changeset
   208
    m_functions[FUNC_ROUND] = com.sun.org.apache.xpath.internal.functions.FuncRound.class;
7f561c08de6b Initial load
duke
parents:
diff changeset
   209
    m_functions[FUNC_SUM] = com.sun.org.apache.xpath.internal.functions.FuncSum.class;
7f561c08de6b Initial load
duke
parents:
diff changeset
   210
    m_functions[FUNC_STRING] = com.sun.org.apache.xpath.internal.functions.FuncString.class;
7f561c08de6b Initial load
duke
parents:
diff changeset
   211
    m_functions[FUNC_STARTS_WITH] =
7f561c08de6b Initial load
duke
parents:
diff changeset
   212
      com.sun.org.apache.xpath.internal.functions.FuncStartsWith.class;
7f561c08de6b Initial load
duke
parents:
diff changeset
   213
    m_functions[FUNC_CONTAINS] = com.sun.org.apache.xpath.internal.functions.FuncContains.class;
7f561c08de6b Initial load
duke
parents:
diff changeset
   214
    m_functions[FUNC_SUBSTRING_BEFORE] =
7f561c08de6b Initial load
duke
parents:
diff changeset
   215
      com.sun.org.apache.xpath.internal.functions.FuncSubstringBefore.class;
7f561c08de6b Initial load
duke
parents:
diff changeset
   216
    m_functions[FUNC_SUBSTRING_AFTER] =
7f561c08de6b Initial load
duke
parents:
diff changeset
   217
      com.sun.org.apache.xpath.internal.functions.FuncSubstringAfter.class;
7f561c08de6b Initial load
duke
parents:
diff changeset
   218
    m_functions[FUNC_NORMALIZE_SPACE] =
7f561c08de6b Initial load
duke
parents:
diff changeset
   219
      com.sun.org.apache.xpath.internal.functions.FuncNormalizeSpace.class;
7f561c08de6b Initial load
duke
parents:
diff changeset
   220
    m_functions[FUNC_TRANSLATE] =
7f561c08de6b Initial load
duke
parents:
diff changeset
   221
      com.sun.org.apache.xpath.internal.functions.FuncTranslate.class;
7f561c08de6b Initial load
duke
parents:
diff changeset
   222
    m_functions[FUNC_CONCAT] = com.sun.org.apache.xpath.internal.functions.FuncConcat.class;
7f561c08de6b Initial load
duke
parents:
diff changeset
   223
    m_functions[FUNC_SYSTEM_PROPERTY] =
7f561c08de6b Initial load
duke
parents:
diff changeset
   224
      com.sun.org.apache.xpath.internal.functions.FuncSystemProperty.class;
7f561c08de6b Initial load
duke
parents:
diff changeset
   225
    m_functions[FUNC_EXT_FUNCTION_AVAILABLE] =
7f561c08de6b Initial load
duke
parents:
diff changeset
   226
      com.sun.org.apache.xpath.internal.functions.FuncExtFunctionAvailable.class;
7f561c08de6b Initial load
duke
parents:
diff changeset
   227
    m_functions[FUNC_EXT_ELEM_AVAILABLE] =
7f561c08de6b Initial load
duke
parents:
diff changeset
   228
      com.sun.org.apache.xpath.internal.functions.FuncExtElementAvailable.class;
7f561c08de6b Initial load
duke
parents:
diff changeset
   229
    m_functions[FUNC_SUBSTRING] =
7f561c08de6b Initial load
duke
parents:
diff changeset
   230
      com.sun.org.apache.xpath.internal.functions.FuncSubstring.class;
7f561c08de6b Initial load
duke
parents:
diff changeset
   231
    m_functions[FUNC_STRING_LENGTH] =
7f561c08de6b Initial load
duke
parents:
diff changeset
   232
      com.sun.org.apache.xpath.internal.functions.FuncStringLength.class;
7f561c08de6b Initial load
duke
parents:
diff changeset
   233
    m_functions[FUNC_DOCLOCATION] =
7f561c08de6b Initial load
duke
parents:
diff changeset
   234
      com.sun.org.apache.xpath.internal.functions.FuncDoclocation.class;
7f561c08de6b Initial load
duke
parents:
diff changeset
   235
    m_functions[FUNC_UNPARSED_ENTITY_URI] =
7f561c08de6b Initial load
duke
parents:
diff changeset
   236
      com.sun.org.apache.xpath.internal.functions.FuncUnparsedEntityURI.class;
31204
9afdbf18ad38 8087283: Add support for the XML Signature here() function to the JDK XPath implementation
mullan
parents: 25868
diff changeset
   237
    m_functions[FUNC_HERE] =
9afdbf18ad38 8087283: Add support for the XML Signature here() function to the JDK XPath implementation
mullan
parents: 25868
diff changeset
   238
      com.sun.org.apache.xpath.internal.functions.FuncHere.class;
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   239
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   240
7f561c08de6b Initial load
duke
parents:
diff changeset
   241
  static{
7f561c08de6b Initial load
duke
parents:
diff changeset
   242
          m_functionID.put(Keywords.FUNC_CURRENT_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   243
                          new Integer(FunctionTable.FUNC_CURRENT));
7f561c08de6b Initial load
duke
parents:
diff changeset
   244
          m_functionID.put(Keywords.FUNC_LAST_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   245
                          new Integer(FunctionTable.FUNC_LAST));
7f561c08de6b Initial load
duke
parents:
diff changeset
   246
          m_functionID.put(Keywords.FUNC_POSITION_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   247
                          new Integer(FunctionTable.FUNC_POSITION));
7f561c08de6b Initial load
duke
parents:
diff changeset
   248
          m_functionID.put(Keywords.FUNC_COUNT_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   249
                          new Integer(FunctionTable.FUNC_COUNT));
7f561c08de6b Initial load
duke
parents:
diff changeset
   250
          m_functionID.put(Keywords.FUNC_ID_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   251
                          new Integer(FunctionTable.FUNC_ID));
7f561c08de6b Initial load
duke
parents:
diff changeset
   252
          m_functionID.put(Keywords.FUNC_KEY_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   253
                          new Integer(FunctionTable.FUNC_KEY));
7f561c08de6b Initial load
duke
parents:
diff changeset
   254
          m_functionID.put(Keywords.FUNC_LOCAL_PART_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   255
                          new Integer(FunctionTable.FUNC_LOCAL_PART));
7f561c08de6b Initial load
duke
parents:
diff changeset
   256
          m_functionID.put(Keywords.FUNC_NAMESPACE_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   257
                          new Integer(FunctionTable.FUNC_NAMESPACE));
7f561c08de6b Initial load
duke
parents:
diff changeset
   258
          m_functionID.put(Keywords.FUNC_NAME_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   259
                          new Integer(FunctionTable.FUNC_QNAME));
7f561c08de6b Initial load
duke
parents:
diff changeset
   260
          m_functionID.put(Keywords.FUNC_GENERATE_ID_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   261
                          new Integer(FunctionTable.FUNC_GENERATE_ID));
7f561c08de6b Initial load
duke
parents:
diff changeset
   262
          m_functionID.put(Keywords.FUNC_NOT_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   263
                          new Integer(FunctionTable.FUNC_NOT));
7f561c08de6b Initial load
duke
parents:
diff changeset
   264
          m_functionID.put(Keywords.FUNC_TRUE_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   265
                          new Integer(FunctionTable.FUNC_TRUE));
7f561c08de6b Initial load
duke
parents:
diff changeset
   266
          m_functionID.put(Keywords.FUNC_FALSE_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   267
                          new Integer(FunctionTable.FUNC_FALSE));
7f561c08de6b Initial load
duke
parents:
diff changeset
   268
          m_functionID.put(Keywords.FUNC_BOOLEAN_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   269
                          new Integer(FunctionTable.FUNC_BOOLEAN));
7f561c08de6b Initial load
duke
parents:
diff changeset
   270
          m_functionID.put(Keywords.FUNC_LANG_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   271
                          new Integer(FunctionTable.FUNC_LANG));
7f561c08de6b Initial load
duke
parents:
diff changeset
   272
          m_functionID.put(Keywords.FUNC_NUMBER_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   273
                          new Integer(FunctionTable.FUNC_NUMBER));
7f561c08de6b Initial load
duke
parents:
diff changeset
   274
          m_functionID.put(Keywords.FUNC_FLOOR_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   275
                          new Integer(FunctionTable.FUNC_FLOOR));
7f561c08de6b Initial load
duke
parents:
diff changeset
   276
          m_functionID.put(Keywords.FUNC_CEILING_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   277
                          new Integer(FunctionTable.FUNC_CEILING));
7f561c08de6b Initial load
duke
parents:
diff changeset
   278
          m_functionID.put(Keywords.FUNC_ROUND_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   279
                          new Integer(FunctionTable.FUNC_ROUND));
7f561c08de6b Initial load
duke
parents:
diff changeset
   280
          m_functionID.put(Keywords.FUNC_SUM_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   281
                          new Integer(FunctionTable.FUNC_SUM));
7f561c08de6b Initial load
duke
parents:
diff changeset
   282
          m_functionID.put(Keywords.FUNC_STRING_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   283
                          new Integer(FunctionTable.FUNC_STRING));
7f561c08de6b Initial load
duke
parents:
diff changeset
   284
          m_functionID.put(Keywords.FUNC_STARTS_WITH_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   285
                          new Integer(FunctionTable.FUNC_STARTS_WITH));
7f561c08de6b Initial load
duke
parents:
diff changeset
   286
          m_functionID.put(Keywords.FUNC_CONTAINS_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   287
                          new Integer(FunctionTable.FUNC_CONTAINS));
7f561c08de6b Initial load
duke
parents:
diff changeset
   288
          m_functionID.put(Keywords.FUNC_SUBSTRING_BEFORE_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   289
                          new Integer(FunctionTable.FUNC_SUBSTRING_BEFORE));
7f561c08de6b Initial load
duke
parents:
diff changeset
   290
          m_functionID.put(Keywords.FUNC_SUBSTRING_AFTER_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   291
                          new Integer(FunctionTable.FUNC_SUBSTRING_AFTER));
7f561c08de6b Initial load
duke
parents:
diff changeset
   292
          m_functionID.put(Keywords.FUNC_NORMALIZE_SPACE_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   293
                          new Integer(FunctionTable.FUNC_NORMALIZE_SPACE));
7f561c08de6b Initial load
duke
parents:
diff changeset
   294
          m_functionID.put(Keywords.FUNC_TRANSLATE_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   295
                          new Integer(FunctionTable.FUNC_TRANSLATE));
7f561c08de6b Initial load
duke
parents:
diff changeset
   296
          m_functionID.put(Keywords.FUNC_CONCAT_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   297
                          new Integer(FunctionTable.FUNC_CONCAT));
7f561c08de6b Initial load
duke
parents:
diff changeset
   298
          m_functionID.put(Keywords.FUNC_SYSTEM_PROPERTY_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   299
                          new Integer(FunctionTable.FUNC_SYSTEM_PROPERTY));
7f561c08de6b Initial load
duke
parents:
diff changeset
   300
          m_functionID.put(Keywords.FUNC_EXT_FUNCTION_AVAILABLE_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   301
                        new Integer(FunctionTable.FUNC_EXT_FUNCTION_AVAILABLE));
7f561c08de6b Initial load
duke
parents:
diff changeset
   302
          m_functionID.put(Keywords.FUNC_EXT_ELEM_AVAILABLE_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   303
                          new Integer(FunctionTable.FUNC_EXT_ELEM_AVAILABLE));
7f561c08de6b Initial load
duke
parents:
diff changeset
   304
          m_functionID.put(Keywords.FUNC_SUBSTRING_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   305
                          new Integer(FunctionTable.FUNC_SUBSTRING));
7f561c08de6b Initial load
duke
parents:
diff changeset
   306
          m_functionID.put(Keywords.FUNC_STRING_LENGTH_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   307
                          new Integer(FunctionTable.FUNC_STRING_LENGTH));
7f561c08de6b Initial load
duke
parents:
diff changeset
   308
          m_functionID.put(Keywords.FUNC_UNPARSED_ENTITY_URI_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   309
                          new Integer(FunctionTable.FUNC_UNPARSED_ENTITY_URI));
7f561c08de6b Initial load
duke
parents:
diff changeset
   310
          m_functionID.put(Keywords.FUNC_DOCLOCATION_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   311
                          new Integer(FunctionTable.FUNC_DOCLOCATION));
31204
9afdbf18ad38 8087283: Add support for the XML Signature here() function to the JDK XPath implementation
mullan
parents: 25868
diff changeset
   312
          m_functionID.put(Keywords.FUNC_HERE_STRING,
9afdbf18ad38 8087283: Add support for the XML Signature here() function to the JDK XPath implementation
mullan
parents: 25868
diff changeset
   313
                          new Integer(FunctionTable.FUNC_HERE));
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   314
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   315
7f561c08de6b Initial load
duke
parents:
diff changeset
   316
  public FunctionTable(){
7f561c08de6b Initial load
duke
parents:
diff changeset
   317
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   318
7f561c08de6b Initial load
duke
parents:
diff changeset
   319
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   320
   * Return the name of the a function in the static table. Needed to avoid
7f561c08de6b Initial load
duke
parents:
diff changeset
   321
   * making the table publicly available.
7f561c08de6b Initial load
duke
parents:
diff changeset
   322
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   323
  String getFunctionName(int funcID) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   324
      if (funcID < NUM_BUILT_IN_FUNCS) return m_functions[funcID].getName();
7f561c08de6b Initial load
duke
parents:
diff changeset
   325
      else return m_functions_customer[funcID - NUM_BUILT_IN_FUNCS].getName();
7f561c08de6b Initial load
duke
parents:
diff changeset
   326
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   327
7f561c08de6b Initial load
duke
parents:
diff changeset
   328
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   329
   * Obtain a new Function object from a function ID.
7f561c08de6b Initial load
duke
parents:
diff changeset
   330
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   331
   * @param which  The function ID, which may correspond to one of the FUNC_XXX
7f561c08de6b Initial load
duke
parents:
diff changeset
   332
   *    values found in {@link com.sun.org.apache.xpath.internal.compiler.FunctionTable}, but may
7f561c08de6b Initial load
duke
parents:
diff changeset
   333
   *    be a value installed by an external module.
7f561c08de6b Initial load
duke
parents:
diff changeset
   334
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   335
   * @return a a new Function instance.
7f561c08de6b Initial load
duke
parents:
diff changeset
   336
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   337
   * @throws javax.xml.transform.TransformerException if ClassNotFoundException,
7f561c08de6b Initial load
duke
parents:
diff changeset
   338
   *    IllegalAccessException, or InstantiationException is thrown.
7f561c08de6b Initial load
duke
parents:
diff changeset
   339
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   340
  Function getFunction(int which)
7f561c08de6b Initial load
duke
parents:
diff changeset
   341
          throws javax.xml.transform.TransformerException
7f561c08de6b Initial load
duke
parents:
diff changeset
   342
  {
7f561c08de6b Initial load
duke
parents:
diff changeset
   343
          try{
7f561c08de6b Initial load
duke
parents:
diff changeset
   344
              if (which < NUM_BUILT_IN_FUNCS)
7f561c08de6b Initial load
duke
parents:
diff changeset
   345
                  return (Function) m_functions[which].newInstance();
7f561c08de6b Initial load
duke
parents:
diff changeset
   346
              else
7f561c08de6b Initial load
duke
parents:
diff changeset
   347
                  return (Function) m_functions_customer[
7f561c08de6b Initial load
duke
parents:
diff changeset
   348
                      which-NUM_BUILT_IN_FUNCS].newInstance();
7f561c08de6b Initial load
duke
parents:
diff changeset
   349
          }catch (IllegalAccessException ex){
7f561c08de6b Initial load
duke
parents:
diff changeset
   350
                  throw new TransformerException(ex.getMessage());
7f561c08de6b Initial load
duke
parents:
diff changeset
   351
          }catch (InstantiationException ex){
7f561c08de6b Initial load
duke
parents:
diff changeset
   352
                  throw new TransformerException(ex.getMessage());
7f561c08de6b Initial load
duke
parents:
diff changeset
   353
          }
7f561c08de6b Initial load
duke
parents:
diff changeset
   354
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   355
7f561c08de6b Initial load
duke
parents:
diff changeset
   356
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   357
   * Obtain a function ID from a given function name
7f561c08de6b Initial load
duke
parents:
diff changeset
   358
   * @param key the function name in a java.lang.String format.
7f561c08de6b Initial load
duke
parents:
diff changeset
   359
   * @return a function ID, which may correspond to one of the FUNC_XXX values
7f561c08de6b Initial load
duke
parents:
diff changeset
   360
   * found in {@link com.sun.org.apache.xpath.internal.compiler.FunctionTable}, but may be a
7f561c08de6b Initial load
duke
parents:
diff changeset
   361
   * value installed by an external module.
7f561c08de6b Initial load
duke
parents:
diff changeset
   362
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   363
  Object getFunctionID(String key){
7f561c08de6b Initial load
duke
parents:
diff changeset
   364
          Object id = m_functionID_customer.get(key);
7f561c08de6b Initial load
duke
parents:
diff changeset
   365
          if (null == id) id = m_functionID.get(key);
7f561c08de6b Initial load
duke
parents:
diff changeset
   366
          return id;
7f561c08de6b Initial load
duke
parents:
diff changeset
   367
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   368
7f561c08de6b Initial load
duke
parents:
diff changeset
   369
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   370
   * Install a built-in function.
7f561c08de6b Initial load
duke
parents:
diff changeset
   371
   * @param name The unqualified name of the function, must not be null
7f561c08de6b Initial load
duke
parents:
diff changeset
   372
   * @param func A Implementation of an XPath Function object.
7f561c08de6b Initial load
duke
parents:
diff changeset
   373
   * @return the position of the function in the internal index.
7f561c08de6b Initial load
duke
parents:
diff changeset
   374
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   375
  public int installFunction(String name, Class func)
7f561c08de6b Initial load
duke
parents:
diff changeset
   376
  {
7f561c08de6b Initial load
duke
parents:
diff changeset
   377
7f561c08de6b Initial load
duke
parents:
diff changeset
   378
    int funcIndex;
7f561c08de6b Initial load
duke
parents:
diff changeset
   379
    Object funcIndexObj = getFunctionID(name);
7f561c08de6b Initial load
duke
parents:
diff changeset
   380
31497
4a6b2e733c0d 8130051: Cleanup usage of reflection in jaxp
dfuchs
parents: 31204
diff changeset
   381
    if (func != null && !Function.class.isAssignableFrom(func)) {
4a6b2e733c0d 8130051: Cleanup usage of reflection in jaxp
dfuchs
parents: 31204
diff changeset
   382
        throw new ClassCastException(func.getName()
4a6b2e733c0d 8130051: Cleanup usage of reflection in jaxp
dfuchs
parents: 31204
diff changeset
   383
                  + " cannot be cast to "
4a6b2e733c0d 8130051: Cleanup usage of reflection in jaxp
dfuchs
parents: 31204
diff changeset
   384
                  + Function.class.getName());
4a6b2e733c0d 8130051: Cleanup usage of reflection in jaxp
dfuchs
parents: 31204
diff changeset
   385
    }
4a6b2e733c0d 8130051: Cleanup usage of reflection in jaxp
dfuchs
parents: 31204
diff changeset
   386
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   387
    if (null != funcIndexObj)
7f561c08de6b Initial load
duke
parents:
diff changeset
   388
    {
7f561c08de6b Initial load
duke
parents:
diff changeset
   389
      funcIndex = ((Integer) funcIndexObj).intValue();
7f561c08de6b Initial load
duke
parents:
diff changeset
   390
7f561c08de6b Initial load
duke
parents:
diff changeset
   391
      if (funcIndex < NUM_BUILT_IN_FUNCS){
7f561c08de6b Initial load
duke
parents:
diff changeset
   392
              funcIndex = m_funcNextFreeIndex++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   393
              m_functionID_customer.put(name, new Integer(funcIndex));
7f561c08de6b Initial load
duke
parents:
diff changeset
   394
      }
7f561c08de6b Initial load
duke
parents:
diff changeset
   395
      m_functions_customer[funcIndex - NUM_BUILT_IN_FUNCS] = func;
7f561c08de6b Initial load
duke
parents:
diff changeset
   396
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   397
    else
7f561c08de6b Initial load
duke
parents:
diff changeset
   398
    {
7f561c08de6b Initial load
duke
parents:
diff changeset
   399
            funcIndex = m_funcNextFreeIndex++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   400
7f561c08de6b Initial load
duke
parents:
diff changeset
   401
            m_functions_customer[funcIndex-NUM_BUILT_IN_FUNCS] = func;
7f561c08de6b Initial load
duke
parents:
diff changeset
   402
7f561c08de6b Initial load
duke
parents:
diff changeset
   403
            m_functionID_customer.put(name,
7f561c08de6b Initial load
duke
parents:
diff changeset
   404
                new Integer(funcIndex));
7f561c08de6b Initial load
duke
parents:
diff changeset
   405
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   406
    return funcIndex;
7f561c08de6b Initial load
duke
parents:
diff changeset
   407
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   408
7f561c08de6b Initial load
duke
parents:
diff changeset
   409
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   410
   * Tell if a built-in, non-namespaced function is available.
7f561c08de6b Initial load
duke
parents:
diff changeset
   411
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   412
   * @param methName The local name of the function.
7f561c08de6b Initial load
duke
parents:
diff changeset
   413
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   414
   * @return True if the function can be executed.
7f561c08de6b Initial load
duke
parents:
diff changeset
   415
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   416
  public boolean functionAvailable(String methName)
7f561c08de6b Initial load
duke
parents:
diff changeset
   417
  {
7f561c08de6b Initial load
duke
parents:
diff changeset
   418
      Object tblEntry = m_functionID.get(methName);
7f561c08de6b Initial load
duke
parents:
diff changeset
   419
      if (null != tblEntry) return true;
7f561c08de6b Initial load
duke
parents:
diff changeset
   420
      else{
7f561c08de6b Initial load
duke
parents:
diff changeset
   421
              tblEntry = m_functionID_customer.get(methName);
7f561c08de6b Initial load
duke
parents:
diff changeset
   422
              return (null != tblEntry)? true : false;
7f561c08de6b Initial load
duke
parents:
diff changeset
   423
      }
7f561c08de6b Initial load
duke
parents:
diff changeset
   424
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   425
}