本文整理汇总了Java中com.google.common.primitives.Booleans.asList方法的典型用法代码示例。如果您正苦于以下问题:Java Booleans.asList方法的具体用法?Java Booleans.asList怎么用?Java Booleans.asList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.primitives.Booleans
的用法示例。
在下文中一共展示了Booleans.asList方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getValues
import com.google.common.primitives.Booleans; //导入方法依赖的package包/类
static
public List<?> getValues(Tensor tensor){
DataType dataType = tensor.dataType();
switch(dataType){
case FLOAT:
return Floats.asList(TensorUtil.toFloatArray(tensor));
case DOUBLE:
return Doubles.asList(TensorUtil.toDoubleArray(tensor));
case INT32:
return Ints.asList(TensorUtil.toIntArray(tensor));
case INT64:
return Longs.asList(TensorUtil.toLongArray(tensor));
case STRING:
return Arrays.asList(TensorUtil.toStringArray(tensor));
case BOOL:
return Booleans.asList(TensorUtil.toBooleanArray(tensor));
default:
throw new IllegalArgumentException();
}
}
示例2: main
import com.google.common.primitives.Booleans; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
Stopwatch sw = Stopwatch.createUnstarted();
long last = 0;
for(Boolean allowOverlappingOccurrence:Booleans.asList(false, true)) {
for(Boolean useCache:Booleans.asList(false, true)) {
AnalysisEngineDescription aeDesc = createAE(allowOverlappingOccurrence, useCache);
AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(aeDesc);
System.out.println("--------------------------------");
System.out.println("allowOverlappingOccurrence: " + allowOverlappingOccurrence);
System.out.println("useCache: " + useCache);
for(int i= 0; i < NB_ITERATIONS; i++) {
JCas cas = createCAS();
sw.start();
ae.process(cas);
sw.stop();
System.out.format("%4d. %10d %10d - words: %d terms: %d %n",
i+1,
sw.elapsed(TimeUnit.MILLISECONDS),
sw.elapsed(TimeUnit.MILLISECONDS) - last,
count(cas, "WordAnnotation"),
count(cas, "TermOccAnnotation")
);
last = sw.elapsed(TimeUnit.MILLISECONDS);
}
}
}
}
示例3: calculateCRC
import com.google.common.primitives.Booleans; //导入方法依赖的package包/类
private static byte[] calculateCRC(byte[] input) {
List<Boolean> datastream = Booleans.asList(byteToBitVector(input));
for (int i = 0; i < datastream.size() - (CRC_POLYNOM.length - 1); i++) {
if (datastream.get(i)) {
for (int j = 0; j < CRC_POLYNOM.length; j++) {
datastream.set(i + j, CRC_POLYNOM[j] ^ datastream.get(i + j));
}
}
}
return bitVectorToByte(datastream.subList(datastream.size() - 24, datastream.size()));
}
示例4: getValues
import com.google.common.primitives.Booleans; //导入方法依赖的package包/类
@Override
public List<Boolean> getValues(){
return Booleans.asList(this.values);
}
示例5: convert_boolean_array_to_Boolean_list
import com.google.common.primitives.Booleans; //导入方法依赖的package包/类
@Test
public void convert_boolean_array_to_Boolean_list () {
boolean[] booleanArray = {true, false, true, false};
List<Boolean> booleans = Booleans.asList(booleanArray);
assertEquals(4, booleans.size());
}