Fixed a bug to block the creation of a static host on an ISL port, removed the code...
[controller.git] / opendaylight / sal / yang-prototype / code-generator / yang-model-parser-impl / src / main / java / org / opendaylight / controller / yang / parser / util / RefineHolder.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.yang.parser.util;
9
10 import java.util.ArrayList;
11 import java.util.List;
12
13 import org.opendaylight.controller.yang.model.api.MustDefinition;
14 import org.opendaylight.controller.yang.parser.builder.api.Builder;
15 import org.opendaylight.controller.yang.parser.builder.api.ConfigNode;
16 import org.opendaylight.controller.yang.parser.builder.impl.UnknownSchemaNodeBuilder;
17
18 public final class RefineHolder implements Builder, ConfigNode {
19     private Builder parent;
20     private final int line;
21     private final String name;
22     private String defaultStr;
23     private String description;
24     private String reference;
25     private Boolean config;
26     private Boolean mandatory;
27     private Boolean presence;
28     private MustDefinition must;
29     private Integer minElements;
30     private Integer maxElements;
31     private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
32
33     public RefineHolder(final int line, final String name) {
34         this.name = name;
35         this.line = line;
36     }
37
38     @Override
39     public int getLine() {
40         return line;
41     }
42
43     @Override
44     public Builder getParent() {
45         return parent;
46     }
47
48     @Override
49     public void setParent(final Builder parent) {
50         this.parent = parent;
51     }
52
53     public String getDefaultStr() {
54         return defaultStr;
55     }
56
57     public void setDefaultStr(final String defaultStr) {
58         this.defaultStr = defaultStr;
59     }
60
61     public String getDescription() {
62         return description;
63     }
64
65     public void setDescription(final String description) {
66         this.description = description;
67     }
68
69     public String getReference() {
70         return reference;
71     }
72
73     public void setReference(final String reference) {
74         this.reference = reference;
75     }
76
77     @Override
78     public Boolean isConfiguration() {
79         return config;
80     }
81
82     @Override
83     public void setConfiguration(final Boolean config) {
84         this.config = config;
85     }
86
87     public Boolean isMandatory() {
88         return mandatory;
89     }
90
91     public void setMandatory(Boolean mandatory) {
92         this.mandatory = mandatory;
93     }
94
95     public Boolean isPresence() {
96         return presence;
97     }
98
99     public void setPresence(Boolean presence) {
100         this.presence = presence;
101     }
102
103     public MustDefinition getMust() {
104         return must;
105     }
106
107     public void setMust(MustDefinition must) {
108         this.must = must;
109     }
110
111     public Integer getMinElements() {
112         return minElements;
113     }
114
115     public void setMinElements(Integer minElements) {
116         this.minElements = minElements;
117     }
118
119     public Integer getMaxElements() {
120         return maxElements;
121     }
122
123     public void setMaxElements(Integer maxElements) {
124         this.maxElements = maxElements;
125     }
126
127     public String getName() {
128         return name;
129     }
130
131     public List<UnknownSchemaNodeBuilder> getUnknownNodes() {
132         return addedUnknownNodes;
133     }
134
135     public void addUnknownSchemaNode(UnknownSchemaNodeBuilder unknownNode) {
136         addedUnknownNodes.add(unknownNode);
137     }
138
139     @Override
140     public Object build() {
141         return null;
142     }
143
144     @Override
145     public int hashCode() {
146         final int prime = 31;
147         int result = 1;
148         result = prime * result + ((addedUnknownNodes == null) ? 0 : addedUnknownNodes.hashCode());
149         result = prime * result + ((config == null) ? 0 : config.hashCode());
150         result = prime * result + ((defaultStr == null) ? 0 : defaultStr.hashCode());
151         result = prime * result + ((description == null) ? 0 : description.hashCode());
152         result = prime * result + ((mandatory == null) ? 0 : mandatory.hashCode());
153         result = prime * result + ((maxElements == null) ? 0 : maxElements.hashCode());
154         result = prime * result + ((minElements == null) ? 0 : minElements.hashCode());
155         result = prime * result + ((must == null) ? 0 : must.hashCode());
156         result = prime * result + ((name == null) ? 0 : name.hashCode());
157         result = prime * result + ((parent == null) ? 0 : parent.hashCode());
158         result = prime * result + ((presence == null) ? 0 : presence.hashCode());
159         result = prime * result + ((reference == null) ? 0 : reference.hashCode());
160         return result;
161     }
162
163     @Override
164     public boolean equals(Object obj) {
165         if (this == obj)
166             return true;
167         if (obj == null)
168             return false;
169         if (getClass() != obj.getClass())
170             return false;
171         RefineHolder other = (RefineHolder) obj;
172         if (addedUnknownNodes == null) {
173             if (other.addedUnknownNodes != null)
174                 return false;
175         } else if (!addedUnknownNodes.equals(other.addedUnknownNodes))
176             return false;
177         if (config == null) {
178             if (other.config != null)
179                 return false;
180         } else if (!config.equals(other.config))
181             return false;
182         if (defaultStr == null) {
183             if (other.defaultStr != null)
184                 return false;
185         } else if (!defaultStr.equals(other.defaultStr))
186             return false;
187         if (description == null) {
188             if (other.description != null)
189                 return false;
190         } else if (!description.equals(other.description))
191             return false;
192         if (mandatory == null) {
193             if (other.mandatory != null)
194                 return false;
195         } else if (!mandatory.equals(other.mandatory))
196             return false;
197         if (maxElements == null) {
198             if (other.maxElements != null)
199                 return false;
200         } else if (!maxElements.equals(other.maxElements))
201             return false;
202         if (minElements == null) {
203             if (other.minElements != null)
204                 return false;
205         } else if (!minElements.equals(other.minElements))
206             return false;
207         if (must == null) {
208             if (other.must != null)
209                 return false;
210         } else if (!must.equals(other.must))
211             return false;
212         if (name == null) {
213             if (other.name != null)
214                 return false;
215         } else if (!name.equals(other.name))
216             return false;
217         if (parent == null) {
218             if (other.parent != null)
219                 return false;
220         } else if (!parent.equals(other.parent))
221             return false;
222         if (presence == null) {
223             if (other.presence != null)
224                 return false;
225         } else if (!presence.equals(other.presence))
226             return false;
227         if (reference == null) {
228             if (other.reference != null)
229                 return false;
230         } else if (!reference.equals(other.reference))
231             return false;
232         return true;
233     }
234
235     @Override
236     public String toString() {
237         return "revine " + name;
238     }
239
240 }