Refactor DefaultRoutingHandler to avoid hitting 2000 lines limit
Change-Id: I426e7fc70dcc063bd5742f86ba1141adf6d1d94e
diff --git a/app/src/main/java/org/onosproject/segmentrouting/PortFilterInfo.java b/app/src/main/java/org/onosproject/segmentrouting/PortFilterInfo.java
new file mode 100644
index 0000000..75c12d6
--- /dev/null
+++ b/app/src/main/java/org/onosproject/segmentrouting/PortFilterInfo.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.segmentrouting;
+
+import com.google.common.base.MoreObjects;
+
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+/**
+ * Utility class used to temporarily store information about the ports on a
+ * device processed for filtering objectives.
+ */
+public final class PortFilterInfo {
+ int disabledPorts = 0, errorPorts = 0, filteredPorts = 0;
+
+ public PortFilterInfo(int disabledPorts, int errorPorts,
+ int filteredPorts) {
+ this.disabledPorts = disabledPorts;
+ this.filteredPorts = filteredPorts;
+ this.errorPorts = errorPorts;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(disabledPorts, filteredPorts, errorPorts);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if ((obj == null) || (!(obj instanceof PortFilterInfo))) {
+ return false;
+ }
+ PortFilterInfo other = (PortFilterInfo) obj;
+ return ((disabledPorts == other.disabledPorts) &&
+ (filteredPorts == other.filteredPorts) &&
+ (errorPorts == other.errorPorts));
+ }
+
+ @Override
+ public String toString() {
+ MoreObjects.ToStringHelper helper = toStringHelper(this)
+ .add("disabledPorts", disabledPorts)
+ .add("errorPorts", errorPorts)
+ .add("filteredPorts", filteredPorts);
+ return helper.toString();
+ }
+}
\ No newline at end of file