当前位置: 首页>>代码示例>>Java>>正文


Java DoubleArrayList.clear方法代码示例

本文整理汇总了Java中cern.colt.list.DoubleArrayList.clear方法的典型用法代码示例。如果您正苦于以下问题:Java DoubleArrayList.clear方法的具体用法?Java DoubleArrayList.clear怎么用?Java DoubleArrayList.clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cern.colt.list.DoubleArrayList的用法示例。


在下文中一共展示了DoubleArrayList.clear方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getNonZeros

import cern.colt.list.DoubleArrayList; //导入方法依赖的package包/类
public void getNonZeros(IntArrayList indexList, DoubleArrayList valueList) {
		boolean fillIndexList = indexList != null;
		boolean fillValueList = valueList != null;
		if (fillIndexList) 
			indexList.clear(); 
		else {
			System.out.println("Wrong use");
			return;
		}
		if (fillValueList) 
			valueList.clear();
		else {
			System.out.println("Wrong use");
			return;
		}
		int[] index = elements.keys().elements();
		double[] value = elements.values().elements(); 
		indexList.elements(index);
		valueList.elements(value);
//		for (int i = 0; i < index.size(); ++i) {
//			indexList.add(index.get(i));
//			valueList.add(value.get(i));
//		}
		
//		int s = size;
//		for (int i=0; i < s; i++) {
//			double value = getQuick(i);
//			if (value != 0) {
//				if (fillIndexList) indexList.add(i);
//				if (fillValueList) valueList.add(value);
//			}
//		}
	}
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:34,代码来源:ColtSparseVector.java

示例2: for

import cern.colt.list.DoubleArrayList; //导入方法依赖的package包/类
/**
Fills the coordinates and values of cells having non-zero values into the specified lists.
Fills into the lists, starting at index 0.
After this call returns the specified lists all have a new size, the number of non-zero values.
<p>
In general, fill order is <i>unspecified</i>.
This implementation fill like: <tt>for (slice = 0..slices-1) for (row = 0..rows-1) for (column = 0..colums-1) do ... </tt>.
However, subclasses are free to us any other order, even an order that may change over time as cell values are changed.
(Of course, result lists indexes are guaranteed to correspond to the same cell).
For an example, see {@link DoubleMatrix2D#getNonZeros(IntArrayList,IntArrayList,DoubleArrayList)}.

@param sliceList the list to be filled with slice indexes, can have any size.
@param rowList the list to be filled with row indexes, can have any size.
@param columnList the list to be filled with column indexes, can have any size.
@param valueList the list to be filled with values, can have any size.
*/
public void getNonZeros(IntArrayList sliceList, IntArrayList rowList, IntArrayList columnList, DoubleArrayList valueList) {
	sliceList.clear(); 
	rowList.clear(); 
	columnList.clear(); 
	valueList.clear();
	int s = slices;
	int r = rows;
	int c = columns;
	for (int slice=0; slice < s; slice++) {
		for (int row=0; row < r; row++) {
			for (int column=0; column < c; column++) {
				double value = getQuick(slice,row,column);
				if (value != 0) {
					sliceList.add(slice);
					rowList.add(row);
					columnList.add(column);
					valueList.add(value);
				}
			}
		}
	}
}
 
开发者ID:dmcennis,项目名称:jAudioGIT,代码行数:39,代码来源:DoubleMatrix3D.java

示例3: keys

import cern.colt.list.DoubleArrayList; //导入方法依赖的package包/类
/**
 * Fills all keys contained in the receiver into the specified list.
 * Fills the list, starting at index 0.
 * After this call returns the specified list has a new size that equals <tt>this.size()</tt>.
 * Iteration order is guaranteed to be <i>identical</i> to the order used by method {@link #forEachKey(DoubleProcedure)}.
 * <p>
 * This method can be used to iterate over the keys of the receiver.
 *
 * @param list the list to be filled, can have any size.
 */
public void keys(final DoubleArrayList list) {
	list.clear();
	forEachKey(
		new DoubleProcedure() {
			public boolean apply(double key) {
				list.add(key);
				return true;
			}
		}
	);
}
 
开发者ID:dmcennis,项目名称:jAudioGIT,代码行数:22,代码来源:AbstractDoubleIntMap.java

示例4: values

import cern.colt.list.DoubleArrayList; //导入方法依赖的package包/类
/**
 * Fills all values contained in the receiver into the specified list.
 * Fills the list, starting at index 0.
 * After this call returns the specified list has a new size that equals <tt>this.size()</tt>.
 * Iteration order is guaranteed to be <i>identical</i> to the order used by method {@link #forEachKey(IntProcedure)}.
 * <p>
 * This method can be used to iterate over the values of the receiver.
 *
 * @param list the list to be filled, can have any size.
 */
