2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
20 package org.onap.policy.controlloop.policy.guard;
22 import java.util.LinkedList;
23 import java.util.List;
25 public class MatchParameters {
26 private String controlLoopName;
28 private String recipe;
29 private List<String> targets;
31 public MatchParameters() {
32 // Do Nothing Empty Constructor.
35 public String getControlLoopName() {
36 return controlLoopName;
39 public void setControlLoopName(String controlLoopName) {
40 this.controlLoopName = controlLoopName;
43 public String getActor() {
47 public void setActor(String actor) {
51 public String getRecipe() {
55 public void setRecipe(String recipe) {
59 public List<String> getTargets() {
63 public void setTargets(List<String> targets) {
64 this.targets = targets;
67 public MatchParameters(String actor, String recipe) {
72 public MatchParameters(String actor, String recipe, List<String> targets) {
74 if (targets != null) {
75 this.targets = new LinkedList<>(targets);
79 public MatchParameters(String controlLoopName, String actor, String recipe, List<String> targets) {
80 this(actor, recipe, targets);
81 this.controlLoopName = controlLoopName;
84 public MatchParameters(MatchParameters matchParameters) {
86 this.controlLoopName = matchParameters.controlLoopName;
87 this.actor = matchParameters.actor;
88 this.recipe = matchParameters.recipe;
89 if (matchParameters.targets != null) {
90 this.targets = new LinkedList<>(matchParameters.targets);
95 public String toString() {
96 return "MatchParameters [controlLoopName=" + controlLoopName + ", actor=" + actor + ", recipe=" + recipe
97 + ", targets=" + targets + "]";
101 public int hashCode() {
102 final int prime = 31;
104 result = prime * result + ((actor == null) ? 0 : actor.hashCode());
105 result = prime * result + ((controlLoopName == null) ? 0 : controlLoopName.hashCode());
106 result = prime * result + ((recipe == null) ? 0 : recipe.hashCode());
107 result = prime * result + ((targets == null) ? 0 : targets.hashCode());
112 public boolean equals(Object obj) {
117 if (getClass() != obj.getClass())
119 MatchParameters other = (MatchParameters) obj;
121 if (other.actor != null)
123 } else if (!actor.equals(other.actor))
125 if (controlLoopName == null) {
126 if (other.controlLoopName != null)
128 } else if (!controlLoopName.equals(other.controlLoopName))
130 if (recipe == null) {
131 if (other.recipe != null)
133 } else if (!recipe.equals(other.recipe))
135 if (targets == null) {
136 if (other.targets != null)
138 } else if (!targets.equals(other.targets))