removed unused code

This commit is contained in:
Jonathan Shook
2023-02-10 11:48:44 -06:00
parent 70408621dd
commit 167de5670d
2 changed files with 0 additions and 95 deletions

View File

@@ -1,55 +0,0 @@
/*
* Copyright (c) 2023 nosqlbench
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.nosqlbench.api.content;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
public class NBIOSets {
/**
* Combine overlapping sets or create new ones with no overlap
* @param setsData Existing sets
* @param newSets Additional sets
* @return combined sets
* @param <T>
*/
public static <T extends Comparable<T>> List<Set<T>> combine(List<Set<T>> setsData, Set<T>... newSets) {
for (Set<T> coset : newSets) {
Set<T> addTo = null;
for (Set<T> extensionSet : setsData) {
Set<T> union = new LinkedHashSet<>(coset);
for (T entry : coset) {
if (extensionSet.contains(entry)) {
addTo = extensionSet;
break;
}
}
if (addTo != null) {
break;
}
}
if (addTo==null) {
addTo=new LinkedHashSet<>();
setsData.add(addTo);
}
addTo.addAll(coset);
}
return setsData;
}
}

View File

@@ -1,40 +0,0 @@
/*
* Copyright (c) 2023 nosqlbench
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.nosqlbench.api.content;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import static org.assertj.core.api.Assertions.assertThat;
public class NBIOSetsTest {
@Test
public void testSetsAddition() {
List<Set<String>> data = new ArrayList<>();
data=NBIOSets.combine(data, Set.of("a","b"));
assertThat(data).isEqualTo(List.of(Set.of("a","b")));
data=NBIOSets.combine(data,Set.of("a","c"));
assertThat(data).isEqualTo(List.of(Set.of("a","b","c")));
data=NBIOSets.combine(data, Set.of("d"));
assertThat(data).isEqualTo(List.of(Set.of("a","b","c"),Set.of("d")));
}
}