1 package net.sf.saxon.functions; 2 import net.sf.saxon.expr.StaticProperty; 3 import net.sf.saxon.pattern.NodeKindTest; 4 import net.sf.saxon.type.ItemType; 5 import net.sf.saxon.type.Type; 6 import net.sf.saxon.value.SequenceType; 7 8 import java.util.HashMap ; 9 10 15 16 public abstract class StandardFunction { 17 18 21 22 private StandardFunction() { 23 } 24 25 37 38 private static Entry register( String name, 39 Class implementationClass, 40 int opcode, 41 int minArguments, 42 int maxArguments, 43 ItemType itemType, 44 int cardinality ) { 45 Entry e = makeEntry(name, implementationClass, opcode, minArguments, maxArguments, itemType, cardinality); 46 functionTable.put(name, e); 47 return e; 48 } 49 50 62 public static Entry makeEntry(String name, Class implementationClass, int opcode, 63 int minArguments, int maxArguments, ItemType itemType, int cardinality) { 64 Entry e = new Entry(); 65 int hash = name.indexOf('#'); 66 if (hash < 0) { 67 e.name = name; 68 } else { 69 e.name = name.substring(0, hash); 70 } 71 e.implementationClass = implementationClass; 72 e.opcode = opcode; 73 e.minArguments = minArguments; 74 e.maxArguments = maxArguments; 75 e.itemType = itemType; 76 e.cardinality = cardinality; 77 if (maxArguments > 100) { 78 e.argumentTypes = new SequenceType[1]; 80 } else { 81 e.argumentTypes = new SequenceType[maxArguments]; 82 } 83 return e; 84 } 85 86 93 94 public static void arg(Entry e, int a, ItemType type, int cardinality) { 95 try { 96 e.argumentTypes[a] = SequenceType.makeSequenceType(type, cardinality); 97 } catch (ArrayIndexOutOfBoundsException err) { 98 System.err.println("Internal Saxon error: Can't set argument " + a + " of " + e.name); 99 } 100 } 101 102 private static HashMap functionTable = new HashMap (200); 103 104 protected static ItemType SAME_AS_FIRST_ARGUMENT = NodeKindTest.NAMESPACE; 105 107 static { 108 Entry e; 109 e = register("abs", Rounding.class, Rounding.ABS, 1, 1, SAME_AS_FIRST_ARGUMENT, StaticProperty.ALLOWS_ZERO_OR_ONE); 110 arg(e, 0, Type.NUMBER_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 111 112 e = register("adjust-date-to-timezone", Adjust.class, 0, 1, 2, Type.DATE_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 113 arg(e, 0, Type.DATE_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 114 arg(e, 1, Type.DAY_TIME_DURATION_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 115 116 e = register("adjust-dateTime-to-timezone", Adjust.class, 0, 1, 2, Type.DATE_TIME_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 117 arg(e, 0, Type.DATE_TIME_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 118 arg(e, 1, Type.DAY_TIME_DURATION_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 119 120 e = register("adjust-time-to-timezone", Adjust.class, 0, 1, 2, Type.TIME_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 121 arg(e, 0, Type.TIME_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 122 arg(e, 1, Type.DAY_TIME_DURATION_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 123 124 e = register("avg", Aggregate.class, Aggregate.AVG, 1, 1, Type.ANY_ATOMIC_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 125 arg(e, 0, Type.ANY_ATOMIC_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 127 128 e = register("base-uri", BaseURI.class, 0, 0, 1, Type.ANY_URI_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 129 arg(e, 0, Type.NODE_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 130 131 e = register("boolean", BooleanFn.class, BooleanFn.BOOLEAN, 1, 1, Type.BOOLEAN_TYPE, StaticProperty.EXACTLY_ONE); 132 arg(e, 0, Type.ITEM_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 133 134 e = register("ceiling", Rounding.class, Rounding.CEILING, 1, 1, SAME_AS_FIRST_ARGUMENT, StaticProperty.ALLOWS_ZERO_OR_ONE); 135 arg(e, 0, Type.NUMBER_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 136 137 e = register("codepoint-equal", CodepointEqual.class, 0, 2, 2, Type.BOOLEAN_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 138 arg(e, 0, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 139 arg(e, 1, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 140 141 e = register("codepoints-to-string", Unicode.class, Unicode.FROM_CODEPOINTS, 1, 1, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 142 arg(e, 0, Type.INTEGER_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 143 144 e = register("collection", Collection.class, 0, 0, 1, Type.NODE_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 145 arg(e, 0, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 146 147 e = register("compare", Compare.class, 0, 2, 3, Type.INTEGER_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 148 arg(e, 0, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 149 arg(e, 1, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 150 arg(e, 2, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 151 152 e = register("concat", Concat.class, 0, 2, Integer.MAX_VALUE, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 153 arg(e, 0, Type.ANY_ATOMIC_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 154 156 e = register("contains", Contains.class, Contains.CONTAINS, 2, 3, Type.BOOLEAN_TYPE, StaticProperty.EXACTLY_ONE); 157 arg(e, 0, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 158 arg(e, 1, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 159 arg(e, 2, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 160 161 e = register("count", Aggregate.class, Aggregate.COUNT, 1, 1, Type.INTEGER_TYPE, StaticProperty.EXACTLY_ONE); 162 arg(e, 0, Type.ITEM_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 163 164 register("current", Current.class, 0, 0, 0, Type.ITEM_TYPE, StaticProperty.EXACTLY_ONE); 165 register("current-date", CurrentDateTime.class, 0, 0, 0, Type.DATE_TYPE, StaticProperty.EXACTLY_ONE); 166 register("current-dateTime", CurrentDateTime.class, 0, 0, 0, Type.DATE_TIME_TYPE, StaticProperty.EXACTLY_ONE); 167 register("current-time", CurrentDateTime.class, 0, 0, 0, Type.TIME_TYPE, StaticProperty.EXACTLY_ONE); 168 169 register("current-group", CurrentGroup.class, CurrentGroup.CURRENT_GROUP, 0, 0, Type.ITEM_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 170 register("current-grouping-key", CurrentGroup.class, CurrentGroup.CURRENT_GROUPING_KEY, 0, 0, Type.ANY_ATOMIC_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 171 172 e = register("data", Data.class, 0, 1, 1, Type.ANY_ATOMIC_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 173 arg(e, 0, Type.ITEM_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 174 175 e = register("dateTime", DateTimeConstructor.class, 0, 2, 2, Type.DATE_TIME_TYPE, StaticProperty.EXACTLY_ONE); 176 arg(e, 0, Type.DATE_TYPE, StaticProperty.EXACTLY_ONE); 177 arg(e, 1, Type.TIME_TYPE, StaticProperty.EXACTLY_ONE); 178 179 e = register("day-from-date", Component.class, (Component.DAY<<16) + Type.DATE, 1, 1, Type.INTEGER_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 180 arg(e, 0, Type.DATE_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 181 182 e = register("day-from-dateTime", Component.class, (Component.DAY<<16) + Type.DATE_TIME, 1, 1, Type.INTEGER_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 183 arg(e, 0, Type.DATE_TIME_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 184 185 e = register("days-from-duration", Component.class, (Component.DAY<<16) + Type.DAY_TIME_DURATION, 1, 1, Type.INTEGER_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 186 arg(e, 0, Type.DAY_TIME_DURATION_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 187 188 e = register("deep-equal", DeepEqual.class, 0, 2, 3, Type.BOOLEAN_TYPE, StaticProperty.EXACTLY_ONE); 189 arg(e, 0, Type.ITEM_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 190 arg(e, 1, Type.ITEM_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 191 arg(e, 2, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 192 193 register("default-collation", DefaultCollation.class, 0, 0, 0, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 194 195 e = register("distinct-values", DistinctValues.class, 0, 1, 2, Type.ANY_ATOMIC_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 196 arg(e, 0, Type.ANY_ATOMIC_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 197 arg(e, 1, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 198 199 e = register("doc", Doc.class, Doc.DOC, 1, 1, NodeKindTest.DOCUMENT, StaticProperty.ALLOWS_ZERO_OR_ONE); 200 arg(e, 0, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 201 202 e = register("doc-available", Doc.class, Doc.DOC_AVAILABLE, 1, 1, Type.BOOLEAN_TYPE, StaticProperty.EXACTLY_ONE); 203 arg(e, 0, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 204 205 e = register("document", Document.class, 0, 1, 2, Type.NODE_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 206 arg(e, 0, Type.ITEM_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 207 arg(e, 1, Type.NODE_TYPE, StaticProperty.EXACTLY_ONE); 208 209 e = register("document-uri", NamePart.class, NamePart.DOCUMENT_URI, 1, 1, Type.ANY_URI_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 210 arg(e, 0, NodeKindTest.DOCUMENT, StaticProperty.ALLOWS_ZERO_OR_MORE); 211 212 e = register("empty", Existence.class, Existence.EMPTY, 1, 1, Type.BOOLEAN_TYPE, StaticProperty.EXACTLY_ONE); 213 arg(e, 0, Type.ITEM_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 214 215 e = register("ends-with", Contains.class, Contains.ENDSWITH, 2, 3, Type.BOOLEAN_TYPE, StaticProperty.EXACTLY_ONE); 216 arg(e, 0, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 217 arg(e, 1, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 218 arg(e, 2, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 219 220 e = register("element-available", Available.class, Available.ELEMENT_AVAILABLE, 1, 1, Type.BOOLEAN_TYPE, StaticProperty.EXACTLY_ONE); 221 arg(e, 0, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 222 223 e = register("encode-for-uri", EscapeURI.class, EscapeURI.ENCODE_FOR_URI, 1, 1, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 224 arg(e, 0, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 225 226 e = register("error", Error .class, 0, 0, 3, Type.ITEM_TYPE, StaticProperty.EXACTLY_ONE); 227 arg(e, 0, Type.QNAME_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 229 arg(e, 1, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 230 arg(e, 2, Type.ITEM_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 231 232 e = register("escape-uri", EscapeURI.class, EscapeURI.ESCAPE, 2, 2, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 233 arg(e, 0, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 234 arg(e, 1, Type.BOOLEAN_TYPE, StaticProperty.EXACTLY_ONE); 235 236 e = register("exactly-one", TreatFn.class, StaticProperty.EXACTLY_ONE, 1, 1, SAME_AS_FIRST_ARGUMENT, StaticProperty.EXACTLY_ONE); 237 arg(e, 0, Type.ITEM_TYPE, StaticProperty.EXACTLY_ONE); 238 240 e = register("exists", Existence.class, Existence.EXISTS, 1, 1, Type.BOOLEAN_TYPE, StaticProperty.EXACTLY_ONE); 241 arg(e, 0, Type.ITEM_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 242 243 e = register("expanded-QName", QNameFn.class, 0, 2, 2, Type.QNAME_TYPE, StaticProperty.EXACTLY_ONE); 245 arg(e, 0, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 246 arg(e, 1, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 247 248 register("false", BooleanFn.class, BooleanFn.FALSE, 0, 0, Type.BOOLEAN_TYPE, StaticProperty.EXACTLY_ONE); 249 250 e = register("floor", Rounding.class, Rounding.FLOOR, 1, 1, SAME_AS_FIRST_ARGUMENT, StaticProperty.ALLOWS_ZERO_OR_ONE); 251 arg(e, 0, Type.NUMBER_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 252 253 e = register("format-date", FormatDate.class, Type.DATE, 2, 5, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 254 arg(e, 0, Type.DATE_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 255 arg(e, 1, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 256 arg(e, 2, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 257 arg(e, 3, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 258 arg(e, 4, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 259 260 e = register("format-dateTime", FormatDate.class, Type.DATE_TIME, 2, 5, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 261 arg(e, 0, Type.DATE_TIME_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 262 arg(e, 1, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 263 arg(e, 2, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 264 arg(e, 3, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 265 arg(e, 4, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 266 267 e = register("format-number", FormatNumber2.class, 0, 2, 3, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 268 arg(e, 0, Type.NUMBER_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 269 arg(e, 1, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 270 arg(e, 2, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 271 272 277 e = register("format-time", FormatDate.class, Type.TIME, 2, 5, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 278 arg(e, 0, Type.TIME_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 279 arg(e, 1, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 280 arg(e, 2, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 281 arg(e, 3, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 282 arg(e, 4, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 283 284 e = register("function-available", Available.class, Available.FUNCTION_AVAILABLE, 1, 2, Type.BOOLEAN_TYPE, StaticProperty.EXACTLY_ONE); 285 arg(e, 0, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 286 arg(e, 1, Type.INTEGER_TYPE, StaticProperty.EXACTLY_ONE); 287 288 e = register("generate-id", NamePart.class, NamePart.GENERATE_ID, 0, 1, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 289 arg(e, 0, Type.NODE_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 290 291 e = register("hours-from-dateTime", Component.class, (Component.HOURS<<16) + Type.DATE_TIME, 1, 1, Type.INTEGER_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 292 arg(e, 0, Type.DATE_TIME_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 293 294 e = register("hours-from-duration", Component.class, (Component.HOURS<<16) + Type.DAY_TIME_DURATION, 1, 1, Type.INTEGER_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 295 arg(e, 0, Type.DAY_TIME_DURATION_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 296 297 e = register("hours-from-time", Component.class, (Component.HOURS<<16) + Type.TIME, 1, 1, Type.INTEGER_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 298 arg(e, 0, Type.TIME_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 299 300 e = register("id", Id.class, 0, 1, 2, NodeKindTest.ELEMENT, StaticProperty.ALLOWS_ZERO_OR_MORE); 301 arg(e, 0, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 302 arg(e, 1, Type.NODE_TYPE, StaticProperty.EXACTLY_ONE); 303 304 e = register("idref", Idref.class, 0, 1, 2, Type.NODE_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 305 arg(e, 0, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 306 arg(e, 1, Type.NODE_TYPE, StaticProperty.EXACTLY_ONE); 307 308 register("implicit-timezone", CurrentDateTime.class, 0, 0, 0, Type.DAY_TIME_DURATION_TYPE, StaticProperty.EXACTLY_ONE); 309 310 e = register("in-scope-prefixes", InScopePrefixes.class, 0, 1, 1, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 311 arg(e, 0, NodeKindTest.ELEMENT, StaticProperty.EXACTLY_ONE); 312 313 e = register("index-of", IndexOf.class, 0, 2, 3, Type.INTEGER_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 314 arg(e, 0, Type.ANY_ATOMIC_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 315 arg(e, 1, Type.ANY_ATOMIC_TYPE, StaticProperty.EXACTLY_ONE); 316 arg(e, 2, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 317 318 e = register("insert-before", Insert.class, 0, 3, 3, Type.ITEM_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 319 arg(e, 0, Type.ITEM_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 320 arg(e, 1, Type.INTEGER_TYPE, StaticProperty.EXACTLY_ONE); 321 arg(e, 2, Type.ITEM_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 322 323 e = register("iri-to-uri", EscapeURI.class, EscapeURI.IRI_TO_URI, 1, 1, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 324 arg(e, 0, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 325 326 e = register("key", KeyFn.class, 0, 2, 3, Type.NODE_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 327 arg(e, 0, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 328 arg(e, 1, Type.ANY_ATOMIC_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 329 arg(e, 2, Type.NODE_TYPE, StaticProperty.EXACTLY_ONE); 330 331 e = register("lang", Lang.class, 0, 1, 2, Type.BOOLEAN_TYPE, StaticProperty.EXACTLY_ONE); 332 arg(e, 0, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 333 arg(e, 1, Type.NODE_TYPE, StaticProperty.EXACTLY_ONE); 334 335 register("last", Last.class, 0, 0, 0, Type.INTEGER_TYPE, StaticProperty.EXACTLY_ONE); 336 337 e = register("local-name", NamePart.class, NamePart.LOCAL_NAME, 0, 1, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 338 arg(e, 0, Type.NODE_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 339 340 e = register("local-name-from-QName", Component.class, (Component.LOCALNAME<<16) + Type.QNAME, 1, 1, Type.NCNAME_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 341 arg(e, 0, Type.QNAME_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 342 343 e = register("lower-case", ForceCase.class, ForceCase.LOWERCASE, 1, 1, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 344 arg(e, 0, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 345 346 e = register("matches", Matches.class, 0, 2, 3, Type.BOOLEAN_TYPE, StaticProperty.EXACTLY_ONE); 347 arg(e, 0, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 348 arg(e, 1, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 349 arg(e, 2, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 350 351 e = register("max", Minimax.class, Minimax.MAX, 1, 2, SAME_AS_FIRST_ARGUMENT, StaticProperty.ALLOWS_ZERO_OR_ONE); 352 arg(e, 0, Type.ANY_ATOMIC_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 353 arg(e, 1, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 354 355 e = register("min", Minimax.class, Minimax.MIN, 1, 2, SAME_AS_FIRST_ARGUMENT, StaticProperty.ALLOWS_ZERO_OR_ONE); 356 arg(e, 0, Type.ANY_ATOMIC_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 357 arg(e, 1, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 358 359 e = register("minutes-from-dateTime", Component.class, (Component.MINUTES<<16) + Type.DATE_TIME, 1, 1, Type.INTEGER_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 360 arg(e, 0, Type.DATE_TIME_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 361 362 e = register("minutes-from-duration", Component.class, (Component.MINUTES<<16) + Type.DAY_TIME_DURATION, 1, 1, Type.INTEGER_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 363 arg(e, 0, Type.DAY_TIME_DURATION_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 364 365 e = register("minutes-from-time", Component.class, (Component.MINUTES<<16) + Type.TIME, 1, 1, Type.INTEGER_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 366 arg(e, 0, Type.TIME_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 367 368 e = register("month-from-date", Component.class, (Component.MONTH<<16) + Type.DATE, 1, 1, Type.INTEGER_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 369 arg(e, 0, Type.DATE_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 370 371 e = register("month-from-dateTime", Component.class, (Component.MONTH<<16) + Type.DATE_TIME, 1, 1, Type.INTEGER_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 372 arg(e, 0, Type.DATE_TIME_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 373 374 e = register("months-from-duration", Component.class, (Component.MONTH<<16) + Type.YEAR_MONTH_DURATION, 1, 1, Type.INTEGER_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 375 arg(e, 0, Type.YEAR_MONTH_DURATION_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 376 377 e = register("months-from-yearMonthDuration", Component.class, (Component.MONTH<<16) + Type.YEAR_MONTH_DURATION, 1, 1, Type.INTEGER_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 379 arg(e, 0, Type.YEAR_MONTH_DURATION_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 380 381 e = register("name", NamePart.class, NamePart.NAME, 0, 1, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 382 arg(e, 0, Type.NODE_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 383 384 e = register("namespace-uri", NamePart.class, NamePart.NAMESPACE_URI, 0, 1, Type.ANY_URI_TYPE, StaticProperty.EXACTLY_ONE); 385 arg(e, 0, Type.NODE_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 386 387 e = register("namespace-uri-for-prefix", NamespaceForPrefix.class, 0, 2, 2, Type.ANY_URI_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 388 arg(e, 0, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 389 arg(e, 1, NodeKindTest.ELEMENT, StaticProperty.EXACTLY_ONE); 390 391 e = register("namespace-uri-from-QName", Component.class, (Component.NAMESPACE<<16) + Type.QNAME, 1, 1, Type.ANY_URI_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 392 arg(e, 0, Type.QNAME_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 393 394 e = register("nilled", Nilled.class, 0, 1, 1, Type.BOOLEAN_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 395 arg(e, 0, Type.NODE_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 396 397 e = register("node-name", NamePart.class, NamePart.NODE_NAME, 0, 1, Type.QNAME_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 398 arg(e, 0, Type.NODE_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 399 400 e = register("not", BooleanFn.class, BooleanFn.NOT, 1, 1, Type.BOOLEAN_TYPE, StaticProperty.EXACTLY_ONE); 401 arg(e, 0, Type.ITEM_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 402 403 register("normalize-space", NormalizeSpace.class, 0, 0, 1, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 404 register("normalize-space#0", NormalizeSpace.class, 0, 0, 0, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 405 406 e = register("normalize-space#1", NormalizeSpace.class, 0, 1, 1, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 407 arg(e, 0, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 408 409 e = register("normalize-unicode", NormalizeUnicode.class, 0, 1, 2, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 410 arg(e, 0, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 411 arg(e, 1, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 412 413 e = register("number", NumberFn.class, 0, 0, 1, Type.DOUBLE_TYPE, StaticProperty.EXACTLY_ONE); 414 arg(e, 0, Type.ITEM_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 415 416 e = register("one-or-more", TreatFn.class, StaticProperty.ALLOWS_ONE_OR_MORE, 1, 1, SAME_AS_FIRST_ARGUMENT, StaticProperty.ALLOWS_ONE_OR_MORE); 417 arg(e, 0, Type.ITEM_TYPE, StaticProperty.ALLOWS_ONE_OR_MORE); 418 420 register("position", Position.class, 0, 0, 0, Type.INTEGER_TYPE, StaticProperty.EXACTLY_ONE); 421 422 e = register("prefix-from-QName", Component.class, (Component.PREFIX<<16) + Type.QNAME, 1, 1, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 423 arg(e, 0, Type.QNAME_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 424 425 e = register("QName", QNameFn.class, 0, 2, 2, Type.QNAME_TYPE, StaticProperty.EXACTLY_ONE); 426 arg(e, 0, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 427 arg(e, 1, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 428 429 e = register("regex-group", RegexGroup.class, 0, 1, 1, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 430 arg(e, 0, Type.INTEGER_TYPE, StaticProperty.EXACTLY_ONE); 431 432 e = register("remove", Remove.class, 0, 2, 2, SAME_AS_FIRST_ARGUMENT, StaticProperty.ALLOWS_ZERO_OR_MORE); 433 arg(e, 0, Type.ITEM_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 434 arg(e, 1, Type.INTEGER_TYPE, StaticProperty.EXACTLY_ONE); 435 436 e = register("replace", Replace.class, 0, 3, 4, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 437 arg(e, 0, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 438 arg(e, 1, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 439 arg(e, 2, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 440 arg(e, 3, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 441 442 e = register("resolve-QName", ResolveQName.class, 0, 2, 2, Type.QNAME_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 443 arg(e, 0, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 444 arg(e, 1, NodeKindTest.ELEMENT, StaticProperty.EXACTLY_ONE); 445 446 e = register("resolve-uri", ResolveURI.class, 0, 1, 2, Type.ANY_URI_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 447 arg(e, 0, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 448 arg(e, 1, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 449 450 e = register("reverse", Reverse.class, 0, 1, 1, Type.ITEM_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 451 arg(e, 0, Type.ITEM_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 452 453 e = register("root", Root.class, 0, 0, 1, Type.NODE_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 454 arg(e, 0, Type.NODE_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 455 456 e = register("round", Rounding.class, Rounding.ROUND, 1, 1, SAME_AS_FIRST_ARGUMENT, StaticProperty.ALLOWS_ZERO_OR_ONE); 457 arg(e, 0, Type.NUMBER_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 458 459 e = register("round-half-to-even", Rounding.class, Rounding.HALF_EVEN, 1, 2, SAME_AS_FIRST_ARGUMENT, StaticProperty.ALLOWS_ZERO_OR_ONE); 460 arg(e, 0, Type.NUMBER_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 461 arg(e, 1, Type.INTEGER_TYPE, StaticProperty.EXACTLY_ONE); 462 463 e = register("seconds-from-dateTime", Component.class, (Component.SECONDS<<16) + Type.DATE_TIME, 1, 1, Type.DECIMAL_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 464 arg(e, 0, Type.DATE_TIME_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 465 466 e = register("seconds-from-duration", Component.class, (Component.SECONDS<<16) + Type.DAY_TIME_DURATION, 1, 1, Type.DECIMAL_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 467 arg(e, 0, Type.DAY_TIME_DURATION_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 468 469 e = register("seconds-from-time", Component.class, (Component.SECONDS<<16) + Type.TIME, 1, 1, Type.DECIMAL_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 470 arg(e, 0, Type.TIME_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 471 472 e = register("starts-with", Contains.class, Contains.STARTSWITH, 2, 3, Type.BOOLEAN_TYPE, StaticProperty.EXACTLY_ONE); 473 arg(e, 0, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 474 arg(e, 1, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 475 arg(e, 2, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 476 477 register("static-base-uri", StaticBaseURI.class, 0, 0, 0, Type.ANY_URI_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 478 479 e = register("string", StringFn.class, 0, 0, 1, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 480 arg(e, 0, Type.ITEM_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 481 482 register("string-length", StringLength.class, 0, 0, 1, Type.INTEGER_TYPE, StaticProperty.EXACTLY_ONE); 483 register("string-length#0", StringLength.class, 0, 0, 0, Type.INTEGER_TYPE, StaticProperty.EXACTLY_ONE); 484 485 e = register("string-length#1", StringLength.class, 0, 1, 1, Type.INTEGER_TYPE, StaticProperty.EXACTLY_ONE); 486 arg(e, 0, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 487 488 e = register("string-join", StringJoin.class, 0, 2, 2, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 489 arg(e, 0, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 490 arg(e, 1, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 491 492 e = register("string-to-codepoints", Unicode.class, Unicode.TO_CODEPOINTS, 1, 1, Type.INTEGER_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 493 arg(e, 0, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 494 495 e = register("subsequence", Subsequence.class, 0, 2, 3, SAME_AS_FIRST_ARGUMENT, StaticProperty.ALLOWS_ZERO_OR_MORE); 496 arg(e, 0, Type.ITEM_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 497 arg(e, 1, Type.NUMBER_TYPE, StaticProperty.EXACTLY_ONE); 498 arg(e, 2, Type.NUMBER_TYPE, StaticProperty.EXACTLY_ONE); 499 500 e = register("substring", Substring.class, 0, 2, 3, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 501 arg(e, 0, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 502 arg(e, 1, Type.NUMBER_TYPE, StaticProperty.EXACTLY_ONE); 503 arg(e, 2, Type.NUMBER_TYPE, StaticProperty.EXACTLY_ONE); 504 505 e = register("substring-after", Contains.class, Contains.AFTER, 2, 3, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 506 arg(e, 0, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 507 arg(e, 1, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 508 arg(e, 2, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 509 510 e = register("substring-before", Contains.class, Contains.BEFORE, 2, 3, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 511 arg(e, 0, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 512 arg(e, 1, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 513 arg(e, 2, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 514 515 e = register("sum", Aggregate.class, Aggregate.SUM, 1, 2, Type.ANY_ATOMIC_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 516 arg(e, 0, Type.ANY_ATOMIC_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 517 arg(e, 1, Type.ANY_ATOMIC_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 518 519 e = register("system-property", SystemProperty.class, 0, 1, 1, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 520 arg(e, 0, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 521 522 e = register("timezone-from-date", Component.class, (Component.TIMEZONE<<16) + Type.DATE, 1, 1, Type.DAY_TIME_DURATION_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 523 arg(e, 0, Type.DATE_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 524 525 e = register("timezone-from-dateTime", Component.class, (Component.TIMEZONE<<16) + Type.DATE_TIME, 1, 1, Type.DAY_TIME_DURATION_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 526 arg(e, 0, Type.DATE_TIME_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 527 528 e = register("timezone-from-time", Component.class, (Component.TIMEZONE<<16) + Type.TIME, 1, 1, Type.DAY_TIME_DURATION_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 529 arg(e, 0, Type.TIME_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 530 531 e = register("trace", Trace.class, 0, 2, 2, SAME_AS_FIRST_ARGUMENT, StaticProperty.ALLOWS_ZERO_OR_MORE); 532 arg(e, 0, Type.ITEM_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 533 arg(e, 1, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 534 535 register("true", BooleanFn.class, BooleanFn.TRUE, 0, 0, Type.BOOLEAN_TYPE, StaticProperty.EXACTLY_ONE); 536 537 e = register("translate", Translate.class, 0, 3, 3, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 538 arg(e, 0, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 539 arg(e, 1, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 540 arg(e, 2, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 541 542 e = register("tokenize", Tokenize.class, 0, 2, 3, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 543 arg(e, 0, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 544 arg(e, 1, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 545 arg(e, 2, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 546 547 e = register("unordered", Unordered.class, 0, 1, 1, SAME_AS_FIRST_ARGUMENT, StaticProperty.ALLOWS_ZERO_OR_MORE); 548 arg(e, 0, Type.ITEM_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); 549 550 e = register("upper-case", ForceCase.class, ForceCase.UPPERCASE, 1, 1, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 551 arg(e, 0, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 552 553 e = register("unparsed-entity-uri", UnparsedEntity.class, UnparsedEntity.URI, 1, 1, Type.ANY_URI_TYPE, StaticProperty.EXACTLY_ONE); 554 arg(e, 0, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 555 556 e = register("unparsed-entity-uri_9999_", UnparsedEntity.class, UnparsedEntity.URI, 2, 2, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 558 arg(e, 0, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 559 arg(e, 1, NodeKindTest.DOCUMENT, StaticProperty.EXACTLY_ONE); 560 561 e = register("unparsed-entity-public-id", UnparsedEntity.class, UnparsedEntity.PUBLIC_ID, 1, 1, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 562 arg(e, 0, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 563 564 e = register("unparsed-entity-public-id_9999_", UnparsedEntity.class, UnparsedEntity.PUBLIC_ID, 2, 2, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 566 arg(e, 0, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 567 arg(e, 1, NodeKindTest.DOCUMENT, StaticProperty.EXACTLY_ONE); 568 569 e = register("unparsed-text", UnparsedText.class, UnparsedText.UNPARSED_TEXT, 1, 2, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 570 arg(e, 0, Type.STRING_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 571 arg(e, 1, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 572 573 e = register("unparsed-text-available", UnparsedText.class, UnparsedText.UNPARSED_TEXT_AVAILABLE, 1, 2, Type.BOOLEAN_TYPE, StaticProperty.EXACTLY_ONE); 574 arg(e, 0, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 575 arg(e, 1, Type.STRING_TYPE, StaticProperty.EXACTLY_ONE); 576 577 e = register("year-from-date", Component.class, (Component.YEAR<<16) + Type.DATE, 1, 1, Type.INTEGER_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 578 arg(e, 0, Type.DATE_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 579 580 e = register("year-from-dateTime", Component.class, (Component.YEAR<<16) + Type.DATE_TIME, 1, 1, Type.INTEGER_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 581 arg(e, 0, Type.DATE_TIME_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 582 583 e = register("years-from-duration", Component.class, (Component.YEAR<<16) + Type.YEAR_MONTH_DURATION, 1, 1, Type.INTEGER_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 584 arg(e, 0, Type.YEAR_MONTH_DURATION_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 585 586 e = register("zero-or-one", TreatFn.class, StaticProperty.ALLOWS_ZERO_OR_ONE, 1, 1, SAME_AS_FIRST_ARGUMENT, StaticProperty.ALLOWS_ZERO_OR_ONE); 587 arg(e, 0, Type.ITEM_TYPE, StaticProperty.ALLOWS_ZERO_OR_ONE); 588 } 590 591 592 600 601 public static Entry getFunction(String name, int arity) { 602 Entry e = (Entry)functionTable.get(name + '#' + arity); 604 if (e != null) { 605 return e; 606 } 607 return (Entry)functionTable.get(name); 609 } 610 611 614 public static class Entry implements java.io.Serializable { 615 619 public String name; 620 623 public Class implementationClass; 624 628 public int opcode; 629 632 public int minArguments; 633 636 public int maxArguments; 637 640 public ItemType itemType; 641 644 public int cardinality; 645 648 public SequenceType[] argumentTypes; 649 } 650 } 651 652 | Popular Tags |