| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
package net.sf.saxon.functions; |
| 9 |
|
| 10 |
import net.sf.saxon.expr.ContextOriginator; |
| 11 |
import net.sf.saxon.expr.OperandRole; |
| 12 |
import net.sf.saxon.expr.OperandUsage; |
| 13 |
import net.sf.saxon.expr.XPathContext; |
| 14 |
import net.sf.saxon.expr.parser.ContextItemStaticInfo; |
| 15 |
import net.sf.saxon.expr.parser.ExpressionVisitor; |
| 16 |
import net.sf.saxon.expr.sort.AtomicComparer; |
| 17 |
import net.sf.saxon.om.AtomicSequence; |
| 18 |
import net.sf.saxon.om.Function; |
| 19 |
import net.sf.saxon.query.AnnotationList; |
| 20 |
import net.sf.saxon.trace.ExpressionPresenter; |
| 21 |
import net.sf.saxon.trans.XPathException; |
| 22 |
|
| 23 |
import java.util.Arrays; |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
public abstract class AbstractFunction implements Function { |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
public OperandRole[] getOperandRoles() { |
| 36 |
OperandRole[] roles = new OperandRole[getArity()]; |
| 37 |
Arrays.fill(roles, new OperandRole(0, OperandUsage.NAVIGATION)); |
| 38 |
return roles; |
| 39 |
} |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
public AtomicSequence atomize() throws XPathException { |
| 49 |
throw new XPathException("Function items (other than arrays) cannot be atomized", "FOTY0013"); |
| 50 |
} |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
public boolean isArray() { |
| 58 |
return false; |
| 59 |
} |
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
public boolean isMap() { |
| 67 |
return false; |
| 68 |
} |
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
public String getStringValue() { |
| 77 |
throw new UnsupportedOperationException("The string value of a function is not defined"); |
| 78 |
} |
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
public CharSequence getStringValueCS() { |
| 87 |
throw new UnsupportedOperationException("The string value of a function is not defined"); |
| 88 |
} |
| 89 |
|
| 90 |
@Override |
| 91 |
public AnnotationList getAnnotations() { |
| 92 |
return AnnotationList.EMPTY; |
| 93 |
} |
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
public boolean effectiveBooleanValue() throws XPathException { |
| 102 |
throw new XPathException("A function has no effective boolean value", "XPTY0004"); |
| 103 |
} |
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
public void simplify() throws XPathException { |
| 108 |
|
| 109 |
} |
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
public void typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType) throws XPathException { |
| 120 |
|
| 121 |
} |
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
public XPathContext makeNewContext(XPathContext callingContext, ContextOriginator originator) { |
| 133 |
return callingContext; |
| 134 |
} |
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
public boolean deepEquals(Function other, XPathContext context, AtomicComparer comparer, int flags) throws XPathException { |
| 143 |
throw new XPathException("Argument to deep-equal() contains a function item", "FOTY0015"); |
| 144 |
} |
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
public void export(ExpressionPresenter out) throws XPathException { |
| 150 |
throw new UnsupportedOperationException("export() not implemented for " + this.getClass()); |
| 151 |
} |
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
public boolean isTrustedResultType() { |
| 158 |
return false; |
| 159 |
} |
| 160 |
} |
| 161 |
|
| 162 |
|