Initial opendaylight infrastructure commit!!
[controller.git] / opendaylight / sal / yang-prototype / yang / yang-model-api / src / main / java / org / opendaylight / controller / yang / model / api / SchemaPath.java
diff --git a/opendaylight/sal/yang-prototype/yang/yang-model-api/src/main/java/org/opendaylight/controller/yang/model/api/SchemaPath.java b/opendaylight/sal/yang-prototype/yang/yang-model-api/src/main/java/org/opendaylight/controller/yang/model/api/SchemaPath.java
new file mode 100644 (file)
index 0000000..90a5d5b
--- /dev/null
@@ -0,0 +1,74 @@
+/*\r
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+package org.opendaylight.controller.yang.model.api;\r
+\r
+import java.util.ArrayList;\r
+import java.util.Collections;\r
+import java.util.List;\r
+\r
+import org.opendaylight.controller.yang.common.QName;\r
+\r
+public class SchemaPath {\r
+\r
+    final List<QName> path;\r
+    final boolean absolute;\r
+\r
+    public SchemaPath(final List<QName> path, boolean absolute) {\r
+        this.path = Collections.unmodifiableList(new ArrayList<QName>(path));\r
+        this.absolute = absolute;\r
+    }\r
+\r
+    public List<QName> getPath() {\r
+        return path;\r
+    }\r
+\r
+    @Override\r
+    public int hashCode() {\r
+        final int prime = 31;\r
+        int result = 1;\r
+        result = prime * result + (absolute ? 1231 : 1237);\r
+        result = prime * result + ((path == null) ? 0 : path.hashCode());\r
+        return result;\r
+    }\r
+\r
+    @Override\r
+    public boolean equals(Object obj) {\r
+        if (this == obj) {\r
+            return true;\r
+        }\r
+        if (obj == null) {\r
+            return false;\r
+        }\r
+        if (getClass() != obj.getClass()) {\r
+            return false;\r
+        }\r
+        SchemaPath other = (SchemaPath) obj;\r
+        if (absolute != other.absolute) {\r
+            return false;\r
+        }\r
+        if (path == null) {\r
+            if (other.path != null) {\r
+                return false;\r
+            }\r
+        } else if (!path.equals(other.path)) {\r
+            return false;\r
+        }\r
+        return true;\r
+    }\r
+\r
+    @Override\r
+    public String toString() {\r
+        StringBuilder builder = new StringBuilder();\r
+        builder.append("SchemaPath [path=");\r
+        builder.append(path);\r
+        builder.append(", absolute=");\r
+        builder.append(absolute);\r
+        builder.append("]");\r
+        return builder.toString();\r
+    }\r
+}\r