2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.groupbasedpolicy.renderer.vpp.policy;
11 import javax.annotation.Nonnull;
12 import javax.annotation.concurrent.Immutable;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.renderer.rev151103.EndpointPolicyParticipation;
16 import com.google.common.base.Preconditions;
19 public class RendererResolvedPolicy implements Comparable<RendererResolvedPolicy> {
21 private final EndpointPolicyParticipation rendererEndpointParticipation;
22 private final ResolvedRuleGroup ruleGroup;
24 public RendererResolvedPolicy(@Nonnull EndpointPolicyParticipation rendererEndpointParticipation,
25 @Nonnull ResolvedRuleGroup ruleGroupInfo) {
26 this.rendererEndpointParticipation = Preconditions.checkNotNull(rendererEndpointParticipation);
27 this.ruleGroup = Preconditions.checkNotNull(ruleGroupInfo);
30 public EndpointPolicyParticipation getRendererEndpointParticipation() {
31 return rendererEndpointParticipation;
34 public ResolvedRuleGroup getRuleGroup() {
39 public int compareTo(RendererResolvedPolicy arg0) {
40 return ruleGroup.compareTo(arg0.getRuleGroup());
44 public int hashCode() {
47 result = prime * result
48 + ((rendererEndpointParticipation == null) ? 0 : rendererEndpointParticipation.hashCode());
49 result = prime * result + ((ruleGroup == null) ? 0 : ruleGroup.hashCode());
54 public boolean equals(Object obj) {
59 if (getClass() != obj.getClass())
61 RendererResolvedPolicy other = (RendererResolvedPolicy) obj;
62 if (rendererEndpointParticipation != other.rendererEndpointParticipation)
64 if (ruleGroup == null) {
65 if (other.ruleGroup != null)
67 } else if (!ruleGroup.equals(other.ruleGroup))
73 public String toString() {
74 return "RendererResolvedPolicy [rendererEndpointParticipation=" + rendererEndpointParticipation + ", ruleGroup="