FunctionTablepublic class FunctionTable extends Object The function table for XPath. |
Fields Summary |
---|
public static final int | FUNC_CURRENTThe 'current()' id. | public static final int | FUNC_LASTThe 'last()' id. | public static final int | FUNC_POSITIONThe 'position()' id. | public static final int | FUNC_COUNTThe 'count()' id. | public static final int | FUNC_IDThe 'id()' id. | public static final int | FUNC_KEYThe 'key()' id (XSLT). | public static final int | FUNC_LOCAL_PARTThe 'local-name()' id. | public static final int | FUNC_NAMESPACEThe 'namespace-uri()' id. | public static final int | FUNC_QNAMEThe 'name()' id. | public static final int | FUNC_GENERATE_IDThe 'generate-id()' id. | public static final int | FUNC_NOTThe 'not()' id. | public static final int | FUNC_TRUEThe 'true()' id. | public static final int | FUNC_FALSEThe 'false()' id. | public static final int | FUNC_BOOLEANThe 'boolean()' id. | public static final int | FUNC_NUMBERThe 'number()' id. | public static final int | FUNC_FLOORThe 'floor()' id. | public static final int | FUNC_CEILINGThe 'ceiling()' id. | public static final int | FUNC_ROUNDThe 'round()' id. | public static final int | FUNC_SUMThe 'sum()' id. | public static final int | FUNC_STRINGThe 'string()' id. | public static final int | FUNC_STARTS_WITHThe 'starts-with()' id. | public static final int | FUNC_CONTAINSThe 'contains()' id. | public static final int | FUNC_SUBSTRING_BEFOREThe 'substring-before()' id. | public static final int | FUNC_SUBSTRING_AFTERThe 'substring-after()' id. | public static final int | FUNC_NORMALIZE_SPACEThe 'normalize-space()' id. | public static final int | FUNC_TRANSLATEThe 'translate()' id. | public static final int | FUNC_CONCATThe 'concat()' id. | public static final int | FUNC_SUBSTRINGThe 'substring()' id. | public static final int | FUNC_STRING_LENGTHThe 'string-length()' id. | public static final int | FUNC_SYSTEM_PROPERTYThe 'system-property()' id. | public static final int | FUNC_LANGThe 'lang()' id. | public static final int | FUNC_EXT_FUNCTION_AVAILABLEThe 'function-available()' id (XSLT). | public static final int | FUNC_EXT_ELEM_AVAILABLEThe 'element-available()' id (XSLT). | public static final int | FUNC_UNPARSED_ENTITY_URIThe 'unparsed-entity-uri()' id (XSLT). | public static final int | FUNC_DOCLOCATIONThe 'document-location()' id (Proprietary). | private static FuncLoader[] | m_functionsThe function table. | private static final int | NUM_BUILT_IN_FUNCSNumber of built in functions. Be sure to update this as
built-in functions are added. | private static final int | NUM_ALLOWABLE_ADDINSNumber of built-in functions that may be added. | static int | m_funcNextFreeIndexThe index to the next free function index. |
Methods Summary |
---|
public static com.sun.org.apache.xpath.internal.functions.Function | getFunction(int which)Obtain a new Function object from a function ID.
return m_functions[which].getFunction();
| static java.lang.String | getFunctionName(int funcID)Return the name of the a function in the static table. Needed to avoid
making the table publicly available.
m_functions = new FuncLoader[NUM_BUILT_IN_FUNCS + NUM_ALLOWABLE_ADDINS];
m_functions[FUNC_CURRENT] = new FuncLoader("FuncCurrent", FUNC_CURRENT);
m_functions[FUNC_LAST] = new FuncLoader("FuncLast", FUNC_LAST);
m_functions[FUNC_POSITION] = new FuncLoader("FuncPosition",
FUNC_POSITION);
m_functions[FUNC_COUNT] = new FuncLoader("FuncCount", FUNC_COUNT);
m_functions[FUNC_ID] = new FuncLoader("FuncId", FUNC_ID);
m_functions[FUNC_KEY] =
new FuncLoader("com.sun.org.apache.xalan.internal.templates.FuncKey", FUNC_KEY);
// m_functions[FUNC_DOC] = new FuncDoc();
m_functions[FUNC_LOCAL_PART] = new FuncLoader("FuncLocalPart",
FUNC_LOCAL_PART);
m_functions[FUNC_NAMESPACE] = new FuncLoader("FuncNamespace",
FUNC_NAMESPACE);
m_functions[FUNC_QNAME] = new FuncLoader("FuncQname", FUNC_QNAME);
m_functions[FUNC_GENERATE_ID] = new FuncLoader("FuncGenerateId",
FUNC_GENERATE_ID);
m_functions[FUNC_NOT] = new FuncLoader("FuncNot", FUNC_NOT);
m_functions[FUNC_TRUE] = new FuncLoader("FuncTrue", FUNC_TRUE);
m_functions[FUNC_FALSE] = new FuncLoader("FuncFalse", FUNC_FALSE);
m_functions[FUNC_BOOLEAN] = new FuncLoader("FuncBoolean", FUNC_BOOLEAN);
m_functions[FUNC_LANG] = new FuncLoader("FuncLang", FUNC_LANG);
m_functions[FUNC_NUMBER] = new FuncLoader("FuncNumber", FUNC_NUMBER);
m_functions[FUNC_FLOOR] = new FuncLoader("FuncFloor", FUNC_FLOOR);
m_functions[FUNC_CEILING] = new FuncLoader("FuncCeiling", FUNC_CEILING);
m_functions[FUNC_ROUND] = new FuncLoader("FuncRound", FUNC_ROUND);
m_functions[FUNC_SUM] = new FuncLoader("FuncSum", FUNC_SUM);
m_functions[FUNC_STRING] = new FuncLoader("FuncString", FUNC_STRING);
m_functions[FUNC_STARTS_WITH] = new FuncLoader("FuncStartsWith",
FUNC_STARTS_WITH);
m_functions[FUNC_CONTAINS] = new FuncLoader("FuncContains",
FUNC_CONTAINS);
m_functions[FUNC_SUBSTRING_BEFORE] = new FuncLoader("FuncSubstringBefore",
FUNC_SUBSTRING_BEFORE);
m_functions[FUNC_SUBSTRING_AFTER] = new FuncLoader("FuncSubstringAfter",
FUNC_SUBSTRING_AFTER);
m_functions[FUNC_NORMALIZE_SPACE] = new FuncLoader("FuncNormalizeSpace",
FUNC_NORMALIZE_SPACE);
m_functions[FUNC_TRANSLATE] = new FuncLoader("FuncTranslate",
FUNC_TRANSLATE);
m_functions[FUNC_CONCAT] = new FuncLoader("FuncConcat", FUNC_CONCAT);
//m_functions[FUNC_FORMAT_NUMBER] = new FuncFormatNumber();
m_functions[FUNC_SYSTEM_PROPERTY] = new FuncLoader("FuncSystemProperty",
FUNC_SYSTEM_PROPERTY);
m_functions[FUNC_EXT_FUNCTION_AVAILABLE] =
new FuncLoader("FuncExtFunctionAvailable", FUNC_EXT_FUNCTION_AVAILABLE);
m_functions[FUNC_EXT_ELEM_AVAILABLE] =
new FuncLoader("FuncExtElementAvailable", FUNC_EXT_ELEM_AVAILABLE);
m_functions[FUNC_SUBSTRING] = new FuncLoader("FuncSubstring",
FUNC_SUBSTRING);
m_functions[FUNC_STRING_LENGTH] = new FuncLoader("FuncStringLength",
FUNC_STRING_LENGTH);
m_functions[FUNC_DOCLOCATION] = new FuncLoader("FuncDoclocation",
FUNC_DOCLOCATION);
m_functions[FUNC_UNPARSED_ENTITY_URI] =
new FuncLoader("FuncUnparsedEntityURI", FUNC_UNPARSED_ENTITY_URI);
return m_functions[funcID].getName();
| public static int | installFunction(java.lang.String name, com.sun.org.apache.xpath.internal.Expression func)Install a built-in function.
int funcIndex;
Object funcIndexObj = Keywords.m_functions.get(name);
if (null != funcIndexObj)
{
funcIndex = ((Integer) funcIndexObj).intValue();
}
else
{
funcIndex = m_funcNextFreeIndex;
m_funcNextFreeIndex++;
Keywords.m_functions.put(name, new Integer(funcIndex));
}
FuncLoader loader = new FuncLoader(func.getClass().getName(), funcIndex);
m_functions[funcIndex] = loader;
return funcIndex;
| public static void | installFunction(com.sun.org.apache.xpath.internal.Expression func, int funcIndex)Install a function loader at a specific index.
FuncLoader loader = new FuncLoader(func.getClass().getName(), funcIndex);
m_functions[funcIndex] = loader;
|
|