public void values(final DoubleArrayList list) {
	list.clear();
	forEachKey(
		new IntProcedure() {
			public boolean apply(int key) {
				list.add(get(key));
				return true;
			}
		}
	);
}
 
开发者ID:dmcennis,项目名称:jAudioGIT,代码行数:22,代码来源:AbstractIntDoubleMap.java

示例5: DoubleIntProcedure

import cern.colt.list.DoubleArrayList; //导入方法依赖的package包/类
/**
Fills all pairs satisfying a given condition into the specified lists.
Fills into the lists, starting at index 0.
After this call returns the specified lists both have a new size, the number of pairs satisfying the condition.
Iteration order is guaranteed to be <i>identical</i> to the order used by method {@link #forEachKey(DoubleProcedure)}.
<p>
<b>Example:</b>
<br>
<pre>
DoubleIntProcedure condition = new DoubleIntProcedure() { // match even values only
	public boolean apply(double key, int value) { return value%2==0; }
}
keys = (8,7,6), values = (1,2,2) --> keyList = (6,8), valueList = (2,1)</tt>
</pre>

@param condition    the condition to be matched. Takes the current key as first and the current value as second argument.
@param keyList the list to be filled with keys, can have any size.
@param valueList the list to be filled with values, can have any size.
*/
public void pairsMatching(final DoubleIntProcedure condition, final DoubleArrayList keyList, final IntArrayList valueList) {
	keyList.clear();
	valueList.clear();
	
	forEachPair(
		new DoubleIntProcedure() {
			public boolean apply(double key, int value) {
				if (condition.apply(key,value)) {
					keyList.add(key);
					valueList.add(value);
				}
				return true;
			}
		}
	);
}
 
开发者ID:dmcennis,项目名称:jAudioGIT,代码行数:36,代码来源:AbstractDoubleIntMap.java

示例6: IntDoubleProcedure

import cern.colt.list.DoubleArrayList; //导入方法依赖的package包/类
/**
Fills all pairs satisfying a given condition into the specified lists.
Fills into the lists, starting at index 0.
After this call returns the specified lists both have a new size, the number of pairs satisfying the condition.
Iteration order is guaranteed to be <i>identical</i> to the order used by method {@link #forEachKey(IntProcedure)}.
<p>
<b>Example:</b>
<br>
<pre>
IntDoubleProcedure condition = new IntDoubleProcedure() { // match even keys only
	public boolean apply(int key, double value) { return key%2==0; }
}
keys = (8,7,6), values = (1,2,2) --> keyList = (6,8), valueList = (2,1)</tt>
</pre>

@param condition    the condition to be matched. Takes the current key as first and the current value as second argument.
@param keyList the list to be filled with keys, can have any size.
@param valueList the list to be filled with values, can have any size.
*/
public void pairsMatching(final IntDoubleProcedure condition, final IntArrayList keyList, final DoubleArrayList valueList) {
	keyList.clear();
	valueList.clear();
	
	forEachPair(
		new IntDoubleProcedure() {
			public boolean apply(int key, double value) {
				if (condition.apply(key,value)) {
					keyList.add(key);
					valueList.add(value);
				}
				return true;
			}
		}
	);
}
 
开发者ID:dmcennis,项目名称:jAudioGIT,代码行数:36,代码来源:AbstractIntDoubleMap.java

示例7: for

import cern.colt.list.DoubleArrayList; //导入方法依赖的package包/类
/**
Fills the coordinates and values of cells having non-zero values into the specified lists.
Fills into the lists, starting at index 0.
After this call returns the specified lists all have a new size, the number of non-zero values.
<p>
In general, fill order is <i>unspecified</i>.
This implementation fills like <tt>for (row = 0..rows-1) for (column = 0..columns-1) do ... </tt>.
However, subclasses are free to us any other order, even an order that may change over time as cell values are changed.
(Of course, result lists indexes are guaranteed to correspond to the same cell).
<p>
<b>Example:</b>
<br>
<pre>
2 x 3 matrix:
0, 0, 8
0, 7, 0
-->
rowList    = (0,1)
columnList = (2,1)
valueList  = (8,7)
</pre>
In other words, <tt>get(0,2)==8, get(1,1)==7</tt>.

@param rowList the list to be filled with row indexes, can have any size.
@param columnList the list to be filled with column indexes, can have any size.
@param valueList the list to be filled with values, can have any size.
*/
public void getNonZeros(IntArrayList rowList, IntArrayList columnList, DoubleArrayList valueList) {
	rowList.clear(); 
	columnList.clear(); 
	valueList.clear();
	int r = rows;
	int c = columns;
	for (int row=0; row < r; row++) {
		for (int column=0; column < c; column++) {
			double value = getQuick(row,column);
			if (value != 0) {
				rowList.add(row);
				columnList.add(column);
				valueList.add(value);
			}
		}
	}
}
 
