private void _writeVTD(int offset, int length, int token_type, int depth) { VTDBuffer.append(((long) ((token_type << 28) | ((depth & 0xff) << 20) | length) << 32) | offset); }
int size = flb.size; for (int i=0;i<size;){ os1 = flb.lower32At(i); os2 = flb.lower32At(i)+ (flb.upper32At(i)& 0x1fffffff)-1; temp = flb.lower32At(i+z); if (temp==os1){ if ((flb.upper32At(i+z)& 0x1fffffff)!=0) // not an insert os2=flb.lower32At(i+z)+ (flb.upper32At(i+z)& 0x1fffffff)-1; z++; int k= flb.lower32At(i+z)+ (flb.upper32At(i+z)& 0x1fffffff)-1; if (k>os2) +os1 + " and offset "+os2); else flb.modifyEntry(i+z,(flb.longAt(i+z)& 0x1fffffffffffffffL)|MASK_NULL);
private final void recoverNode_l4(int index){ int i = l3Buffer.lower32At(l3index); i = l3Buffer.lower32At(k); if (i != 0xffffffff) { l4upper = i - 1; int t1=l4Buffer.upper32At(l4lower); int t2=l4Buffer.upper32At(l4upper); while(i<l4Buffer.size-1 && l4Buffer.upper32At(i)<index){ i++; while (l4Buffer.upper32At(i)>index && i>0) i--; context[4] = l4Buffer.upper32At(i); l4index = i;
la[k]= k; FastLongBuffer flb = new FastLongBuffer(14); flb.append(la); flb.clear(); flb.append(la); long lb[] = flb.toLongArray(); for (int i = 0;i<1000000;i++){ if (lb[i]!=i){
if (docOffset == 0) for (i = 0; i < vtdBuffer.size; i++) { dos.writeLong(vtdBuffer.longAt(i)); dos.writeLong(adjust(vtdBuffer.longAt(i), -docOffset)); dos.writeLong(l1Buffer.longAt(i)); for(i=0;i< l2Buffer.size();i++){ dos.writeLong(l2Buffer.longAt(i)); dos.writeLong(l3Buffer.longAt(i)); dos.writeLong(l4Buffer.longAt(i));
long h; Object o; int x=flb.lower32At((lo+hi)/2); while (flb.lower32At(i)<x) i++; while (flb.lower32At(j)>x) j--; if (i<=j) h=flb.longAt(i); o = fob.objectAt(i); flb.modifyEntry(i,flb.longAt(j)); fob.modifyEntry(i,fob.objectAt(j)); flb.modifyEntry(j,h); fob.modifyEntry(j,o); i++;
final protected int getTokenLength2(int index){ return (int) ((vtdBuffer.longAt(index) & MASK_TOKEN_FULL_LEN) >> 32); } /**
/** * VTDGen constructor method. */ public VTDGen() { attr_name_array = new long[ATTR_NAME_ARRAY_SIZE]; prefixed_attr_name_array = new long[ATTR_NAME_ARRAY_SIZE]; prefix_URL_array = new int[ATTR_NAME_ARRAY_SIZE]; tag_stack = new long[TAG_STACK_SIZE]; //scratch_buffer = new int[10]; VTDDepth = 0; LcDepth = 5; br = false; e = new EOFException("permature EOF reached, XML document incomplete"); ws = false; nsBuffer1 = new FastIntBuffer(4); nsBuffer2 = new FastLongBuffer(4); nsBuffer3 = new FastLongBuffer(4); currentElementRecord = 0; singleByteEncoding = true; shallowDepth =false; helper=false; default_ns = false; //true xmlns='abc' isXML = false; //offset_adj = 1; } /**
l = vtdBuffer.longAt(s); hasNS = false; vtdBuffer.modifyEntry( s, l | 0x00000000c0000000L); l = vtdBuffer.longAt(s); vtdBuffer.modifyEntry( s, l | 0x00000000c0000000L); type = getTokenType(k); l = vtdBuffer.longAt(s); if (hasNS) { hasNS = false; vtdBuffer.modifyEntry(s, l | 0x00000000c0000000L); } else { vtdBuffer.modifyEntry(s, l | 0x0000000080000000L);
private final void recoverNode_l5(int index){ //l3 int i = l4Buffer.lower32At(l4index); if (l5lower != i) { //l3lower and l3upper are always together l5lower = i; // l3lower shouldn't be -1 //l3index = l3lower; l5upper = l5Buffer.size - 1; for (int k = l4index + 1; k < l4Buffer.size; k++) { i = l4Buffer.lower32At(k); if (i != 0xffffffff) { l5upper = i - 1; break; } } } int t1=l5Buffer.intAt(l5lower); int t2=l5Buffer.intAt(l5upper); i= Math.min(l5lower+ (int)(((float)(index-t1)/(t2-t1+1))*(l5upper-l5lower)),l5upper) ; while(i<l5Buffer.size-1 && l5Buffer.intAt(i)<index){ i++; } while (l5Buffer.intAt(i)>index && i>0) i--; //System.out.println(" i ===> "+i); context[5] = l5Buffer.intAt(i); l5index = i; }
protected final void recoverNode_l2(int index){ int i = l1Buffer.lower32At(l1index); i = l1Buffer.lower32At(k); if (i != 0xffffffff) { l2upper = i - 1; int t1=l2Buffer.upper32At(l2lower); int t2=l2Buffer.upper32At(l2upper); while(i<l2Buffer.size-1 && l2Buffer.upper32At(i)<index){ i++; while (l2Buffer.upper32At(i)>index && i>0) i--; context[2] = l2Buffer.upper32At(i); l2index = i;
la[k]= k; FastLongBuffer flb = new FastLongBuffer(14); flb.append(la); flb.clear(); flb.append(la); long lb[] = flb.toLongArray(); for (int i = 0;i<1000000;i++){ if (lb[i]!=i){
throw new IndexWriteException("Invalid VTD index "); if (vtdBuffer.size()==0) throw new IndexWriteException("VTDBuffer can't be zero length"); if (docOffset == 0) for (i = 0; i < vtdBuffer.size; i++) { dos.writeLong(vtdBuffer.longAt(i)); dos.writeLong(adjust(vtdBuffer.longAt(i), -docOffset)); dos.writeLong(l1Buffer.longAt(i)); dos.writeLong(l2Buffer.longAt(i));
long h; Object o; int x=flb.lower32At((lo+hi)/2); while (flb.lower32At(i)<x) i++; while (flb.lower32At(j)>x) j--; if (i<=j) h=flb.longAt(i); o = fob.objectAt(i); flb.modifyEntry(i,flb.longAt(j)); fob.modifyEntry(i,fob.objectAt(j)); flb.modifyEntry(j,h); fob.modifyEntry(j,o); i++;
/** * Test the token type, to see if it is a starting tag. * * @return boolean * @param index * int */ protected final boolean isElement(int index) { return (((vtdBuffer.longAt(index) & MASK_TOKEN_TYPE) >> 60) & 0xf) == TOKEN_STARTING_TAG; }
/** * VTDGen constructor method. */ public VTDGen() { attr_name_array = new long[ATTR_NAME_ARRAY_SIZE]; prefixed_attr_name_array = new long[ATTR_NAME_ARRAY_SIZE]; prefix_URL_array = new int[ATTR_NAME_ARRAY_SIZE]; tag_stack = new long[TAG_STACK_SIZE]; //scratch_buffer = new int[10]; VTDDepth = 0; LcDepth = 3; br = false; e = new EOFException("permature EOF reached, XML document incomplete"); ws = false; nsBuffer1 = new FastIntBuffer(4); nsBuffer2 = new FastLongBuffer(4); nsBuffer3 = new FastLongBuffer(4); currentElementRecord = 0; singleByteEncoding = true; shallowDepth =true; helper=false; default_ns = false; //true xmlns='abc' isXML = false; //offset_adj = 1; } /**
l = vtdBuffer.longAt(s); hasNS = false; vtdBuffer.modifyEntry( s, l | 0x00000000c0000000L); l = vtdBuffer.longAt(s); vtdBuffer.modifyEntry( s, l | 0x00000000c0000000L); type = getTokenType(k); l = vtdBuffer.longAt(s); if (hasNS) { hasNS = false; vtdBuffer.modifyEntry(s, l | 0x00000000c0000000L); } else { vtdBuffer.modifyEntry(s, l | 0x0000000080000000L);
private final void recoverNode_l3(int index){ int i = l2Buffer.lower32At(l2index); if (l3lower != i) { //l3lower and l3upper are always together l3lower = i; // l3lower shouldn't be -1 //l3index = l3lower; l3upper = l3Buffer.size - 1; for (int k = l2index + 1; k < l2Buffer.size; k++) { i = l2Buffer.lower32At(k); if (i != 0xffffffff) { l3upper = i - 1; break; } } } int t1=l3Buffer.intAt(l3lower); int t2=l3Buffer.intAt(l3upper); i= Math.min(l3lower+ (int)(((float)(index-t1)/(t2-t1+1))*(l3upper-l3lower)),l3upper) ; while(i<l3Buffer.size-1 && l3Buffer.intAt(i)<index){ i++; } while (l3Buffer.intAt(i)>index && i>0) i--; //System.out.println(" i ===> "+i); context[3] = l3Buffer.intAt(i); l3index = i; }