Merge "Introduce Identifiables"
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / 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.yangtools.yang.parser.util;
9
10 import org.opendaylight.yangtools.yang.model.api.MustDefinition;
11 import org.opendaylight.yangtools.yang.parser.builder.api.AbstractBuilder;
12
13 public final class RefineHolder extends AbstractBuilder {
14     private final String name;
15     private String defaultStr;
16     private String description;
17     private String reference;
18     private Boolean config;
19     private Boolean mandatory;
20     private Boolean presence;
21     private MustDefinition must;
22     private Integer minElements;
23     private Integer maxElements;
24
25     public RefineHolder(final String moduleName, final int line, final String name) {
26         super(moduleName, line);
27         this.name = name;
28     }
29
30     public String getDefaultStr() {
31         return defaultStr;
32     }
33
34     public void setDefaultStr(final String defaultStr) {
35         this.defaultStr = defaultStr;
36     }
37
38     public String getDescription() {
39         return description;
40     }
41
42     public void setDescription(final String description) {
43         this.description = description;
44     }
45
46     public String getReference() {
47         return reference;
48     }
49
50     public void setReference(final String reference) {
51         this.reference = reference;
52     }
53
54     public Boolean isConfiguration() {
55         return config;
56     }
57
58     public void setConfiguration(final Boolean config) {
59         this.config = config;
60     }
61
62     public Boolean isMandatory() {
63         return mandatory;
64     }
65
66     public void setMandatory(Boolean mandatory) {
67         this.mandatory = mandatory;
68     }
69
70     public Boolean isPresence() {
71         return presence;
72     }
73
74     public void setPresence(Boolean presence) {
75         this.presence = presence;
76     }
77
78     public MustDefinition getMust() {
79         return must;
80     }
81
82     public void setMust(MustDefinition must) {
83         this.must = must;
84     }
85
86     public Integer getMinElements() {
87         return minElements;
88     }
89
90     public void setMinElements(Integer minElements) {
91         this.minElements = minElements;
92     }
93
94     public Integer getMaxElements() {
95         return maxElements;
96     }
97
98     public void setMaxElements(Integer maxElements) {
99         this.maxElements = maxElements;
100     }
101
102     public String getName() {
103         return name;
104     }
105
106     @Override
107     public Object build() {
108         return null;
109     }
110
111     @Override
112     public int hashCode() {
113         final int prime = 31;
114         int result = 1;
115         result = prime * result + ((addedUnknownNodes == null) ? 0 : addedUnknownNodes.hashCode());
116         result = prime * result + ((config == null) ? 0 : config.hashCode());
117         result = prime * result + ((defaultStr == null) ? 0 : defaultStr.hashCode());
118         result = prime * result + ((description == null) ? 0 : description.hashCode());
119         result = prime * result + ((mandatory == null) ? 0 : mandatory.hashCode());
120         result = prime * result + ((maxElements == null) ? 0 : maxElements.hashCode());
121         result = prime * result + ((minElements == null) ? 0 : minElements.hashCode());
122         result = prime * result + ((must == null) ? 0 : must.hashCode());
123         result = prime * result + ((name == null) ? 0 : name.hashCode());
124         result = prime * result + ((getParent() == null) ? 0 : getParent().hashCode());
125         result = prime * result + ((presence == null) ? 0 : presence.hashCode());
126         result = prime * result + ((reference == null) ? 0 : reference.hashCode());
127         return result;
128     }
129
130     @Override
131     public boolean equals(Object obj) {
132         if (this == obj) {
133             return true;
134         }
135         if (obj == null) {
136             return false;
137         }
138         if (getClass() != obj.getClass()) {
139             return false;
140         }
141         RefineHolder other = (RefineHolder) obj;
142         if (addedUnknownNodes == null) {
143             if (other.addedUnknownNodes != null) {
144                 return false;
145             }
146         } else if (!addedUnknownNodes.equals(other.addedUnknownNodes)) {
147             return false;
148         }
149         if (config == null) {
150             if (other.config != null) {
151                 return false;
152             }
153         } else if (!config.equals(other.config)) {
154             return false;
155         }
156         if (defaultStr == null) {
157             if (other.defaultStr != null) {
158                 return false;
159             }
160         } else if (!defaultStr.equals(other.defaultStr)) {
161             return false;
162         }
163         if (description == null) {
164             if (other.description != null) {
165                 return false;
166             }
167         } else if (!description.equals(other.description)) {
168             return false;
169         }
170         if (mandatory == null) {
171             if (other.mandatory != null) {
172                 return false;
173             }
174         } else if (!mandatory.equals(other.mandatory)) {
175             return false;
176         }
177         if (maxElements == null) {
178             if (other.maxElements != null) {
179                 return false;
180             }
181         } else if (!maxElements.equals(other.maxElements)) {
182             return false;
183         }
184         if (minElements == null) {
185             if (other.minElements != null) {
186                 return false;
187             }
188         } else if (!minElements.equals(other.minElements)) {
189             return false;
190         }
191         if (must == null) {
192             if (other.must != null) {
193                 return false;
194             }
195         } else if (!must.equals(other.must)) {
196             return false;
197         }
198         if (name == null) {
199             if (other.name != null) {
200                 return false;
201             }
202         } else if (!name.equals(other.name)) {
203             return false;
204         }
205         if (getParent() == null) {
206             if (other.getParent() != null) {
207                 return false;
208             }
209         } else if (!getParent().equals(other.getParent())) {
210             return false;
211         }
212         if (presence == null) {
213             if (other.presence != null) {
214                 return false;
215             }
216         } else if (!presence.equals(other.presence)) {
217             return false;
218         }
219         if (reference == null) {
220             if (other.reference != null) {
221                 return false;
222             }
223         } else if (!reference.equals(other.reference)) {
224             return false;
225         }
226         return true;
227     }
228
229     @Override
230     public String toString() {
231         return "refine " + name;
232     }
233
234 }