/** * 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; } }
/** * 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; } }
public void showContent(){ for(int i=0;i<fib.size;i++){ System.out.println(" "+fib.intAt(i)); } System.out.println("count ==> "+count); } /**
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; }
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; }
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; }
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; }
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); }
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); }
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); } }
protected boolean checkNsUniqueness(int i) throws NavException { for (int j = 0; j < fib.size(); j++) { if (vn.compareTokens(fib.intAt(j), vn, i) == 0) return false; } fib.append(i); return true; }
protected boolean checkNsUniqueness(int i) throws NavException{ for (int j=0;j<fib.size();j++){ if (vn.compareTokens(fib.intAt(j), vn, i)==0) return false; } fib.append(i); return true; } /**
protected boolean checkNsUniqueness(int i) throws NavException{ for (int j=0;j<fib.size();j++){ if (vn.compareTokens(fib.intAt(j), vn, i)==0) return false; } fib.append(i); return true; } /**
/** * 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; }
/** * 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; }
/** * 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; } }
/** * 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; } }
/** * getSize gets the byte length of ns compensated fragment in its source * encoding format * @return the byte length of ns compensated fragment in its source encoding format * */ 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); if (vn.encoding < VTDNav.FORMAT_UTF_16BE ){ len += (vn.getTokenLength(k) & 0xffff) + vn.getTokenLength(k + 1) + 4; }else{ len += ((vn.getTokenLength(k) & 0xffff) + vn.getTokenLength(k + 1) + 4)<<1; } } return len; }
/** * getSize gets the byte length of ns compensated fragment in its source * encoding format * @return the byte length of ns compensated fragment in its source encoding format * */ 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); if (vn.encoding < VTDNav.FORMAT_UTF_16BE ){ len += (vn.getTokenLength(k) & 0xffff) + vn.getTokenLength(k + 1) + 4; }else{ len += ((vn.getTokenLength(k) & 0xffff) + vn.getTokenLength(k + 1) + 4)<<1; } } return len; }
/** * getSize gets the byte length of ns compensated fragment in its source * encoding format * @return the byte length of ns compensated fragment in its source encoding format * */ 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); if (vn.encoding < VTDNav.FORMAT_UTF_16BE ){ len += (vn.getTokenLength(k) & 0xffff) + vn.getTokenLength(k + 1) + 4; }else{ len += ((vn.getTokenLength(k) & 0xffff) + vn.getTokenLength(k + 1) + 4)<<1; } } return len; }