1 22 23 package org.xquark.xquery.parser; 24 25 import java.util.ArrayList ; 26 import java.util.HashMap ; 27 28 import org.xquark.xquery.parser.hinttree.HintTree; 29 import org.xquark.xquery.typing.TypeException; 30 import org.xquark.util.NamespaceContext; 31 32 public class ParserFactory implements ParserFactoryInterface { 33 34 private static final String RCSRevision = "$Revision: 1.21 $"; 35 private static final String RCSName = "$Name: $"; 36 37 public AttributeValuePair createAttributeValuePair(XQueryExpression attributeName, XQueryExpression attributeValue, boolean isXmlns, XQueryModule parentModule) throws TypeException, XQueryException { 38 return new AttributeValuePair(attributeName, attributeValue, isXmlns, parentModule); 39 } 40 41 public BinOpANDExpression createBinOpANDExpression(XQueryExpression mainExpression, XQueryExpression expression, XQueryModule parentModule) throws TypeException, XQueryException { 42 return new BinOpANDExpression(mainExpression, expression, parentModule); 43 } 44 45 public BinOpORExpression createBinOpORExpression(XQueryExpression mainExpression, XQueryExpression expression, XQueryModule parentModule) throws TypeException, XQueryException { 46 return new BinOpORExpression(mainExpression, expression, parentModule); 47 } 48 49 public CData createCData(String data, XQueryModule parentModule) throws TypeException, XQueryException { 50 return new CData(data, parentModule); 51 } 52 53 public CaseClauseExpression createCaseClauseExpression(SequenceType sequenceType, Variable variable, XQueryExpression returnExpression, XQueryModule parentModule) throws TypeException, XQueryException { 54 return new CaseClauseExpression(sequenceType, variable, returnExpression, parentModule); 55 } 56 57 public CastTreatExpression createCastTreatExpression(int kind, SequenceType sequenceType, XQueryExpression expression, XQueryModule parentModule) throws TypeException, XQueryException { 58 return new CastTreatExpression(kind, sequenceType, expression, parentModule); 59 } 60 61 public Document createDocument(XQueryExpression element, XQueryModule parentModule) throws TypeException, XQueryException { 62 return new Document(element, parentModule); 63 } 64 65 public Element createElement(XQueryExpression startTag, HashMap localPrefixes, ArrayList vectAttributes, ArrayList vectExpressions, XQueryModule parentModule) throws TypeException, XQueryException { 66 return new Element(startTag, localPrefixes, vectAttributes, vectExpressions, parentModule); 67 } 68 69 public FLWRExpression createFLWRExpression(ArrayList bindings, HintTree hintClause, XQueryExpression whereClause, ArrayList orderbys, XQueryExpression returnClause, XQueryModule parentModule) throws TypeException, XQueryException { 70 return new FLWRExpression(bindings, hintClause, whereClause, orderbys, returnClause, parentModule); 71 } 72 73 public FLWRExpression createFLWRExpression(ArrayList bindings, XQueryExpression whereClause, ArrayList orderbys, XQueryExpression returnClause, XQueryModule parentModule) throws TypeException, XQueryException { 74 return new FLWRExpression(bindings, orderbys, whereClause, returnClause, parentModule); 75 } 76 77 public FLWRExpression createFLWRExpression(ArrayList bindings, XQueryExpression whereClause, XQueryExpression returnClause, XQueryModule parentModule) throws TypeException, XQueryException { 78 return new FLWRExpression(bindings, whereClause, returnClause, parentModule); 79 } 80 81 public FunctionDeclaration createFunctionDeclaration(QName funcName, ArrayList tmpVect, SequenceType sequenceType, ArrayList vectExpression, XQueryModule parentModule) throws TypeException, XQueryException { 82 return new FunctionDeclaration(funcName, tmpVect, sequenceType, vectExpression, parentModule); 83 } 84 85 public ITEExpression createITEExpression(XQueryExpression expressionIf, XQueryExpression expressionThen, XQueryExpression expressionElse, XQueryModule parentModule) throws TypeException, XQueryException { 86 return new ITEExpression(expressionIf, expressionThen, expressionElse, parentModule); 87 } 88 89 public InstanceOfExpression createInstanceOfExpression(XQueryExpression expression, SequenceType sequenceType, XQueryModule parentModule) throws TypeException, XQueryException { 90 return new InstanceOfExpression(expression, sequenceType, parentModule); 91 } 92 93 public InternalFunctionCall createInternalFunctionCall(QName funcName, ArrayList argsVect, XQueryModule parentModule) throws TypeException, XQueryException { 94 return new InternalFunctionCall(funcName, argsVect, parentModule); 95 } 96 97 public ItemType createItemType(XQueryExpression expression, XQueryModule parentModule) throws TypeException, XQueryException { 98 return new ItemType(expression, parentModule); 99 } 100 101 public HintTree createHintTree(byte type, byte side, Object left, Object right) { 102 return new HintTree(type, side, left, right); 103 } 104 105 public LibraryFunctionCall createLibraryFunctionCall(QName funcName, ArrayList argsVect, FunctionDeclaration funcdef, XQueryModule parentModule) throws TypeException, XQueryException { 106 return new LibraryFunctionCall(funcName, argsVect, funcdef, parentModule); 107 } 108 109 public ListOpAFTERExpression createListOpAFTERExpression(XQueryExpression mainExpression, XQueryExpression expression, XQueryModule parentModule) throws TypeException, XQueryException { 110 return new ListOpAFTERExpression(mainExpression, expression, parentModule); 111 } 112 113 public ListOpArithExpression createListOpArithExpression(XQueryExpression mainExpression, XQueryExpression expression, int kind, XQueryModule parentModule) throws TypeException, XQueryException { 114 return new ListOpArithExpression(mainExpression, expression, kind, parentModule); 115 } 116 117 public ListOpBEFOREExpression createListOpBEFOREExpression(XQueryExpression mainExpression, XQueryExpression expression, XQueryModule parentModule) throws TypeException, XQueryException { 118 return new ListOpBEFOREExpression(mainExpression, expression, parentModule); 119 } 120 121 public ListOpCompExpression createListOpCompExpression(XQueryExpression mainExpression, XQueryExpression expression, int kind, XQueryModule parentModule) throws TypeException, XQueryException { 122 return new ListOpCompExpression(mainExpression, expression, kind, parentModule); 123 } 124 125 public ListOpEXCEPTExpression createListOpEXCEPTExpression(XQueryExpression mainExpression, XQueryExpression expression, XQueryModule parentModule) throws TypeException, XQueryException { 126 return new ListOpEXCEPTExpression(mainExpression, expression, parentModule); 127 } 128 129 public ListOpINTERSECTExpression createListOpINTERSECTExpression(XQueryExpression mainExpression, XQueryExpression expression, XQueryModule parentModule) throws TypeException, XQueryException { 130 return new ListOpINTERSECTExpression(mainExpression, expression, parentModule); 131 } 132 133 public ListOpUNIONExpression createListOpUNIONExpression(XQueryExpression mainExpression, XQueryExpression expression, XQueryModule parentModule) throws TypeException, XQueryException { 134 return new ListOpUNIONExpression(mainExpression, expression, parentModule); 135 } 136 137 public LocatedExpression createLocatedExpression(ArrayList pathVect, boolean inPredicate, XQueryModule parentModule) throws TypeException, XQueryException { 138 return new LocatedExpression(pathVect, inPredicate, parentModule, false); 139 } 140 141 public ElementTest createElementTest(SchemaContextPath scp, QName elementQName, QName typeQName, boolean nillable, XQueryModule parentModule) throws TypeException, XQueryException { 142 return new ElementTest(scp, elementQName, typeQName, nillable, parentModule); 143 } 144 145 public AttributeTest createAttributeTest(SchemaContextPath scp, QName elementQName, QName typeQName, XQueryModule parentModule) throws TypeException, XQueryException { 146 return new AttributeTest(scp, elementQName, typeQName, parentModule); 147 } 148 149 public NodeTest createNodeTest(byte kind, XQueryExpression arg, XQueryModule parentModule) throws TypeException, XQueryException { 150 return new NodeTest(kind, arg, parentModule); 151 } 152 153 public QName createQName(String namespace, String prefixname, String typeName, XQueryModule parentModule, NamespaceContext namespaceContext) throws TypeException, XQueryException { 154 return new QName(namespace, prefixname, typeName, parentModule, namespaceContext); 155 } 156 157 public QuantifiedExpression createQuantifiedExpression(int kind, ArrayList variables, XQueryExpression expressionSat, XQueryModule parentModule) throws TypeException, XQueryException { 158 return new QuantifiedExpression(kind, variables, expressionSat, parentModule); 159 } 160 161 public RangeExpression createRangeExpression(XQueryExpression expression1, XQueryExpression expression2, XQueryModule parentModule) throws TypeException, XQueryException { 162 return new RangeExpression(expression1, expression2, parentModule); 163 } 164 165 public SchemaContextPath createSchemaContextPath(ArrayList steps, XQueryModule parentModule) throws TypeException, XQueryException { 166 return new SchemaContextPath(steps, parentModule); 167 } 168 169 public SchemaContextStep createSchemaContextStep(byte axis, XQueryExpression expression, XQueryModule parentModule) throws TypeException, XQueryException { 170 return new SchemaContextStep(axis, expression, parentModule); 171 } 172 173 public SequenceType createSequenceType(ItemType itemType, int occurrence, XQueryModule parentModule) throws TypeException, XQueryException { 174 return new SequenceType(itemType, occurrence, parentModule); 175 } 176 177 public SortedExpression createSortedExpression(XQueryExpression expression, ArrayList tmpVect, boolean stable, XQueryModule parentModule) throws TypeException, XQueryException { 178 return new SortedExpression(expression, tmpVect, stable, parentModule); 179 } 180 181 public Step createStep(boolean separator, byte axis, XQueryExpression expression, ArrayList predicates, XQueryModule parentModule) throws TypeException, XQueryException { 182 return new Step(separator, axis, expression, predicates, parentModule); 183 } 184 185 public TypeSwitchExpression createTypeSwitchExpression(XQueryExpression switchExpression, HashMap cases, Variable defaultVariable, XQueryExpression defaultExpression, XQueryModule parentModule) throws TypeException, XQueryException { 186 return new TypeSwitchExpression(switchExpression, cases, defaultVariable, defaultExpression, parentModule); 187 } 188 189 public UnOpMinusExpression createUnOpMinusExpression(XQueryExpression expression, boolean minus, XQueryModule parentModule) throws TypeException, XQueryException { 190 return new UnOpMinusExpression(expression, minus, parentModule); 191 } 192 193 public ValidateExpression createValidateExpression(int scopeType, int validationType, SchemaContextPath schemaContext, XQueryExpression validateExpression, XQueryModule parentModule) throws TypeException, XQueryException { 194 return new ValidateExpression(scopeType, validationType,schemaContext, validateExpression, parentModule); 195 } 196 197 public ValueBoolean createValueBoolean(String str, XQueryModule parentModule) throws TypeException, XQueryException { 198 return new ValueBoolean(str, parentModule); 199 } 200 201 public ValueDecimal createValueDecimal(String str, XQueryModule parentModule) throws TypeException, XQueryException { 202 return new ValueDecimal(str, parentModule); 203 } 204 205 public ValueDouble createValueDouble(String str, XQueryModule parentModule) throws TypeException, XQueryException { 206 return new ValueDouble(str, parentModule); 207 } 208 209 public ValueInteger createValueInteger(String str, XQueryModule parentModule) throws TypeException, XQueryException { 210 return new ValueInteger(str, parentModule); 211 } 212 213 public ValueString createValueString(String str, XQueryModule parentModule) throws TypeException, XQueryException { 214 return new ValueString(str, parentModule); 215 } 216 217 public ValueText createValueText(String str, XQueryModule parentModule) throws TypeException, XQueryException { 218 return new ValueText(str, parentModule); 219 } 220 221 public ExternalVariable createExternalVariable(Variable var, XQueryModule parentModule) throws TypeException, XQueryException { 222 return new ExternalVariable(var, parentModule); 223 } 224 225 public Variable createVariable(QName var, XQueryModule parentModule) throws TypeException, XQueryException { 226 return new Variable(var, parentModule); 227 } 228 229 public XMLComment createXMLComment(XQueryExpression comment, XQueryModule parentModule) throws TypeException, XQueryException { 230 return new XMLComment(comment, parentModule); 231 } 232 233 public ComputedNamespace createComputedNamespace(String ncname, XQueryExpression value, XQueryModule parentModule) throws TypeException, XQueryException { 234 return new ComputedNamespace(ncname,value,parentModule); 235 } 236 237 public ComputedText createComputedText(XQueryExpression value, XQueryModule parentModule) throws TypeException, XQueryException { 238 return new ComputedText(value,parentModule); 239 } 240 241 public XMLProcessingInstruction createXMLProcessingInstruction(XQueryExpression PITarget, XQueryExpression data, XQueryModule parentModule) throws TypeException, XQueryException { 242 return new XMLProcessingInstruction(PITarget, data, parentModule); 243 } 244 245 public XQueryExpressionSequence createXQueryExpressionSequence(ArrayList subExpressions, XQueryModule parentModule) throws TypeException, XQueryException { 246 return new XQueryExpressionSequence(subExpressions, parentModule); 247 } 248 249 public XQueryModule createXQueryModule() { 250 return new XQueryModule(); 251 } 252 253 public ImportSchema createImportSchema(boolean hasPrefix, String prefix, String name, String location) { 254 return new ImportSchema(hasPrefix, prefix, name, location); 255 } 256 257 public ImportModule createImportModule(String prefix, String name, String location, XQueryModule module) { 258 return new ImportModule(prefix, name, location, module); 259 } 260 261 public XQueryVoid createXQueryVoid(XQueryModule parentModule) throws TypeException, XQueryException { 262 return new XQueryVoid(parentModule); 263 } 264 } 265 | Popular Tags |