Merge "Memory hog: ImmutableList is appropriate here"
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / builder / api / AbstractSchemaNodeBuilder.java
index 1a1b6b8d4cbbce321de77146ebb4e7cf179b29e4..ccf57f92bf32471dbe203443645d7fd43fa73ee1 100644 (file)
-/*\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.yangtools.yang.parser.builder.api;\r
-\r
-import java.util.List;\r
-\r
-import org.opendaylight.yangtools.yang.common.QName;\r
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;\r
-import org.opendaylight.yangtools.yang.model.api.Status;\r
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;\r
-\r
-/**\r
- * Basic implementation of SchemaNodeBuilder.\r
- */\r
-public abstract class AbstractSchemaNodeBuilder extends AbstractBuilder implements SchemaNodeBuilder {\r
-    protected QName qname;\r
-    protected SchemaPath schemaPath;\r
-    protected String description;\r
-    protected String reference;\r
-    protected Status status = Status.CURRENT;\r
-    protected List<UnknownSchemaNode> unknownNodes;\r
-\r
-    protected AbstractSchemaNodeBuilder(final String moduleName, final int line, final QName qname) {\r
-        super(moduleName, line);\r
-        this.qname = qname;\r
-    }\r
-\r
-    @Override\r
-    public int hashCode() {\r
-        final int prime = 31;\r
-        int result = super.hashCode();\r
-        result = prime * result + ((parent == null) ? 0 : parent.hashCode());\r
-        result = prime * result + ((schemaPath == null) ? 0 : schemaPath.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
-        if (!super.equals(obj)) {\r
-            return false;\r
-        }\r
-        AbstractSchemaNodeBuilder other = (AbstractSchemaNodeBuilder) obj;\r
-        if (parent == null) {\r
-            if (other.parent != null) {\r
-                return false;\r
-            }\r
-        } else if (!parent.equals(other.parent)) {\r
-            return false;\r
-        }\r
-        if (schemaPath == null) {\r
-            if (other.schemaPath != null) {\r
-                return false;\r
-            }\r
-        } else if (!schemaPath.equals(other.schemaPath)) {\r
-            return false;\r
-        }\r
-        return true;\r
-    }\r
-\r
-    public QName getQName() {\r
-        return qname;\r
-    }\r
-\r
-    @Override\r
-    public SchemaPath getPath() {\r
-        return schemaPath;\r
-    }\r
-\r
-    @Override\r
-    public void setPath(SchemaPath schemaPath) {\r
-        this.schemaPath = schemaPath;\r
-    }\r
-\r
-    @Override\r
-    public String getDescription() {\r
-        return description;\r
-    }\r
-\r
-    @Override\r
-    public void setDescription(String description) {\r
-        this.description = description;\r
-    }\r
-\r
-    @Override\r
-    public String getReference() {\r
-        return reference;\r
-    }\r
-\r
-    @Override\r
-    public void setReference(String reference) {\r
-        this.reference = reference;\r
-    }\r
-\r
-    @Override\r
-    public Status getStatus() {\r
-        return status;\r
-    }\r
-\r
-    @Override\r
-    public void setStatus(Status status) {\r
-        if (status != null) {\r
-            this.status = status;\r
-        }\r
-    }\r
-\r
-    public void setUnknownNodes(List<UnknownSchemaNode> unknownNodes) {\r
-        this.unknownNodes = unknownNodes;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 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.yangtools.yang.parser.builder.api;
+
+import java.util.List;
+
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+
+/**
+ * Basic implementation of SchemaNodeBuilder.
+ */
+public abstract class AbstractSchemaNodeBuilder extends AbstractBuilder implements SchemaNodeBuilder {
+    protected final QName qname;
+    protected SchemaPath schemaPath;
+
+    protected AbstractSchemaNodeBuilder(final String moduleName, final int line, final QName qname) {
+        super(moduleName, line);
+        this.qname = qname;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + ((parentBuilder == null) ? 0 : parentBuilder.hashCode());
+        result = prime * result + ((schemaPath == null) ? 0 : schemaPath.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        if (!super.equals(obj)) {
+            return false;
+        }
+        AbstractSchemaNodeBuilder other = (AbstractSchemaNodeBuilder) obj;
+        if (parentBuilder == null) {
+            if (other.parentBuilder != null) {
+                return false;
+            }
+        } else if (!parentBuilder.equals(other.parentBuilder)) {
+            return false;
+        }
+        if (schemaPath == null) {
+            if (other.schemaPath != null) {
+                return false;
+            }
+        } else if (!schemaPath.equals(other.schemaPath)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public QName getQName() {
+        return qname;
+    }
+
+    public void setUnknownNodes(List<UnknownSchemaNode> unknownNodes) {
+        this.unknownNodes.addAll(unknownNodes);
+    }
+
+}