/** * Test whether the input i is unique; * if not, insert into the hash table and return false * otherwise, return true */ public boolean isUnique(int i){ int temp = i & mask1; if (temp>maxDepth){ maxDepth = temp; } if (storage[temp]==null) { storage[temp]= new FastIntBuffer(pageSizeE); storage[temp].append(i); return true; } else{ int size = storage[temp].size; for (int j=0;j<size;j++){ if (i == storage[temp].intAt(j)){ return false; } } storage[temp].append(i); return true; } }
/** * Select the name space nodes as defined in XPath * @param en */ protected void selectNameSpace(String en){ if (en == null) throw new IllegalArgumentException("namespace name can't be null"); iter_type = NAME_SPACE; ft = true; size = vn.getTokenCount(); name = en; if (!en.equals("*")) name2="xmlns:"+en; if (fib==null) fib = new FastIntBuffer(4); else fib.clear(); }
void quickSort_ascending (int lo, int hi) { // lo is the lower index, hi is the upper index // of the region of array a that is to be sorted //System.out.println("lo ==>"+lo); //System.out.println("hi ==>"+hi); int i=lo, j=hi; int h; //Object o; int x=this.intAt((lo+hi)/2); // partition do { while (intAt(i)<x) i++; while (intAt(j)>x) j--; if (i<=j) { h=this.intAt(i); modifyEntry(i,this.intAt(j)); modifyEntry(j,h); i++; j--; } } while (i<=j); // recursion if (lo<j) quickSort_ascending(lo, j); if (i<hi) quickSort_ascending(i, hi); }
/** * getSize gets the fragment with ns compensation * @return * */ public final int getSize(){ //int encoding = vn.encoding; int len = (int) (l >> 32); if (stLen != 0) for (int i = 0; i < fib.size(); i++) { int k = fib.intAt(i); len += (vn.getTokenLength(k) & 0xffff) + vn.getTokenLength(k + 1) + 4; } return len; }
throw new NavException("getElementFragmentNS can only be called when parsing is ns enabled"); FastIntBuffer fib = new FastIntBuffer(3); // init size 8 if (type==VTDNav.TOKEN_ATTR_NAME || type==VTDNav.TOKEN_ATTR_NS) if (type == VTDNav.TOKEN_ATTR_NS){ fib.append(k); if (matchTokens(fib.intAt(z), this, k)) { unique = false; break; fib.append(k); fib.modifyEntry(i,fib.intAt(i+count)); fib.resize(newSz);
try { if (fib1 == null) fib1 = new FastIntBuffer(BUF_SZ_EXP); vn.push2(); stackSize = vn.contextStack2.size; i1 = getStringVal(vn,i); if (i1 != -1) fib1.append(i1); s1 = fib1.size; for (int k = 0; k < s1; k++) { boolean b = compareVV(fib1.intAt(k),vn,i1,op); if (b){ fib1.clear(); vn.contextStack2.size = stackSize; vn.pop2(); vn.pop2(); right.reset(vn); fib1.clear(); return false; } catch (Exception e) { fib1.clear(); throw new RuntimeException("Undefined behavior");
ia[k]= k; FastIntBuffer fib = new FastIntBuffer(13); fib.append(ia); fib.clear(); fib.append(ia); int ib[] = fib.toIntArray();
void quickSort_descending (int lo, int hi) { // lo is the lower index, hi is the upper index // of the region of array a that is to be sorted //System.out.println("lo ==>"+lo); //System.out.println("hi ==>"+hi); int i=lo, j=hi; int h; //Object o; int x=this.intAt((lo+hi)/2); // partition do { while (intAt(i)>x) i++; while (intAt(j)<x) j--; if (i<=j) { h=this.intAt(i); modifyEntry(i,this.intAt(j)); modifyEntry(j,h); i++; j--; } } while (i<=j); // recursion if (lo<j) quickSort_descending(lo, j); if (i<hi) quickSort_descending(i, hi); } }
/** * Sort the integers in the buffer * @param order (as of version 2.9) * it can be either ASCENDING or DESCENDING */ public void sort(int order) { switch (order) { case ASCENDING: if (size > 0) quickSort_ascending(0, size - 1); break; case DESCENDING: if (size > 0) quickSort_descending(0, size - 1); break; default: throw new IllegalArgumentException("Sort type undefined"); } }
public void sampleState(FastIntBuffer fib){ // for(int i=0;i<context.) // context[i] = -1; for (int i=0;i<=context[0];i++) fib.append(context[i]); if (atTerminal) fib.append(LN); if (context[0]>=1) fib.append(l1index); if (context[0]>=2){ fib.append(l2index); fib.append(l2lower); fib.append(l2upper); } // else return; if (context[0]>=3){ fib.append(l3index); fib.append(l3lower); fib.append(l3upper); } //else return; }
/** * The parameter-less constructor * */ public NodeRecorder() { vn = null; size = position = count=0; fib = new FastIntBuffer(BUF_SZ_EXPO); }
/** * This function differs from isUnique(int i) in that it doesn't insert i into * intHash if it is unique, use to implement intersection or difference of nodesets * @param i * @return */ public boolean _isUnique(int i){ int temp = i & mask1; if (temp>maxDepth){ maxDepth = temp; } if (storage[temp]==null) { //storage[temp]= new FastIntBuffer(pageSizeE); //storage[temp].append(i); return true; } else{ int size = storage[temp].size; for (int j=0;j<size;j++){ if (i == storage[temp].intAt(j)){ return false; } } //storage[temp].append(i); return true; } }
/** * Clear will erase all the nodes, internal buffers are reused * */ public void clear() { size = position = count = 0; fib.clear(); }
length = getTokenLength(index); t += length; fib.append(index); if (length > VTDGen.MAX_TOKEN_LENGTH){ while(length > VTDGen.MAX_TOKEN_LENGTH){ case 0:toString(sb,fib.intAt(t)); break; case 1:toStringUpperCase(sb, fib.intAt(t)); break; case 2:toStringLowerCase(sb, fib.intAt(t)); break; fib.clear(); return sb.toString();
/** * getSize gets the fragment with ns compensation * @return * */ public final int getSize(){ //int encoding = vn.encoding; int len = (int) (l >> 32); if (stLen != 0) for (int i = 0; i < fib.size(); i++) { int k = fib.intAt(i); len += (vn.getTokenLength(k) & 0xffff) + vn.getTokenLength(k + 1) + 4; } return len; }
throw new NavException("getElementFragmentNS can only be called when parsing is ns enabled"); FastIntBuffer fib = new FastIntBuffer(3); // init size 8 if (type==VTDNav.TOKEN_ATTR_NAME || type==VTDNav.TOKEN_ATTR_NS){ if (type == VTDNav.TOKEN_ATTR_NS){ fib.append(k); if (matchTokens(fib.intAt(z), this, k)) { unique = false; break; fib.append(k); fib.modifyEntry(i,fib.intAt(i+count)); fib.resize(newSz);
try { if (fib1 == null) fib1 = new FastIntBuffer(BUF_SZ_EXP); vn.push2(); stackSize = vn.contextStack2.size; i1 = getStringVal(vn,i); if (i1 != -1) fib1.append(i1); s1 = fib1.size; for (int k = 0; k < s1; k++) { boolean b = compareVV(fib1.intAt(k),vn,i1,op); if (b){ fib1.clear(); vn.contextStack2.size = stackSize; vn.pop2(); vn.pop2(); right.reset(vn); fib1.clear(); return false; } catch (Exception e) { fib1.clear(); throw new RuntimeException("Undefined behavior");
ia[k]= k; FastIntBuffer fib = new FastIntBuffer(13); fib.append(ia); fib.clear(); fib.append(ia); int ib[] = fib.toIntArray();