开发者ID:dmcennis,项目名称:jAudioGIT,代码行数:45,代码来源:DoubleMatrix2D.java

示例8: IntDoubleProcedure

import cern.colt.list.DoubleArrayList; //导入方法依赖的package包/类
/**
Fills all pairs satisfying a given condition into the specified lists.
Fills into the lists, starting at index 0.
After this call returns the specified lists both have a new size, the number of pairs satisfying the condition.
Iteration order is guaranteed to be <i>identical</i> to the order used by method {@link #forEachKey(IntProcedure)}.
<p>
<b>Example:</b>
<br>
<pre>
IntDoubleProcedure condition = new IntDoubleProcedure() { // match even keys only
	public boolean apply(int key, double value) { return key%2==0; }
}
keys = (8,7,6), values = (1,2,2) --> keyList = (6,8), valueList = (2,1)</tt>
</pre>

@param condition    the condition to be matched. Takes the current key as first and the current value as second argument.
@param keyList the list to be filled with keys, can have any size.
@param valueList the list to be filled with values, can have any size.
*/
public void pairsMatching(final IntDoubleProcedure condition, final IntArrayList keyList, final DoubleArrayList valueList) {
	keyList.clear();
	valueList.clear();
	
	for (int i = table.length ; i-- > 0 ;) {
		if (state[i]==FULL && condition.apply(table[i],values[i])) {
			keyList.add(table[i]);
			valueList.add(values[i]);
		}
	}
}
 
开发者ID:dmcennis,项目名称:jAudioGIT,代码行数:31,代码来源:OpenIntDoubleHashMap.java

示例9: DoubleIntProcedure

import cern.colt.list.DoubleArrayList; //导入方法依赖的package包/类
/**
Fills all pairs satisfying a given condition into the specified lists.
Fills into the lists, starting at index 0.
After this call returns the specified lists both have a new size, the number of pairs satisfying the condition.
Iteration order is guaranteed to be <i>identical</i> to the order used by method {@link #forEachKey(DoubleProcedure)}.
<p>
<b>Example:</b>
<br>
<pre>
DoubleIntProcedure condition = new DoubleIntProcedure() { // match even values only
	public boolean apply(double key, int value) { return value%2==0; }
}
keys = (8,7,6), values = (1,2,2) --> keyList = (6,8), valueList = (2,1)</tt>
</pre>

@param condition    the condition to be matched. Takes the current key as first and the current value as second argument.
@param keyList the list to be filled with keys, can have any size.
@param valueList the list to be filled with values, can have any size.
*/
public void pairsMatching(final DoubleIntProcedure condition, final DoubleArrayList keyList, final IntArrayList valueList) {
	keyList.clear();
	valueList.clear();
	
	for (int i = table.length ; i-- > 0 ;) {
		if (state[i]==FULL && condition.apply(table[i],values[i])) {
			keyList.add(table[i]);
			valueList.add(values[i]);
		}
	}
}
 
开发者ID:dmcennis,项目名称:jAudioGIT,代码行数:31,代码来源:OpenDoubleIntHashMap.java

示例10: get

import cern.colt.list.DoubleArrayList; //导入方法依赖的package包/类
/**
Fills the coordinates and values of cells having non-zero values into the specified lists.
Fills into the lists, starting at index 0.
After this call returns the specified lists all have a new size, the number of non-zero values.
<p>
In general, fill order is <i>unspecified</i>.
This implementation fills like: <tt>for (index = 0..size()-1)  do ... </tt>.
However, subclasses are free to us any other order, even an order that may change over time as cell values are changed.
(Of course, result lists indexes are guaranteed to correspond to the same cell).
<p>
<b>Example:</b>
<br>
<pre>
0, 0, 8, 0, 7
-->
indexList  = (2,4)
valueList  = (8,7)
</pre>
In other words, <tt>get(2)==8, get(4)==7</tt>.

@param indexList the list to be filled with indexes, can have any size.
@param valueList the list to be filled with values, can have any size.
*/
public void getNonZeros(IntArrayList indexList, DoubleArrayList valueList) {
	boolean fillIndexList = indexList != null;
	boolean fillValueList = valueList != null;
	if (fillIndexList) indexList.clear(); 
	if (fillValueList) valueList.clear();
	int s = size;
	for (int i=0; i < s; i++) {
		double value = getQuick(i);
		if (value != 0) {
			if (fillIndexList) indexList.add(i);
			if (fillValueList) valueList.add(value);
		}
	}
}
 
开发者ID:dmcennis,项目名称:jAudioGIT,代码行数:38,代码来源:DoubleMatrix1D.java


注:本文中的cern.colt.list.DoubleArrayList.clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。