summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ConditionGroup.java
blob: cf132efa626eedba4d10cbdfe00d1174ebd6c5c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package org.onap.sdc.dcae.composition.restmodels.ruleeditor;

import java.util.List;
import java.util.Objects;

public class ConditionGroup extends BaseCondition {

	private String type;
	private List<BaseCondition> children;

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public List<BaseCondition> getChildren() {
		return children;
	}

	public void setChildren(List<BaseCondition> children) {
		this.children = children;
	}

	@Override
	public boolean referencesTarget(String target) {
		return children.stream().anyMatch(c -> c.referencesTarget(target));
	}

	@Override
	public boolean equals(Object obj) {
		return super.equals(obj) && Objects.equals(type, ((ConditionGroup)obj).type) &&
				Objects.equals(children, ((ConditionGroup)obj).children);
	}

	@Override
	public int hashCode(){
		return Objects.hash(type, children);
	}

}