001: // @@
002: // @@
003: /*
004: * Wi.Ser Framework
005: *
006: * Version: 1.8.1, 20-September-2007
007: * Copyright (C) 2005 Dirk von der Weiden <dvdw@imail.de>
008: *
009: * This library is free software; you can redistribute it and/or
010: * modify it under the terms of the GNU Lesser General Public
011: * License as published by the Free Software Foundation; either
012: * version 2 of the License, or (at your option) any later version.
013: *
014: * This library is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
017: * Lesser General Public License for more details.
018: *
019: * You should have received a copy of the GNU Lesser General Public
020: * License along with this library located in LGPL.txt in the
021: * license directory; if not, write to the
022: * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
023: * Boston, MA 02111-1307, USA.
024: *
025: * If this agreement does not cover your requirements, please contact us
026: * via email to get detailed information about the commercial license
027: * or our service offerings!
028: *
029: */
030: // @@
031: package de.ug2t.model.values;
032:
033: import java.util.*;
034:
035: public class MoChildDescriptor {
036: private static final int UNLIMITED = -1;
037:
038: private boolean pem_isReference = false;
039: private int pem_maxInst = MoChildDescriptor.UNLIMITED;
040: private int pem_minInst = 0;
041: private boolean pem_mapWithParent2Ui = true;
042:
043: /**
044: * <p>
045: * Does...
046: * </p>
047: * <p>
048: *
049: * @return a Type with
050: * </p>
051: * <p>
052: * @param
053: * </p>
054: */
055: public boolean getPem_isReference() {
056: return pem_isReference;
057: }
058:
059: /**
060: * <p>
061: * Does...
062: * </p>
063: * <p>
064: *
065: * @return a Type with
066: * </p>
067: * <p>
068: * @param
069: * </p>
070: */
071: public int getPem_maxInst() {
072: return pem_maxInst;
073: }
074:
075: /**
076: * <p>
077: * Does...
078: * </p>
079: * <p>
080: *
081: * @return a Type with
082: * </p>
083: * <p>
084: * @param
085: * </p>
086: */
087: public int getPem_minInst() {
088: return pem_minInst;
089: }
090:
091: /**
092: * <p>
093: * Does...
094: * </p>
095: * <p>
096: *
097: * @return a Type with
098: * </p>
099: * <p>
100: * @param
101: * </p>
102: */
103: public void setPem_isReference(boolean b) {
104: pem_isReference = b;
105: }
106:
107: /**
108: * <p>
109: * Does...
110: * </p>
111: * <p>
112: *
113: * @return a Type with
114: * </p>
115: * <p>
116: * @param
117: * </p>
118: */
119: public void setPem_maxInst(int i) {
120: pem_maxInst = i;
121: }
122:
123: /**
124: * <p>
125: * Does...
126: * </p>
127: * <p>
128: *
129: * @return a Type with
130: * </p>
131: * <p>
132: * @param
133: * </p>
134: */
135: public void setPem_minInst(int i) {
136: pem_minInst = i;
137: }
138:
139: public boolean pcmf_isManatory() {
140: if (this .pem_minInst > 0)
141: return (true);
142: else
143: return (false);
144: }
145:
146: /**
147: * <p>
148: * Does...
149: * </p>
150: * <p>
151: *
152: * @return a Type with
153: * </p>
154: * <p>
155: * @param
156: * </p>
157: */
158: public boolean isPem_mapWithParent2Ui() {
159: return pem_mapWithParent2Ui;
160: }
161:
162: /**
163: * <p>
164: * Does...
165: * </p>
166: * <p>
167: *
168: * @return a Type with
169: * </p>
170: * <p>
171: * @param
172: * </p>
173: */
174: public void setPem_mapWithParent2Ui(boolean b) {
175: pem_mapWithParent2Ui = b;
176: }
177:
178: protected Object clone() {
179: MoChildDescriptor l_new = new MoChildDescriptor();
180: l_new.setPem_isReference(this .getPem_isReference());
181: l_new.setPem_maxInst(this .getPem_maxInst());
182: l_new.setPem_minInst(this .getPem_minInst());
183: l_new.setPem_isReference(this .getPem_isReference());
184:
185: return (l_new);
186: }
187:
188: public static void pcmf_copyDescs(IMoValueContainer xSource,
189: IMoValueContainer xTarget) {
190: Iterator l_it = xSource.pcmf_getSubValueNameIt();
191: while (l_it.hasNext()) {
192: String l_name = l_it.next().toString();
193: MoChildDescriptor l_desc = xSource.pcmf_getDesc(l_name);
194:
195: if (l_desc != null)
196: xTarget.pcmf_addDesc(l_name, (MoChildDescriptor) l_desc
197: .clone());
198:
199: Object l_sSource = xSource.pcmf_getModelValue(l_name);
200: Object l_sTarget = xTarget.pcmf_getModelValue(l_name);
201:
202: if (l_sTarget instanceof IMoValueContainer
203: && l_sSource instanceof IMoValueContainer)
204: MoChildDescriptor.pcmf_copyDescs(
205: (IMoValueContainer) l_sSource,
206: (IMoValueContainer) l_sTarget);
207: }
208: }
209: }
|