Yang parser refactoring.
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / builder / api / AbstractSchemaNodeBuilder.java
index 439a3b9a1b9b7205371ba97ac7a8d2c10744450a..607622f33a7d336d7f795d7fae53e63842fcad5a 100644 (file)
@@ -11,73 +11,68 @@ import java.util.List;
 \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 final 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
-    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
+    public int hashCode() {\r
+        final int prime = 31;\r
+        int result = super.hashCode();\r
+        result = prime * result + ((parentBuilder == null) ? 0 : parentBuilder.hashCode());\r
+        result = prime * result + ((schemaPath == null) ? 0 : schemaPath.hashCode());\r
+        return result;\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
+    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 (parentBuilder == null) {\r
+            if (other.parentBuilder != null) {\r
+                return false;\r
+            }\r
+        } else if (!parentBuilder.equals(other.parentBuilder)) {\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
     @Override\r
-    public void setStatus(Status status) {\r
-        if (status != null) {\r
-            this.status = status;\r
-        }\r
+    public QName getQName() {\r
+        return qname;\r
     }\r
 \r
     public void setUnknownNodes(List<UnknownSchemaNode> unknownNodes) {\r
-        this.unknownNodes = unknownNodes;\r
+        this.unknownNodes.addAll(unknownNodes);\r
     }\r
 \r
 }\r