001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041: /**
042: * This generated bean class LockRegion
043: * matches the schema element '_lock-region'.
044: *
045: * Generated on Mon Sep 27 16:53:12 PDT 2004
046: */package org.netbeans.modules.collab.channel.filesharing.msgbean;
047:
048: public class LockRegion {
049: private Use2phase _Use2phase;
050: private FileGroups _FileGroups;
051: private java.util.List _LockRegionData = new java.util.ArrayList(); // List<LockRegionData>
052:
053: public LockRegion() {
054: _FileGroups = new FileGroups();
055: }
056:
057: // Deep copy
058: public LockRegion(
059: org.netbeans.modules.collab.channel.filesharing.msgbean.LockRegion source) {
060: _Use2phase = new org.netbeans.modules.collab.channel.filesharing.msgbean.Use2phase(
061: source._Use2phase);
062: _FileGroups = new org.netbeans.modules.collab.channel.filesharing.msgbean.FileGroups(
063: source._FileGroups);
064:
065: for (java.util.Iterator it = source._LockRegionData.iterator(); it
066: .hasNext();) {
067: _LockRegionData
068: .add(new org.netbeans.modules.collab.channel.filesharing.msgbean.LockRegionData(
069: (org.netbeans.modules.collab.channel.filesharing.msgbean.LockRegionData) it
070: .next()));
071: }
072: }
073:
074: // This attribute is optional
075: public void setUse2phase(
076: org.netbeans.modules.collab.channel.filesharing.msgbean.Use2phase value) {
077: _Use2phase = value;
078: }
079:
080: public org.netbeans.modules.collab.channel.filesharing.msgbean.Use2phase getUse2phase() {
081: return _Use2phase;
082: }
083:
084: // This attribute is mandatory
085: public void setFileGroups(
086: org.netbeans.modules.collab.channel.filesharing.msgbean.FileGroups value) {
087: _FileGroups = value;
088: }
089:
090: public org.netbeans.modules.collab.channel.filesharing.msgbean.FileGroups getFileGroups() {
091: return _FileGroups;
092: }
093:
094: // This attribute is an array containing at least one element
095: public void setLockRegionData(
096: org.netbeans.modules.collab.channel.filesharing.msgbean.LockRegionData[] value) {
097: if (value == null) {
098: value = new LockRegionData[0];
099: }
100:
101: _LockRegionData.clear();
102:
103: for (int i = 0; i < value.length; ++i) {
104: _LockRegionData.add(value[i]);
105: }
106: }
107:
108: public void setLockRegionData(
109: int index,
110: org.netbeans.modules.collab.channel.filesharing.msgbean.LockRegionData value) {
111: _LockRegionData.set(index, value);
112: }
113:
114: public org.netbeans.modules.collab.channel.filesharing.msgbean.LockRegionData[] getLockRegionData() {
115: LockRegionData[] arr = new LockRegionData[_LockRegionData
116: .size()];
117:
118: return (LockRegionData[]) _LockRegionData.toArray(arr);
119: }
120:
121: public java.util.List fetchLockRegionDataList() {
122: return _LockRegionData;
123: }
124:
125: public org.netbeans.modules.collab.channel.filesharing.msgbean.LockRegionData getLockRegionData(
126: int index) {
127: return (LockRegionData) _LockRegionData.get(index);
128: }
129:
130: // Return the number of lockRegionData
131: public int sizeLockRegionData() {
132: return _LockRegionData.size();
133: }
134:
135: public int addLockRegionData(
136: org.netbeans.modules.collab.channel.filesharing.msgbean.LockRegionData value) {
137: _LockRegionData.add(value);
138:
139: return _LockRegionData.size() - 1;
140: }
141:
142: // Search from the end looking for @param value, and then remove it.
143: public int removeLockRegionData(
144: org.netbeans.modules.collab.channel.filesharing.msgbean.LockRegionData value) {
145: int pos = _LockRegionData.indexOf(value);
146:
147: if (pos >= 0) {
148: _LockRegionData.remove(pos);
149: }
150:
151: return pos;
152: }
153:
154: public void writeNode(java.io.Writer out, String nodeName,
155: String indent) throws java.io.IOException {
156: out.write(indent);
157: out.write("<");
158: out.write(nodeName);
159: out.write(">\n");
160:
161: String nextIndent = indent + " ";
162:
163: if (_Use2phase != null) {
164: _Use2phase.writeNode(out, "use2phase", nextIndent);
165: }
166:
167: if (_FileGroups != null) {
168: _FileGroups.writeNode(out, "file-groups", nextIndent);
169: }
170:
171: for (java.util.Iterator it = _LockRegionData.iterator(); it
172: .hasNext();) {
173: org.netbeans.modules.collab.channel.filesharing.msgbean.LockRegionData element = (org.netbeans.modules.collab.channel.filesharing.msgbean.LockRegionData) it
174: .next();
175:
176: if (element != null) {
177: element.writeNode(out, "lock-region-data", nextIndent);
178: }
179: }
180:
181: out.write(indent);
182: out.write("</" + nodeName + ">\n");
183: }
184:
185: public void readNode(org.w3c.dom.Node node) {
186: org.w3c.dom.NodeList children = node.getChildNodes();
187:
188: for (int i = 0, size = children.getLength(); i < size; ++i) {
189: org.w3c.dom.Node childNode = children.item(i);
190: String childNodeName = ((childNode.getLocalName() == null) ? childNode
191: .getNodeName().intern()
192: : childNode.getLocalName().intern());
193: String childNodeValue = "";
194:
195: if (childNode.getFirstChild() != null) {
196: childNodeValue = childNode.getFirstChild()
197: .getNodeValue();
198: }
199:
200: if (childNodeName == "use2phase") {
201: _Use2phase = new org.netbeans.modules.collab.channel.filesharing.msgbean.Use2phase();
202: _Use2phase.readNode(childNode);
203: } else if (childNodeName == "file-groups") {
204: _FileGroups = new org.netbeans.modules.collab.channel.filesharing.msgbean.FileGroups();
205: _FileGroups.readNode(childNode);
206: } else if (childNodeName == "lock-region-data") {
207: LockRegionData aLockRegionData = new org.netbeans.modules.collab.channel.filesharing.msgbean.LockRegionData();
208: aLockRegionData.readNode(childNode);
209: _LockRegionData.add(aLockRegionData);
210: } else {
211: // Found extra unrecognized childNode
212: }
213: }
214: }
215:
216: public void changePropertyByName(String name, Object value) {
217: if (name == null) {
218: return;
219: }
220:
221: name = name.intern();
222:
223: if (name == "use2phase") {
224: setUse2phase((Use2phase) value);
225: } else if (name == "fileGroups") {
226: setFileGroups((FileGroups) value);
227: } else if (name == "lockRegionData") {
228: addLockRegionData((LockRegionData) value);
229: } else if (name == "lockRegionData[]") {
230: setLockRegionData((LockRegionData[]) value);
231: } else {
232: throw new IllegalArgumentException(name
233: + " is not a valid property name for LockRegion");
234: }
235: }
236:
237: public Object fetchPropertyByName(String name) {
238: if (name == "use2phase") {
239: return getUse2phase();
240: }
241:
242: if (name == "fileGroups") {
243: return getFileGroups();
244: }
245:
246: if (name == "lockRegionData[]") {
247: return getLockRegionData();
248: }
249:
250: throw new IllegalArgumentException(name
251: + " is not a valid property name for LockRegion");
252: }
253:
254: // Return an array of all of the properties that are beans and are set.
255: public java.lang.Object[] childBeans(boolean recursive) {
256: java.util.List children = new java.util.LinkedList();
257: childBeans(recursive, children);
258:
259: java.lang.Object[] result = new java.lang.Object[children
260: .size()];
261:
262: return (java.lang.Object[]) children.toArray(result);
263: }
264:
265: // Put all child beans into the beans list.
266: public void childBeans(boolean recursive, java.util.List beans) {
267: if (_Use2phase != null) {
268: if (recursive) {
269: _Use2phase.childBeans(true, beans);
270: }
271: beans.add(_Use2phase);
272: }
273:
274: if (_FileGroups != null) {
275: if (recursive) {
276: _FileGroups.childBeans(true, beans);
277: }
278:
279: beans.add(_FileGroups);
280: }
281:
282: for (java.util.Iterator it = _LockRegionData.iterator(); it
283: .hasNext();) {
284: org.netbeans.modules.collab.channel.filesharing.msgbean.LockRegionData element = (org.netbeans.modules.collab.channel.filesharing.msgbean.LockRegionData) it
285: .next();
286:
287: if (element != null) {
288: if (recursive) {
289: element.childBeans(true, beans);
290: }
291:
292: beans.add(element);
293: }
294: }
295: }
296:
297: public boolean equals(Object o) {
298: if (o == this ) {
299: return true;
300: }
301:
302: if (!(o instanceof org.netbeans.modules.collab.channel.filesharing.msgbean.LockRegion)) {
303: return false;
304: }
305:
306: org.netbeans.modules.collab.channel.filesharing.msgbean.LockRegion inst = (org.netbeans.modules.collab.channel.filesharing.msgbean.LockRegion) o;
307:
308: if (!(_Use2phase == null ? inst._Use2phase == null : _Use2phase
309: .equals(inst._Use2phase))) {
310: return false;
311: }
312:
313: if (!((_FileGroups == null) ? (inst._FileGroups == null)
314: : _FileGroups.equals(inst._FileGroups))) {
315: return false;
316: }
317:
318: if (sizeLockRegionData() != inst.sizeLockRegionData()) {
319: return false;
320: }
321:
322: // Compare every element.
323: for (java.util.Iterator it = _LockRegionData.iterator(), it2 = inst._LockRegionData
324: .iterator(); it.hasNext() && it2.hasNext();) {
325: org.netbeans.modules.collab.channel.filesharing.msgbean.LockRegionData element = (org.netbeans.modules.collab.channel.filesharing.msgbean.LockRegionData) it
326: .next();
327: org.netbeans.modules.collab.channel.filesharing.msgbean.LockRegionData element2 = (org.netbeans.modules.collab.channel.filesharing.msgbean.LockRegionData) it2
328: .next();
329:
330: if (!((element == null) ? (element2 == null) : element
331: .equals(element2))) {
332: return false;
333: }
334: }
335:
336: return true;
337: }
338:
339: public int hashCode() {
340: int result = 17;
341: result = 37 * result
342: + (_Use2phase == null ? 0 : _Use2phase.hashCode());
343: result = (37 * result)
344: + ((_FileGroups == null) ? 0 : _FileGroups.hashCode());
345: result = (37 * result)
346: + ((_LockRegionData == null) ? 0 : _LockRegionData
347: .hashCode());
348:
349: return result;
350: }
351: }
|