You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vxquery.apache.org by vi...@apache.org on 2012/05/30 05:56:08 UTC
svn commit: r1344089 - in
/incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery/datamodel:
NodeTreePointable.java PINodePointable.java
Author: vinayakb
Date: Wed May 30 03:56:07 2012
New Revision: 1344089
URL: http://svn.apache.org/viewvc?rev=1344089&view=rev
Log:
Fixed accessors
Modified:
incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery/datamodel/NodeTreePointable.java
incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery/datamodel/PINodePointable.java
Modified: incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery/datamodel/NodeTreePointable.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery/datamodel/NodeTreePointable.java?rev=1344089&r1=1344088&r2=1344089&view=diff
==============================================================================
--- incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery/datamodel/NodeTreePointable.java (original)
+++ incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery/datamodel/NodeTreePointable.java Wed May 30 03:56:07 2012
@@ -48,7 +48,7 @@ public class NodeTreePointable extends A
int dataAreaStart = getDictionaryDataAreaStartOffset();
int idxSlotValue = IntegerPointable.getInteger(bytes, getDictionaryIndexPointerArrayOffset() + idx
* IDX_PTR_SLOT_SIZE);
- int strLen = UTF8StringPointable.getStrLen(bytes, dataAreaStart + idxSlotValue);
+ int strLen = UTF8StringPointable.getUTFLen(bytes, dataAreaStart + idxSlotValue);
string.set(bytes, dataAreaStart + idxSlotValue, strLen + 2);
}
@@ -62,7 +62,7 @@ public class NodeTreePointable extends A
int mid = (left + right) / 2;
int sortedSlotValue = IntegerPointable.getInteger(bytes, sortedPtrArrayStart + mid * SORTED_PTR_SLOT_SIZE);
int strStart = dataAreaStart + sortedSlotValue;
- int strLen = UTF8StringPointable.getStrLen(bytes, strStart);
+ int strLen = UTF8StringPointable.getUTFLen(bytes, strStart);
int cmp = key.compareTo(bytes, strStart, strLen + 2);
if (cmp > 0) {
left = mid + 1;
Modified: incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery/datamodel/PINodePointable.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery/datamodel/PINodePointable.java?rev=1344089&r1=1344088&r2=1344089&view=diff
==============================================================================
--- incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery/datamodel/PINodePointable.java (original)
+++ incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery/datamodel/PINodePointable.java Wed May 30 03:56:07 2012
@@ -2,28 +2,28 @@ package org.apache.vxquery.datamodel;
import edu.uci.ics.hyracks.data.std.api.AbstractPointable;
import edu.uci.ics.hyracks.data.std.primitive.IntegerPointable;
+import edu.uci.ics.hyracks.data.std.primitive.UTF8StringPointable;
/*
* PI {
* NodeId nodeId?;
- * StringPtr target
- * StringPtr content;
+ * String target
+ * String content;
* }
*/
public class PINodePointable extends AbstractPointable {
private static final int LOCAL_NODE_ID_SIZE = 4;
- private static final int TARGET_SIZE = 4;
public int getLocalNodeId(NodeTreePointable nodeTree) {
return nodeTree.nodeIdExists() ? IntegerPointable.getInteger(bytes, getLocalNodeIdOffset()) : -1;
}
- public int getTargetCode(NodeTreePointable nodeTree) {
- return IntegerPointable.getInteger(bytes, getTargetOffset(nodeTree));
+ public void getTarget(NodeTreePointable nodeTree, UTF8StringPointable target) {
+ target.set(bytes, getTargetOffset(nodeTree), getTargetSize(nodeTree));
}
- public int getContentCode(NodeTreePointable nodeTree) {
- return IntegerPointable.getInteger(bytes, getContentOffset(nodeTree));
+ public void getContentCode(NodeTreePointable nodeTree, UTF8StringPointable content) {
+ content.set(bytes, getContentOffset(nodeTree), getContentSize(nodeTree));
}
private int getLocalNodeIdOffset() {
@@ -38,11 +38,15 @@ public class PINodePointable extends Abs
return getLocalNodeIdOffset() + getLocalNodeIdSize(nodeTree);
}
- private int getTargetSize() {
- return TARGET_SIZE;
+ private int getTargetSize(NodeTreePointable nodeTree) {
+ return UTF8StringPointable.getUTFLen(bytes, getTargetOffset(nodeTree)) + 2;
}
private int getContentOffset(NodeTreePointable nodeTree) {
- return getTargetOffset(nodeTree) + getTargetSize();
+ return getTargetOffset(nodeTree) + getTargetSize(nodeTree);
+ }
+
+ private int getContentSize(NodeTreePointable nodeTree) {
+ return UTF8StringPointable.getUTFLen(bytes, getContentOffset(nodeTree)) + 2;
}
}
\ No newline at end of file