2 * Copyright (c) 2015 Cisco Systems and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.dsbenchmark;
10 import com.google.common.collect.ImmutableMap;
11 import com.google.common.collect.ImmutableMap.Builder;
12 import java.util.ArrayList;
13 import java.util.List;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.test.exec.OuterList;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.test.exec.OuterListBuilder;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.test.exec.OuterListKey;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.test.exec.outer.list.InnerList;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.test.exec.outer.list.InnerListBuilder;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.test.exec.outer.list.InnerListKey;
22 public final class BaListBuilder {
23 private BaListBuilder() {
27 public static List<OuterList> buildOuterList(final int outerElements, final int innerElements) {
28 List<OuterList> outerList = new ArrayList<>(outerElements);
29 for (int j = 0; j < outerElements; j++) {
30 outerList.add(new OuterListBuilder()
32 .setInnerList(buildInnerList(j, innerElements))
33 .withKey(new OuterListKey(j))
39 private static Map<InnerListKey, InnerList> buildInnerList(final int index, final int elements) {
40 Builder<InnerListKey, InnerList> innerList = ImmutableMap.builderWithExpectedSize(elements);
42 final String itemStr = "Item-" + String.valueOf(index) + "-";
43 for (int i = 0; i < elements; i++) {
44 final InnerListKey key = new InnerListKey(i);
45 innerList.put(key, new InnerListBuilder()
48 .setValue(itemStr + String.valueOf(i))
51 return innerList.build();