2 * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. 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
8 package org.opendaylight.genius.mdsalutil;
10 import com.google.common.base.MoreObjects;
11 import java.io.Serializable;
12 import java.util.List;
13 import java.util.Objects;
14 import org.opendaylight.yangtools.util.EvenMoreObjects;
16 public class BucketInfo extends ActionInfoList implements Serializable {
18 private static final long serialVersionUID = 1L;
20 private Integer weight = 0;
21 private Long watchPort = 0xffffffffL;
22 private Long watchGroup = 0xffffffffL;
24 public BucketInfo(List<ActionInfo> listActions) {
28 public BucketInfo(List<ActionInfo> actionInfos, Integer weight, Long watchPort, Long watchGroup) {
31 this.watchPort = watchPort;
32 this.watchGroup = watchGroup;
35 public void setWeight(Integer bucketWeight) {
36 weight = bucketWeight;
39 public Integer getWeight() {
43 public Long getWatchPort() {
47 public void setWatchPort(Long watchPort) {
48 this.watchPort = watchPort;
51 public Long getWatchGroup() {
55 public void setWatchGroup(Long watchGroup) {
56 this.watchGroup = watchGroup;
60 public String toString() {
61 return MoreObjects.toStringHelper(this).add("actionInfos", getActionInfos()).add("weight", weight)
62 .add("watchPort", watchPort).add("watchGroup", watchGroup).toString();
66 public int hashCode() {
67 return Objects.hash(getActionInfos(), weight, watchPort, watchGroup);
71 public boolean equals(Object obj) {
72 return EvenMoreObjects.equalsHelper(this, obj,
73 (self, other) -> Objects.equals(self.getActionInfos(), other.getActionInfos())
74 && Objects.equals(self.weight, other.weight)
75 && Objects.equals(self.watchPort, other.watchPort)
76 && Objects.equals(self.watchGroup, other.watchGroup));