當前位置: 首頁>>代碼示例>>Java>>正文


Java QuickBitVector.getLongFromTo方法代碼示例

本文整理匯總了Java中cern.colt.bitvector.QuickBitVector.getLongFromTo方法的典型用法代碼示例。如果您正苦於以下問題:Java QuickBitVector.getLongFromTo方法的具體用法?Java QuickBitVector.getLongFromTo怎麽用?Java QuickBitVector.getLongFromTo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在cern.colt.bitvector.QuickBitVector的用法示例。


在下文中一共展示了QuickBitVector.getLongFromTo方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: partFromTo

import cern.colt.bitvector.QuickBitVector; //導入方法依賴的package包/類
/**
 * Copies all elements between index <tt>from</tt> (inclusive) and <tt>to</tt> (inclusive) into <tt>part</tt>, starting at index <tt>partFrom</tt> within <tt>part</tt>.
 * Elements are only copied if a corresponding flag within <tt>qualificants</tt> is set.
 * More precisely:<pre>
 * for (; from<=to; from++, partFrom++, qualificantsFrom++) {
 *    if (qualificants==null || qualificants.get(qualificantsFrom)) {
 *       part[partFrom] = this.get(from);
 *    }
 * }
 * </pre>
 */
public void partFromTo(final int from, final int to, final BitVector qualificants, final int qualificantsFrom, long[] part, final int partFrom) {
	int width = to-from+1;
	if (from<0 || from>to || to>=size || qualificantsFrom<0 || (qualificants!=null && qualificantsFrom+width>qualificants.size())) {
		throw new IndexOutOfBoundsException();
	}
	if (partFrom<0 || partFrom+width>part.length) {
		throw new IndexOutOfBoundsException();
	}
	
	long minVal = this.minValue;
	int bitsPerElem = this.bitsPerElement;
	long[] theBits = this.bits;
	
	int q = qualificantsFrom;
	int p = partFrom;
	int j=from*bitsPerElem;

	//BitVector tmpBitVector = new BitVector(this.bits, this.size*bitsPerElem);
	for (int i=from; i<=to; i++, q++, p++, j += bitsPerElem) {
		if (qualificants==null || qualificants.get(q)) {
			//part[p] = minVal + tmpBitVector.getLongFromTo(j, j+bitsPerElem-1);
			part[p] = minVal + QuickBitVector.getLongFromTo(theBits, j, j+bitsPerElem-1);
		}
	}
}
 
開發者ID:dmcennis,項目名稱:jAudioGIT,代碼行數:37,代碼來源:MinMaxNumberList.java

示例2: getQuick

import cern.colt.bitvector.QuickBitVector; //導入方法依賴的package包/類
/**
 * Returns the element at the specified position in the receiver; <b>WARNING:</b> Does not check preconditions. 
 * Provided with invalid parameters this method may return invalid elements without throwing any exception!
 * <b>You should only use this method when you are absolutely sure that the index is within bounds.</b>
 * Precondition (unchecked): <tt>index &gt;= 0 && index &lt; size()</tt>.
 *
 * @param index index of element to return.
 */
public long getQuick(int index) {
	int i=index*this.bitsPerElement;
	return this.minValue + QuickBitVector.getLongFromTo(this.bits, i,i+this.bitsPerElement-1);
}
 
開發者ID:dmcennis,項目名稱:jAudioGIT,代碼行數:13,代碼來源:MinMaxNumberList.java


注:本文中的cern.colt.bitvector.QuickBitVector.getLongFromTo方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。