remove dependency of drool-application/yaml in actors
[policy/models.git] / models-interactions / model-yaml / src / main / java / org / onap / policy / controlloop / policy / guard / ControlLoopGuard.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * policy-yaml
4  * ================================================================================
5  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
6  * Modifications Copyright (C) 2019 Nordix Foundation.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  * 
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  * 
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  */
21
22 package org.onap.policy.controlloop.policy.guard;
23
24 import java.util.LinkedList;
25
26 public class ControlLoopGuard {
27     
28     private Guard guard;
29     
30     private LinkedList<GuardPolicy> guards;
31     
32     public ControlLoopGuard() {
33         //DO Nothing Empty Constructor
34     }
35     
36     public ControlLoopGuard(ControlLoopGuard clGuard) {
37         this.guard = new Guard();
38         this.guards = new LinkedList<>(clGuard.guards);
39     }
40     
41     public Guard getGuard() {
42         return guard;
43     }
44
45     public void setGuard(Guard guard) {
46         this.guard = guard;
47     }
48
49     public LinkedList<GuardPolicy> getGuards() {
50         return guards;
51     }
52
53     public void setGuards(LinkedList<GuardPolicy> guards) {
54         this.guards = guards;
55     }
56
57     @Override
58     public String toString() {
59         return "Guard [guard=" + guard + ", GuardPolicies=" + guards + "]";
60     }
61
62     @Override
63     public int hashCode() {
64         final int prime = 31;
65         int result = 1;
66         result = prime * result + ((guard == null) ? 0 : guard.hashCode());
67         result = prime * result + ((guards == null) ? 0 : guards.hashCode());
68         return result;
69     }
70
71     @Override
72     public boolean equals(Object obj) {
73         if (this == obj) {
74             return true;
75         }
76         if (obj == null) {
77             return false;
78         }
79         if (getClass() != obj.getClass()) {
80             return false;
81         }
82         ControlLoopGuard other = (ControlLoopGuard) obj;
83         if (guard == null) {
84             if (other.guard != null) {
85                 return false;
86             }
87         } else if (!guard.equals(other.guard)) {
88             return false;
89         }
90         if (guards == null) {
91             if (other.guards != null) {
92                 return false;
93             }
94         } else if (!guards.equals(other.guards)) {
95             return false;
96         }
97         return true;
98     }
99
100     
101 }