Repository: vxquery Updated Branches: refs/heads/master c849b88a7 -> 9b2cda170
runtime functions implemented for op:node-before op:node-after Project: http://git-wip-us.apache.org/repos/asf/vxquery/repo Commit: http://git-wip-us.apache.org/repos/asf/vxquery/commit/85ed19f1 Tree: http://git-wip-us.apache.org/repos/asf/vxquery/tree/85ed19f1 Diff: http://git-wip-us.apache.org/repos/asf/vxquery/diff/85ed19f1 Branch: refs/heads/master Commit: 85ed19f115f8fb6c1faaeccef46db49b0a994764 Parents: cda864c Author: Shivani Mall <[email protected]> Authored: Wed Jun 17 17:39:36 2015 -0700 Committer: Shivani Mall <[email protected]> Committed: Wed Jun 17 17:39:36 2015 -0700 ---------------------------------------------------------------------- .../accessors/nodes/AbstractNodePointable.java | 12 +++++ .../accessors/nodes/AttributeNodePointable.java | 12 ++--- .../accessors/nodes/DocumentNodePointable.java | 13 ++--- .../accessors/nodes/ElementNodePointable.java | 5 +- .../accessors/nodes/PINodePointable.java | 12 ++--- .../nodes/TextOrCommentNodePointable.java | 13 ++--- .../vxquery/functions/builtin-operators.xml | 18 +++---- .../AbstractNodePositionalCheckEvaluator.java | 50 ++++++++++++++++++++ .../functions/node/OpNodeAfterEvaluator.java | 33 +++++++++++++ .../node/OpNodeAfterEvaluatorFactory.java | 41 ++++++++++++++++ .../functions/node/OpNodeBeforeEvaluator.java | 33 +++++++++++++ .../node/OpNodeBeforeEvaluatorFactory.java | 41 ++++++++++++++++ 12 files changed, 236 insertions(+), 47 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/vxquery/blob/85ed19f1/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/AbstractNodePointable.java ---------------------------------------------------------------------- diff --git a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/AbstractNodePointable.java b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/AbstractNodePointable.java new file mode 100644 index 0000000..05a2b6d --- /dev/null +++ b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/AbstractNodePointable.java @@ -0,0 +1,12 @@ +package org.apache.vxquery.datamodel.accessors.nodes; + +import edu.uci.ics.hyracks.data.std.api.AbstractPointable; +import edu.uci.ics.hyracks.data.std.primitive.IntegerPointable; + +public abstract class AbstractNodePointable extends AbstractPointable { + public int getLocalNodeId(NodeTreePointable nodeTree) { + return nodeTree.nodeIdExists() ? IntegerPointable.getInteger(bytes, getLocalNodeIdOffset(nodeTree)) : -1; + } + + abstract protected int getLocalNodeIdOffset(NodeTreePointable nodeTree); +} http://git-wip-us.apache.org/repos/asf/vxquery/blob/85ed19f1/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/AttributeNodePointable.java ---------------------------------------------------------------------- diff --git a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/AttributeNodePointable.java b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/AttributeNodePointable.java index 22d651e..030222b 100644 --- a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/AttributeNodePointable.java +++ b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/AttributeNodePointable.java @@ -19,10 +19,8 @@ package org.apache.vxquery.datamodel.accessors.nodes; import org.apache.vxquery.datamodel.accessors.atomic.CodedQNamePointable; import edu.uci.ics.hyracks.api.dataflow.value.ITypeTraits; -import edu.uci.ics.hyracks.data.std.api.AbstractPointable; import edu.uci.ics.hyracks.data.std.api.IPointable; import edu.uci.ics.hyracks.data.std.api.IPointableFactory; -import edu.uci.ics.hyracks.data.std.primitive.IntegerPointable; import edu.uci.ics.hyracks.data.std.primitive.VoidPointable; /* @@ -39,7 +37,7 @@ import edu.uci.ics.hyracks.data.std.primitive.VoidPointable; * Integer LocalCode; * } */ -public class AttributeNodePointable extends AbstractPointable { +public class AttributeNodePointable extends AbstractNodePointable { private static final int LOCAL_NODE_ID_SIZE = 4; public static final IPointableFactory FACTORY = new IPointableFactory() { private static final long serialVersionUID = 1L; @@ -67,11 +65,7 @@ public class AttributeNodePointable extends AbstractPointable { } } - public int getLocalNodeId(NodeTreePointable nodeTree) { - return nodeTree.nodeIdExists() ? IntegerPointable.getInteger(bytes, getLocalNodeIdOffset(nodeTree)) : -1; - } - - public void getValue(NodeTreePointable nodeTree, IPointable value) { + public void getValue(NodeTreePointable nodeTree, IPointable value) { value.set(bytes, getValueOffset(nodeTree), getValueSize(nodeTree)); } @@ -91,7 +85,7 @@ public class AttributeNodePointable extends AbstractPointable { return nodeTree.typeExists() ? CodedQNamePointable.SIZE : 0; } - private int getLocalNodeIdOffset(NodeTreePointable nodeTree) { + protected int getLocalNodeIdOffset(NodeTreePointable nodeTree) { return getTypeOffset() + getTypeSize(nodeTree); } http://git-wip-us.apache.org/repos/asf/vxquery/blob/85ed19f1/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/DocumentNodePointable.java ---------------------------------------------------------------------- diff --git a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/DocumentNodePointable.java b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/DocumentNodePointable.java index 7c201bd..c3a2749 100644 --- a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/DocumentNodePointable.java +++ b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/DocumentNodePointable.java @@ -19,10 +19,8 @@ package org.apache.vxquery.datamodel.accessors.nodes; import org.apache.vxquery.datamodel.accessors.SequencePointable; import edu.uci.ics.hyracks.api.dataflow.value.ITypeTraits; -import edu.uci.ics.hyracks.data.std.api.AbstractPointable; import edu.uci.ics.hyracks.data.std.api.IPointable; import edu.uci.ics.hyracks.data.std.api.IPointableFactory; -import edu.uci.ics.hyracks.data.std.primitive.IntegerPointable; import edu.uci.ics.hyracks.data.std.primitive.VoidPointable; /* @@ -31,7 +29,7 @@ import edu.uci.ics.hyracks.data.std.primitive.VoidPointable; * Sequence content; * } */ -public class DocumentNodePointable extends AbstractPointable { +public class DocumentNodePointable extends AbstractNodePointable { private static final int LOCAL_NODE_ID_SIZE = 4; public static final IPointableFactory FACTORY = new IPointableFactory() { private static final long serialVersionUID = 1L; @@ -47,15 +45,11 @@ public class DocumentNodePointable extends AbstractPointable { } }; - public int getLocalNodeId(NodeTreePointable nodeTree) { - return nodeTree.nodeIdExists() ? IntegerPointable.getInteger(bytes, getLocalNodeIdOffset()) : -1; - } - public void getContent(NodeTreePointable nodeTree, SequencePointable content) { content.set(bytes, getContentOffset(nodeTree), getContentSize(nodeTree)); } - private int getLocalNodeIdOffset() { + protected int getLocalNodeIdOffset(NodeTreePointable nodeTree) { return start; } @@ -64,10 +58,11 @@ public class DocumentNodePointable extends AbstractPointable { } private int getContentOffset(NodeTreePointable nodeTree) { - return getLocalNodeIdOffset() + getLocalNodeIdSize(nodeTree); + return getLocalNodeIdOffset(nodeTree) + getLocalNodeIdSize(nodeTree); } private int getContentSize(NodeTreePointable nodeTree) { return length - (getContentOffset(nodeTree) - start); } + } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/vxquery/blob/85ed19f1/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/ElementNodePointable.java ---------------------------------------------------------------------- diff --git a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/ElementNodePointable.java b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/ElementNodePointable.java index f2ba29e..faadd33 100644 --- a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/ElementNodePointable.java +++ b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/ElementNodePointable.java @@ -20,7 +20,6 @@ import org.apache.vxquery.datamodel.accessors.SequencePointable; import org.apache.vxquery.datamodel.accessors.atomic.CodedQNamePointable; import edu.uci.ics.hyracks.api.dataflow.value.ITypeTraits; -import edu.uci.ics.hyracks.data.std.api.AbstractPointable; import edu.uci.ics.hyracks.data.std.api.IPointable; import edu.uci.ics.hyracks.data.std.api.IPointableFactory; import edu.uci.ics.hyracks.data.std.primitive.BytePointable; @@ -57,7 +56,7 @@ import edu.uci.ics.hyracks.data.std.primitive.VoidPointable; * NamePtr[2][chunkSizeInBytes / (sizeof(NamePtr) * 2)] namespaces; * } */ -public class ElementNodePointable extends AbstractPointable { +public class ElementNodePointable extends AbstractNodePointable { public static final byte NS_CHUNK_EXISTS_MASK = (0x1 << 0); public static final byte ATTRIBUTES_CHUNK_EXISTS_MASK = (0x1 << 1); public static final byte CHILDREN_CHUNK_EXISTS_MASK = (0x1 << 2); @@ -170,7 +169,7 @@ public class ElementNodePointable extends AbstractPointable { return nodeTree.typeExists() ? CodedQNamePointable.SIZE : 0; } - private int getLocalNodeIdOffset(NodeTreePointable nodeTree) { + protected int getLocalNodeIdOffset(NodeTreePointable nodeTree) { return getTypeOffset() + getTypeSize(nodeTree); } http://git-wip-us.apache.org/repos/asf/vxquery/blob/85ed19f1/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/PINodePointable.java ---------------------------------------------------------------------- diff --git a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/PINodePointable.java b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/PINodePointable.java index b293841..2318ba6 100644 --- a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/PINodePointable.java +++ b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/PINodePointable.java @@ -17,10 +17,8 @@ package org.apache.vxquery.datamodel.accessors.nodes; import edu.uci.ics.hyracks.api.dataflow.value.ITypeTraits; -import edu.uci.ics.hyracks.data.std.api.AbstractPointable; import edu.uci.ics.hyracks.data.std.api.IPointable; import edu.uci.ics.hyracks.data.std.api.IPointableFactory; -import edu.uci.ics.hyracks.data.std.primitive.IntegerPointable; import edu.uci.ics.hyracks.data.std.primitive.UTF8StringPointable; import edu.uci.ics.hyracks.data.std.primitive.VoidPointable; @@ -31,7 +29,7 @@ import edu.uci.ics.hyracks.data.std.primitive.VoidPointable; * String content; * } */ -public class PINodePointable extends AbstractPointable { +public class PINodePointable extends AbstractNodePointable { private static final int LOCAL_NODE_ID_SIZE = 4; public static final IPointableFactory FACTORY = new IPointableFactory() { private static final long serialVersionUID = 1L; @@ -47,10 +45,6 @@ public class PINodePointable extends AbstractPointable { } }; - public int getLocalNodeId(NodeTreePointable nodeTree) { - return nodeTree.nodeIdExists() ? IntegerPointable.getInteger(bytes, getLocalNodeIdOffset()) : -1; - } - public void getTarget(NodeTreePointable nodeTree, IPointable target) { target.set(bytes, getTargetOffset(nodeTree), getTargetSize(nodeTree)); } @@ -59,7 +53,7 @@ public class PINodePointable extends AbstractPointable { content.set(bytes, getContentOffset(nodeTree), getContentSize(nodeTree)); } - private int getLocalNodeIdOffset() { + protected int getLocalNodeIdOffset(NodeTreePointable nodeTree) { return start; } @@ -68,7 +62,7 @@ public class PINodePointable extends AbstractPointable { } private int getTargetOffset(NodeTreePointable nodeTree) { - return getLocalNodeIdOffset() + getLocalNodeIdSize(nodeTree); + return getLocalNodeIdOffset(nodeTree) + getLocalNodeIdSize(nodeTree); } private int getTargetSize(NodeTreePointable nodeTree) { http://git-wip-us.apache.org/repos/asf/vxquery/blob/85ed19f1/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/TextOrCommentNodePointable.java ---------------------------------------------------------------------- diff --git a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/TextOrCommentNodePointable.java b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/TextOrCommentNodePointable.java index e4a9bed..2ab2555 100644 --- a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/TextOrCommentNodePointable.java +++ b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/TextOrCommentNodePointable.java @@ -17,10 +17,8 @@ package org.apache.vxquery.datamodel.accessors.nodes; import edu.uci.ics.hyracks.api.dataflow.value.ITypeTraits; -import edu.uci.ics.hyracks.data.std.api.AbstractPointable; import edu.uci.ics.hyracks.data.std.api.IPointable; import edu.uci.ics.hyracks.data.std.api.IPointableFactory; -import edu.uci.ics.hyracks.data.std.primitive.IntegerPointable; import edu.uci.ics.hyracks.data.std.primitive.VoidPointable; /* @@ -29,7 +27,7 @@ import edu.uci.ics.hyracks.data.std.primitive.VoidPointable; * UTF8String value; * } */ -public class TextOrCommentNodePointable extends AbstractPointable { +public class TextOrCommentNodePointable extends AbstractNodePointable { private static final int LOCAL_NODE_ID_SIZE = 4; public static final IPointableFactory FACTORY = new IPointableFactory() { private static final long serialVersionUID = 1L; @@ -45,15 +43,11 @@ public class TextOrCommentNodePointable extends AbstractPointable { } }; - public int getLocalNodeId(NodeTreePointable nodeTree) { - return nodeTree.nodeIdExists() ? IntegerPointable.getInteger(bytes, getLocalNodeIdOffset()) : -1; - } - public void getValue(NodeTreePointable nodeTree, IPointable value) { value.set(bytes, getValueOffset(nodeTree), getValueSize(nodeTree)); } - private int getLocalNodeIdOffset() { + protected int getLocalNodeIdOffset(NodeTreePointable nodeTree) { return start; } @@ -62,10 +56,11 @@ public class TextOrCommentNodePointable extends AbstractPointable { } private int getValueOffset(NodeTreePointable nodeTree) { - return getLocalNodeIdOffset() + getLocalNodeIdSize(nodeTree); + return getLocalNodeIdOffset(nodeTree) + getLocalNodeIdSize(nodeTree); } private int getValueSize(NodeTreePointable nodeTree) { return length - (getValueOffset(nodeTree) - start); } + } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/vxquery/blob/85ed19f1/vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-operators.xml ---------------------------------------------------------------------- diff --git a/vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-operators.xml b/vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-operators.xml index 5892c48..c0f5968 100644 --- a/vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-operators.xml +++ b/vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-operators.xml @@ -263,10 +263,10 @@ <!-- op:is-same-node($parameter1 as node(), $parameter2 as node()) as xs:boolean --> <operator name="op:is-same-node"> - <param name="parameter1" type="node()?"/> - <param name="parameter2" type="node()?"/> + <param name="parameter1" type="node()"/> + <param name="parameter2" type="node()"/> <return type="xs:boolean"/> - </operator> + </operator> <!-- op:multiply-dayTimeDuration( $arg1 as xs:dayTimeDuration, $arg2 as xs:double) as xs:dayTimeDuration --> <operator name="op:multiply-dayTimeDuration"> @@ -284,17 +284,19 @@ <!-- op:node-after($parameter1 as node(), $parameter2 as node()) as xs:boolean --> <operator name="op:node-after"> - <param name="parameter1" type="node()?"/> - <param name="parameter2" type="node()?"/> + <param name="parameter1" type="node()"/> + <param name="parameter2" type="node()"/> + <runtime type="scalar" class="org.apache.vxquery.runtime.functions.node.OpNodeAfterEvaluatorFactory"/> <return type="xs:boolean"/> </operator> <!-- op:node-before($parameter1 as node(), $parameter2 as node()) as xs:boolean --> <operator name="op:node-before"> - <param name="parameter1" type="node()?"/> - <param name="parameter2" type="node()?"/> + <param name="parameter1" type="node()"/> + <param name="parameter2" type="node()"/> <return type="xs:boolean"/> - </operator> + <runtime type="scalar" class="org.apache.vxquery.runtime.functions.node.OpNodeBeforeEvaluatorFactory"/> + </operator> <!-- op:NOTATION-equal($arg1 as xs:NOTATION, $arg2 as xs:NOTATION) as xs:boolean --> <operator name="op:NOTATION-equal"> http://git-wip-us.apache.org/repos/asf/vxquery/blob/85ed19f1/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/AbstractNodePositionalCheckEvaluator.java ---------------------------------------------------------------------- diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/AbstractNodePositionalCheckEvaluator.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/AbstractNodePositionalCheckEvaluator.java new file mode 100644 index 0000000..56cb3fa --- /dev/null +++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/AbstractNodePositionalCheckEvaluator.java @@ -0,0 +1,50 @@ +package org.apache.vxquery.runtime.functions.node; + +import org.apache.vxquery.datamodel.accessors.TaggedValuePointable; +import org.apache.vxquery.datamodel.accessors.TypedPointables; +import org.apache.vxquery.datamodel.accessors.nodes.NodeTreePointable; +import org.apache.vxquery.datamodel.values.ValueTag; +import org.apache.vxquery.datamodel.values.XDMConstants; +import org.apache.vxquery.exceptions.ErrorCode; +import org.apache.vxquery.exceptions.SystemException; +import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluator; +import org.apache.vxquery.runtime.functions.util.FunctionHelper; + +import edu.uci.ics.hyracks.algebricks.runtime.base.IScalarEvaluator; +import edu.uci.ics.hyracks.data.std.api.IPointable; + +public abstract class AbstractNodePositionalCheckEvaluator extends AbstractTaggedValueArgumentScalarEvaluator { + + public AbstractNodePositionalCheckEvaluator(IScalarEvaluator[] args) { + super(args); + } + + private final NodeTreePointable ntp1 = (NodeTreePointable) NodeTreePointable.FACTORY.createPointable(); + private final NodeTreePointable ntp2 = (NodeTreePointable) NodeTreePointable.FACTORY.createPointable(); + private final TypedPointables tp = new TypedPointables(); + + @Override + protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException { + + parameterTypeCheck(args[0], ntp1); + parameterTypeCheck(args[1], ntp2); + + if (nodeCompare(FunctionHelper.getLocalNodeId(args[0], tp), FunctionHelper.getLocalNodeId(args[1], tp))) { + XDMConstants.setTrue(result); + } else { + XDMConstants.setFalse(result); + } + } + + //node passed in from argument + protected void parameterTypeCheck(TaggedValuePointable node, NodeTreePointable ntp) throws SystemException { + if (node.getTag() == ValueTag.NODE_TREE_TAG) { + node.getValue(ntp); + return; + } + throw new SystemException(ErrorCode.FORG0006); + } + + abstract protected boolean nodeCompare(int firstId, int secondId); + +} http://git-wip-us.apache.org/repos/asf/vxquery/blob/85ed19f1/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/OpNodeAfterEvaluator.java ---------------------------------------------------------------------- diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/OpNodeAfterEvaluator.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/OpNodeAfterEvaluator.java new file mode 100644 index 0000000..acc2714 --- /dev/null +++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/OpNodeAfterEvaluator.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.vxquery.runtime.functions.node; + +import edu.uci.ics.hyracks.algebricks.runtime.base.IScalarEvaluator; + +public class OpNodeAfterEvaluator extends AbstractNodePositionalCheckEvaluator { + + public OpNodeAfterEvaluator(IScalarEvaluator[] args) { + super(args); + } + + @Override + protected boolean nodeCompare(int firstId, int secondId) { + return (firstId > secondId); + } + +} http://git-wip-us.apache.org/repos/asf/vxquery/blob/85ed19f1/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/OpNodeAfterEvaluatorFactory.java ---------------------------------------------------------------------- diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/OpNodeAfterEvaluatorFactory.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/OpNodeAfterEvaluatorFactory.java new file mode 100644 index 0000000..71ada1c --- /dev/null +++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/OpNodeAfterEvaluatorFactory.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.vxquery.runtime.functions.node; + +import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluatorFactory; + +import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException; +import edu.uci.ics.hyracks.algebricks.runtime.base.IScalarEvaluator; +import edu.uci.ics.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory; +import edu.uci.ics.hyracks.api.context.IHyracksTaskContext; + +public class OpNodeAfterEvaluatorFactory extends AbstractTaggedValueArgumentScalarEvaluatorFactory { + + public OpNodeAfterEvaluatorFactory(IScalarEvaluatorFactory[] args) { + super(args); + } + + private static final long serialVersionUID = 1L; + + @Override + protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args) + throws AlgebricksException { + return new OpNodeAfterEvaluator(args); + } + +} http://git-wip-us.apache.org/repos/asf/vxquery/blob/85ed19f1/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/OpNodeBeforeEvaluator.java ---------------------------------------------------------------------- diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/OpNodeBeforeEvaluator.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/OpNodeBeforeEvaluator.java new file mode 100644 index 0000000..ce9e496 --- /dev/null +++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/OpNodeBeforeEvaluator.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.vxquery.runtime.functions.node; + +import edu.uci.ics.hyracks.algebricks.runtime.base.IScalarEvaluator; + +public class OpNodeBeforeEvaluator extends AbstractNodePositionalCheckEvaluator { + + public OpNodeBeforeEvaluator(IScalarEvaluator[] args) { + super(args); + } + + @Override + protected boolean nodeCompare(int firstId, int secondId) { + return (firstId < secondId); + } + +} http://git-wip-us.apache.org/repos/asf/vxquery/blob/85ed19f1/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/OpNodeBeforeEvaluatorFactory.java ---------------------------------------------------------------------- diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/OpNodeBeforeEvaluatorFactory.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/OpNodeBeforeEvaluatorFactory.java new file mode 100644 index 0000000..5791cb4 --- /dev/null +++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/OpNodeBeforeEvaluatorFactory.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.vxquery.runtime.functions.node; + +import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluatorFactory; + +import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException; +import edu.uci.ics.hyracks.algebricks.runtime.base.IScalarEvaluator; +import edu.uci.ics.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory; +import edu.uci.ics.hyracks.api.context.IHyracksTaskContext; + +public class OpNodeBeforeEvaluatorFactory extends AbstractTaggedValueArgumentScalarEvaluatorFactory { + + private static final long serialVersionUID = 1L; + + public OpNodeBeforeEvaluatorFactory(IScalarEvaluatorFactory[] args) { + super(args); + } + + @Override + protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args) + throws AlgebricksException { + return new OpNodeBeforeEvaluator(args); + } + +}
