本文整理汇总了Scala中scala.collection.parallel.ForkJoinTaskSupport类的典型用法代码示例。如果您正苦于以下问题:Scala ForkJoinTaskSupport类的具体用法?Scala ForkJoinTaskSupport怎么用?Scala ForkJoinTaskSupport使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ForkJoinTaskSupport类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。
示例1: Main3
//设置package包名称以及导入依赖的类
package de.trash
import scala.concurrent.forkjoin.ForkJoinPool
import scala.collection.parallel.ForkJoinTaskSupport
import scala.util.control.Breaks._
import java.util.concurrent.atomic.AtomicLong
import java.util.concurrent.atomic.AtomicBoolean
import scala.BigInt
object Main3 extends App {
val clauses = List[List[Short]](List(3,3,3),List(2,1,-1),List(-3,-2,-3),List(2,1,2))
//println(clauses.transpose)
val nVar : Int = 3
var i : Int =0;
val iVar = (for {i <- 0 until nVar} yield Math.pow(2, i).toLong)
val maxNumber = BigInt(Math.pow(2, nVar).toLong)
var number: AtomicLong = new AtomicLong(0)
var end: AtomicBoolean = new AtomicBoolean(false)
val fjpool = new ForkJoinPool(1)
val customTaskSupport = new ForkJoinTaskSupport(fjpool)
val t = (BigInt(0) to BigInt(maxNumber+""))
//t.tasksupport = customTaskSupport
t.foreach({ x => {
if(!end.get()){
if({
clauses.forall({ c => {
println(c+" "+x)
if(x.toLong==4){
println("yap")
}
!(0 to 2).forall({ i => {
val v : Int = c(i)
println(v)
if(v>0){
println(iVar(v - 1))
}else if(v<0){
println(iVar(-v - 1))
}
var ret = true
!(v > 0 && (x.toLong & iVar(v - 1)) > 0) && !(v < 0 && (x.toLong & iVar(-v - 1)) == 0)
}