From 43ad1c4964adac377a575f360d94bbc6cd939c8f Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Mon, 30 May 2022 14:36:41 +0200 Subject: [PATCH] Cleanup --- src/main/scala/hb/dhbw/CartesianProduct.scala | 12 +----------- src/test/scala/CartesianProductTest.scala | 11 ----------- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/src/main/scala/hb/dhbw/CartesianProduct.scala b/src/main/scala/hb/dhbw/CartesianProduct.scala index b075424..4220891 100644 --- a/src/main/scala/hb/dhbw/CartesianProduct.scala +++ b/src/main/scala/hb/dhbw/CartesianProduct.scala @@ -1,17 +1,7 @@ package hb.dhbw class CartesianProduct[A](private val setOfSets: List[List[A]]){ - def productWith(product: CartesianProduct[A]) = { - val ret = new CartesianProduct[A](setOfSets ++ product.setOfSets) - var base: Long = 1 - ret.sizes = ret.setOfSets.map(_.size) - ret.sizes.foreach(size => { - base = base * size - }) - ret.max = base - ret.i = i - ret - } + //def addPossibilities(Set[A]) //TODO private var sizes: List[Int] = null private var max: Long = 1 diff --git a/src/test/scala/CartesianProductTest.scala b/src/test/scala/CartesianProductTest.scala index e6281dc..8249796 100644 --- a/src/test/scala/CartesianProductTest.scala +++ b/src/test/scala/CartesianProductTest.scala @@ -8,15 +8,4 @@ class CartesianProductTest extends FunSuite{ val result = List(1,2,3,4).map( _ => test.nextProduct()) assert(result.contains(Set(1,4))) } - - test("productWith"){ - val test = new CartesianProduct[Int](Set(Set(1,2),Set(4,3))) - val test2 = new CartesianProduct[Int](Set(Set(5,6), Set(7,8))) - val test3 = test.productWith(test2) - val result = for( i <- 1 to 16) yield test3.nextProduct() - assert(result.contains(Set(2,3,6,8))) - assert(result.toSet.size == 16) - println(result) - } - }