blob: a094828ed9a634fc6c49079adad8f96ed9efb73c [file] [log] [blame]
Thomas Vachuskaf9c84362015-04-15 11:20:45 -07001/*
2 * Copyright 2015 Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onlab.stc;
17
18import com.google.common.collect.ImmutableSet;
19import com.google.common.collect.Sets;
20
21import java.util.Set;
22
23/**
24 * Represenation of a related group of steps.
25 */
26public class Group extends Step {
27
28 private final Set<Step> children = Sets.newHashSet();
29
30 /**
31 * Creates a new test step.
32 *
33 * @param name group name
34 * @param command group default command
35 * @param group optional group to which this step belongs
36 */
37 public Group(String name, String command, Group group) {
38 super(name, command, group);
39 }
40
41 /**
42 * Returns the set of child steps and groups contained within this group.
43 *
44 * @return set of children
45 */
46 public Set<Step> children() {
47 return ImmutableSet.copyOf(children);
48 }
49
50 /**
51 * Adds the specified step or group as a child of this group.
52 *
53 * @param child child step or group to add
54 */
55 public void addChild(Step child) {
56 children.add(child);
57 }
58}