Split Error identifiers to separate classes. 62/12662/1
authorDana Kutenicsova <dkutenic@cisco.com>
Sat, 8 Nov 2014 20:28:30 +0000 (21:28 +0100)
committerDana Kutenicsova <dkutenic@cisco.com>
Sat, 8 Nov 2014 20:28:30 +0000 (21:28 +0100)
Change-Id: I1b74e56c3fb79d4eb375a0da7e1e81fc00b52797
Signed-off-by: Dana Kutenicsova <dkutenic@cisco.com>
bgp/parser-api/src/main/java/org/opendaylight/protocol/bgp/parser/BGPError.java
bgp/parser-api/src/main/java/org/opendaylight/protocol/bgp/parser/BGPErrorIdentifier.java [new file with mode: 0644]
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/PCEPErrorIdentifier.java [new file with mode: 0644]
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/PCEPErrors.java

index 85ca0c500ea8c95dd71182283d5d3f2d6ced5a97..f3e98dd80a7febe8613cea688a321cf221683db2 100644 (file)
@@ -170,62 +170,6 @@ public enum BGPError {
         return this.errorId;
     }
 
-    /**
-     * Caret for combination of Error-type and Error-value
-     */
-    static class BGPErrorIdentifier {
-        private final short code;
-        private final short subcode;
-
-        BGPErrorIdentifier(final short code, final short subcode) {
-            this.code = code;
-            this.subcode = subcode;
-        }
-
-        public short getCode() {
-            return this.code;
-        }
-
-        public short getSubCode() {
-            return this.subcode;
-        }
-
-        @Override
-        public int hashCode() {
-            final int prime = 31;
-            int result = 1;
-            result = prime * result + this.code;
-            result = prime * result + this.subcode;
-            return result;
-        }
-
-        @Override
-        public boolean equals(final java.lang.Object obj) {
-            if (this == obj) {
-                return true;
-            }
-            if (obj == null) {
-                return false;
-            }
-            if (this.getClass() != obj.getClass()) {
-                return false;
-            }
-            final BGPErrorIdentifier other = (BGPErrorIdentifier) obj;
-            if (this.code != other.code) {
-                return false;
-            }
-            if (this.subcode != other.subcode) {
-                return false;
-            }
-            return true;
-        }
-
-        @Override
-        public String toString() {
-            return "type " + this.code + " value " + this.subcode;
-        }
-    }
-
     public static BGPError forValue(final int code, final int subcode) {
         final BGPError e = VALUE_MAP.get(new BGPErrorIdentifier((short) code, (short) subcode));
         if (e != null) {
diff --git a/bgp/parser-api/src/main/java/org/opendaylight/protocol/bgp/parser/BGPErrorIdentifier.java b/bgp/parser-api/src/main/java/org/opendaylight/protocol/bgp/parser/BGPErrorIdentifier.java
new file mode 100644 (file)
index 0000000..acfcb7c
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.protocol.bgp.parser;
+
+/**
+ * Caret for combination of Error-type and Error-value
+ */
+final class BGPErrorIdentifier {
+    private final short code;
+    private final short subcode;
+
+    BGPErrorIdentifier(final short code, final short subcode) {
+        this.code = code;
+        this.subcode = subcode;
+    }
+
+    public short getCode() {
+        return this.code;
+    }
+
+    public short getSubCode() {
+        return this.subcode;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + this.code;
+        result = prime * result + this.subcode;
+        return result;
+    }
+
+    @Override
+    public boolean equals(final java.lang.Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (this.getClass() != obj.getClass()) {
+            return false;
+        }
+        final BGPErrorIdentifier other = (BGPErrorIdentifier) obj;
+        if (this.code != other.code) {
+            return false;
+        }
+        if (this.subcode != other.subcode) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return "type " + this.code + " value " + this.subcode;
+    }
+}
diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/PCEPErrorIdentifier.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/PCEPErrorIdentifier.java
new file mode 100644 (file)
index 0000000..5cadeb4
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.protocol.pcep.spi;
+
+/**
+ * Caret for combination of Error-type and Error-value
+ */
+final class PCEPErrorIdentifier {
+    private final short type;
+    private final short value;
+
+    PCEPErrorIdentifier(final short type, final short value) {
+        this.type = type;
+        this.value = value;
+    }
+
+    public short getType() {
+        return this.type;
+    }
+
+    public short getValue() {
+        return this.value;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + this.type;
+        result = prime * result + this.value;
+        return result;
+    }
+
+    @Override
+    public boolean equals(final java.lang.Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (this.getClass() != obj.getClass()) {
+            return false;
+        }
+        final PCEPErrorIdentifier other = (PCEPErrorIdentifier) obj;
+        if (this.type != other.type) {
+            return false;
+        }
+        if (this.value != other.value) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return "type " + this.type + " value " + this.value;
+    }
+}
index d61808b4b6b35c7e9d9ccb125458f0fa511b7210..6751cc94ae2b46c40312a3fd252e271215d9f26c 100644 (file)
@@ -10,9 +10,6 @@ package org.opendaylight.protocol.pcep.spi;
 import com.google.common.collect.Maps;
 import java.util.Map;
 
-
-
-
 /**
  * Possible errors listed in RFC5440, RFC 5455 and stateful draft.
  *
@@ -301,60 +298,4 @@ public enum PCEPErrors {
     public short getErrorValue() {
         return this.errorId.getValue();
     }
-
-    /**
-     * Caret for combination of Error-type and Error-value
-     */
-    static class PCEPErrorIdentifier {
-        private final short type;
-        private final short value;
-
-        PCEPErrorIdentifier(final short type, final short value) {
-            this.type = type;
-            this.value = value;
-        }
-
-        public short getType() {
-            return this.type;
-        }
-
-        public short getValue() {
-            return this.value;
-        }
-
-        @Override
-        public int hashCode() {
-            final int prime = 31;
-            int result = 1;
-            result = prime * result + this.type;
-            result = prime * result + this.value;
-            return result;
-        }
-
-        @Override
-        public boolean equals(final java.lang.Object obj) {
-            if (this == obj) {
-                return true;
-            }
-            if (obj == null) {
-                return false;
-            }
-            if (this.getClass() != obj.getClass()) {
-                return false;
-            }
-            final PCEPErrorIdentifier other = (PCEPErrorIdentifier) obj;
-            if (this.type != other.type) {
-                return false;
-            }
-            if (this.value != other.value) {
-                return false;
-            }
-            return true;
-        }
-
-        @Override
-        public String toString() {
-            return "type " + this.type + " value " + this.value;
-        }
-    }
 }