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=========================================================
21 package org.onap.policy.controlloop.policy.guard;
23 import java.util.LinkedList;
26 public class MatchParameters {
28 //public ControlLoopParameter controlLoop;
29 public String controlLoopName;
32 public LinkedList<String> targets;
35 public MatchParameters() {
39 public MatchParameters(String actor, String recipe) {
44 public MatchParameters(String actor, String recipe, LinkedList<String> targets) {
46 if (targets != null) {
47 this.targets = new LinkedList<String>(targets);
52 public MatchParameters(String controlLoopName, String actor, String recipe, LinkedList<String> targets) {
53 this(actor, recipe, targets);
54 this.controlLoopName = controlLoopName;
61 public MatchParameters(MatchParameters matchParameters) {
63 this.controlLoopName = matchParameters.controlLoopName;
64 this.actor = matchParameters.actor;
65 this.recipe = matchParameters.recipe;
66 if (matchParameters.targets != null) {
67 //this.targets = (LinkedList<String>) Collections.unmodifiableList(matchParameters.targets);
68 this.targets = new LinkedList<String>(matchParameters.targets);
73 public boolean isValid() {
76 throw new NullPointerException();
79 throw new NullPointerException();
81 } catch (Exception e) {
89 public String toString() {
90 return "MatchParameters [controlLoopName=" + controlLoopName + ", actor=" + actor + ", recipe=" + recipe
91 + ", targets=" + targets + "]";
95 public int hashCode() {
98 result = prime * result + ((actor == null) ? 0 : actor.hashCode());
99 result = prime * result + ((controlLoopName == null) ? 0 : controlLoopName.hashCode());
100 result = prime * result + ((recipe == null) ? 0 : recipe.hashCode());
101 result = prime * result + ((targets == null) ? 0 : targets.hashCode());
106 public boolean equals(Object obj) {
111 if (getClass() != obj.getClass())
113 MatchParameters other = (MatchParameters) obj;
115 if (other.actor != null)
117 } else if (!actor.equals(other.actor))
119 if (controlLoopName == null) {
120 if (other.controlLoopName != null)
122 } else if (!controlLoopName.equals(other.controlLoopName))
124 if (recipe == null) {
125 if (other.recipe != null)
127 } else if (!recipe.equals(other.recipe))
129 if (targets == null) {
130 if (other.targets != null)
132 } else if (!targets.equals(other.targets))