blob: 2e9356bc8ff093f65143c79e73cea87c3a4648fa [file] [log] [blame]
lishuai91d986c2015-07-28 09:45:20 +08001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
lishuai91d986c2015-07-28 09:45:20 +08003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.ovsdb.rfc.message;
17
18import static com.google.common.base.MoreObjects.toStringHelper;
19
20import java.util.Objects;
21
22/**
23 * The contents of this object specify how the columns or table are to be
24 * monitored.
25 */
26public final class MonitorSelect {
27
28 private final boolean initial;
29 private final boolean insert;
30 private final boolean delete;
31 private final boolean modify;
32
33 /**
34 * Constructs a MonitorSelect object.
35 * @param initial whether monitor the initial action
36 * @param insert whether monitor the insert action
37 * @param delete whether monitor the delete action
38 * @param modify whether monitor the modify action
39 */
40 public MonitorSelect(boolean initial, boolean insert, boolean delete,
41 boolean modify) {
42 this.initial = initial;
43 this.insert = insert;
44 this.delete = delete;
45 this.modify = modify;
46 }
47
48 /**
49 * Returns initial.
50 * @return initial
51 */
52 public boolean isInitial() {
53 return initial;
54 }
55
56 /**
57 * Returns insert.
58 * @return insert
59 */
60 public boolean isInsert() {
61 return insert;
62 }
63
64 /**
65 * Returns delete.
66 * @return delete
67 */
68 public boolean isDelete() {
69 return delete;
70 }
71
72 /**
73 * Returns modify.
74 * @return modify
75 */
76 public boolean isModify() {
77 return modify;
78 }
79
80 @Override
81 public int hashCode() {
82 return Objects.hash(initial, insert, delete, modify);
83 }
84
85 @Override
86 public boolean equals(Object obj) {
87 if (this == obj) {
88 return true;
89 }
90 if (obj instanceof MonitorSelect) {
91 final MonitorSelect other = (MonitorSelect) obj;
92 return Objects.equals(this.initial, other.initial)
93 && Objects.equals(this.insert, other.insert)
94 && Objects.equals(this.delete, other.delete)
95 && Objects.equals(this.modify, other.modify);
96 }
97 return false;
98 }
99
100 @Override
101 public String toString() {
102 return toStringHelper(this).add("initial", initial)
103 .add("insert", insert).add("delete", delete)
104 .add("modify", modify).toString();
105 }
106}