1 package net.sf.saxon.functions; 2 3 import net.sf.saxon.expr.Expression; 4 import net.sf.saxon.trans.XPathException; 5 6 import java.util.ArrayList ; 7 import java.util.Iterator ; 8 import java.util.List ; 9 10 14 public class FunctionLibraryList implements FunctionLibrary { 15 16 public List libraryList = new ArrayList (8); 17 18 23 24 public void addFunctionLibrary(FunctionLibrary lib) { 25 libraryList.add(lib); 26 } 27 28 38 39 public boolean isAvailable(int fingerprint, String uri, String local, int arity) { 40 for (Iterator it=libraryList.iterator(); it.hasNext();) { 41 FunctionLibrary lib = (FunctionLibrary)it.next(); 42 if (lib.isAvailable(fingerprint, uri, local, arity)) { 43 return true; 44 } 45 } 46 return false; 47 } 48 49 66 67 public Expression bind(int nameCode, String uri, String local, Expression[] staticArgs) 68 throws XPathException { 69 for (Iterator it=libraryList.iterator(); it.hasNext();) { 70 FunctionLibrary lib = (FunctionLibrary)it.next(); 71 Expression func = lib.bind(nameCode, uri, local, staticArgs); 72 if (func != null) { 73 return func; 74 } 75 } 76 return null; 77 } 78 79 87 88 public List getLibraryList() { 89 return libraryList; 90 } 91 92 99 100 public FunctionLibrary copy() { 101 FunctionLibraryList fll = new FunctionLibraryList(); 102 fll.libraryList = new ArrayList (libraryList.size()); 103 for (int i=0; i<libraryList.size(); i++) { 104 fll.libraryList.add(((FunctionLibrary)libraryList.get(i)).copy()); 105 } 106 return fll; 107 } 108 } 109 | Popular Tags |