blob: 78c4f64a5823c0d0f30d99c6efe266d807e88156 [file] [log] [blame]
Vidyashree Rama6a72b792016-03-29 12:00:42 +05301/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2016-present Open Networking Laboratory
Vidyashree Rama6a72b792016-03-29 12:00:42 +05303 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package org.onosproject.yangutils.translator.tojava.javamodel;
18
19import java.io.IOException;
Bharat saraswalcad0e652016-05-26 23:48:38 +053020import java.util.List;
Vinod Kumar Se4b9b0c2016-04-30 21:09:15 +053021
22import org.onosproject.yangutils.datamodel.RpcNotificationContainer;
Gaurav Agrawal56527662016-04-20 15:49:17 +053023import org.onosproject.yangutils.datamodel.YangInput;
Bharat saraswalcad0e652016-05-26 23:48:38 +053024import org.onosproject.yangutils.datamodel.YangLeaf;
25import org.onosproject.yangutils.datamodel.YangLeafList;
26import org.onosproject.yangutils.datamodel.YangLeavesHolder;
Gaurav Agrawal56527662016-04-20 15:49:17 +053027import org.onosproject.yangutils.datamodel.YangNode;
28import org.onosproject.yangutils.datamodel.YangOutput;
Vidyashree Rama6a72b792016-03-29 12:00:42 +053029import org.onosproject.yangutils.datamodel.YangRpc;
Bharat saraswalcad0e652016-05-26 23:48:38 +053030import org.onosproject.yangutils.datamodel.YangType;
Gaurav Agrawal56527662016-04-20 15:49:17 +053031import org.onosproject.yangutils.translator.exception.TranslatorException;
Gaurav Agrawal56527662016-04-20 15:49:17 +053032import org.onosproject.yangutils.translator.tojava.JavaAttributeInfo;
Vidyashree Rama6a72b792016-03-29 12:00:42 +053033import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
Gaurav Agrawal56527662016-04-20 15:49:17 +053034import org.onosproject.yangutils.translator.tojava.JavaFileInfo;
VinodKumarS-Huaweicb3a1f52016-05-10 17:58:57 +053035import org.onosproject.yangutils.translator.tojava.JavaFileInfoContainer;
VinodKumarS-Huaweicb3a1f52016-05-10 17:58:57 +053036import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo;
Vinod Kumar Se4b9b0c2016-04-30 21:09:15 +053037import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
VinodKumarS-Huaweicb3a1f52016-05-10 17:58:57 +053038import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFilesContainer;
39import org.onosproject.yangutils.translator.tojava.TempJavaFragmentFiles;
janani bde4ffab2016-04-15 16:18:30 +053040import org.onosproject.yangutils.translator.tojava.utils.YangPluginConfig;
Vidyashree Rama6a72b792016-03-29 12:00:42 +053041
Bharat saraswalcad0e652016-05-26 23:48:38 +053042import static org.onosproject.yangutils.datamodel.YangNodeType.LIST_NODE;
VinodKumarS-Huaweicb3a1f52016-05-10 17:58:57 +053043import static org.onosproject.yangutils.translator.tojava.JavaAttributeInfo.getAttributeInfoForTheData;
44import static org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo.getQualifiedTypeInfoOfCurNode;
Bharat saraswalcad0e652016-05-26 23:48:38 +053045import static org.onosproject.yangutils.translator.tojava.TempJavaFragmentFiles.resolveGroupingsQuailifiedInfo;
46import static org.onosproject.yangutils.translator.tojava.utils.AttributesJavaDataType.getJavaDataType;
47import static org.onosproject.yangutils.translator.tojava.utils.AttributesJavaDataType.getJavaImportClass;
48import static org.onosproject.yangutils.translator.tojava.utils.AttributesJavaDataType.getJavaImportPackage;
49import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getCamelCase;
janani b4a6711a2016-05-17 13:12:22 +053050import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getCapitalCase;
Gaurav Agrawal56527662016-04-20 15:49:17 +053051import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getParentNodeInGenCode;
52import static org.onosproject.yangutils.translator.tojava.utils.YangJavaModelUtils.updatePackageInfo;
53
Vidyashree Rama6a72b792016-03-29 12:00:42 +053054/**
Bharat saraswald9822e92016-04-05 15:13:44 +053055 * Represents rpc information extended to support java code generation.
Vidyashree Rama6a72b792016-03-29 12:00:42 +053056 */
Vinod Kumar Se4b9b0c2016-04-30 21:09:15 +053057public class YangJavaRpc
58 extends YangRpc
59 implements JavaCodeGenerator, JavaCodeGeneratorInfo {
Vidyashree Rama6a72b792016-03-29 12:00:42 +053060
61 /**
Gaurav Agrawal56527662016-04-20 15:49:17 +053062 * Contains the information of the java file being generated.
63 */
64 private JavaFileInfo javaFileInfo;
65
66 /**
Vinod Kumar Se4b9b0c2016-04-30 21:09:15 +053067 * Temproary file for code generation.
68 */
69 private TempJavaCodeFragmentFiles tempJavaCodeFragmentFiles;
70
Bharat saraswalcad0e652016-05-26 23:48:38 +053071 private boolean isInputLeafHolder;
72 private boolean isOutputLeafHolder;
73 private boolean isInputSingleChildHolder;
74 private boolean isOutputSingleChildHolder;
75
Vinod Kumar Se4b9b0c2016-04-30 21:09:15 +053076 /**
Gaurav Agrawal56527662016-04-20 15:49:17 +053077 * Creates an instance of YANG java rpc.
Vidyashree Rama6a72b792016-03-29 12:00:42 +053078 */
79 public YangJavaRpc() {
Gaurav Agrawal56527662016-04-20 15:49:17 +053080 super();
81 setJavaFileInfo(new JavaFileInfo());
Vidyashree Rama6a72b792016-03-29 12:00:42 +053082 }
83
84 /**
Gaurav Agrawal56527662016-04-20 15:49:17 +053085 * Returns the generated java file information.
86 *
87 * @return generated java file information
88 */
89 @Override
90 public JavaFileInfo getJavaFileInfo() {
91
92 if (javaFileInfo == null) {
93 throw new TranslatorException("missing java info in java datamodel node");
94 }
95 return javaFileInfo;
96 }
97
98 /**
99 * Sets the java file info object.
100 *
101 * @param javaInfo java file info object
102 */
103 @Override
104 public void setJavaFileInfo(JavaFileInfo javaInfo) {
105 javaFileInfo = javaInfo;
Vidyashree Rama6a72b792016-03-29 12:00:42 +0530106 }
Vinod Kumar Se4b9b0c2016-04-30 21:09:15 +0530107
108 @Override
109 public TempJavaCodeFragmentFiles getTempJavaCodeFragmentFiles() {
110 return tempJavaCodeFragmentFiles;
111 }
112
113 @Override
114 public void setTempJavaCodeFragmentFiles(TempJavaCodeFragmentFiles fileHandle) {
115 tempJavaCodeFragmentFiles = fileHandle;
116 }
Gaurav Agrawal56527662016-04-20 15:49:17 +0530117
Bharat saraswalcad0e652016-05-26 23:48:38 +0530118 /**
119 * Prepares the information for java code generation corresponding to YANG
120 * RPC info.
121 *
122 * @param yangPlugin YANG plugin config
123 * @throws TranslatorException translator operations fails
124 */
125 @Override
126 public void generateCodeEntry(YangPluginConfig yangPlugin) throws TranslatorException {
127
128 if (!(this instanceof JavaCodeGeneratorInfo)) {
129 // TODO:throw exception
130 }
131
132 // Add package information for rpc and create corresponding folder.
133 try {
134 updatePackageInfo(this, yangPlugin);
135 if (this.getChild() != null) {
136 processNodeEntry(this.getChild(), yangPlugin);
137 if (this.getChild().getNextSibling() != null) {
138 processNodeEntry(this.getChild().getNextSibling(), yangPlugin);
139 }
140 }
141 } catch (IOException e) {
142 throw new TranslatorException("Failed to prepare generate code entry for RPC node " + this.getName());
143 }
144 }
145
146 /**
147 * Creates a java file using the YANG RPC info.
148 *
149 * @throws TranslatorException translator operations fails
150 */
151 @Override
152 public void generateCodeExit() throws TranslatorException {
153 // Get the parent module/sub-module.
154 YangNode parent = getParentNodeInGenCode(this);
155
156 // Parent should be holder of rpc or notification.
157 if (!(parent instanceof RpcNotificationContainer)) {
158 throw new TranslatorException("parent node of rpc can only be module or sub-module");
159 }
160
161 /*
162 * Create attribute info for input and output of rpc and add it to the
163 * parent import list.
164 */
165
166 JavaAttributeInfo javaAttributeInfoOfInput = null;
167 JavaAttributeInfo javaAttributeInfoOfOutput = null;
168
169 // Get the child input and output node and obtain create java attribute
170 // info.
171 YangNode yangNode = this.getChild();
172 while (yangNode != null) {
173 if (yangNode instanceof YangInput) {
174 javaAttributeInfoOfInput = processNodeExit(yangNode, getJavaFileInfo().getPluginConfig());
175
176 } else if (yangNode instanceof YangOutput) {
177 javaAttributeInfoOfOutput = processNodeExit(yangNode, getJavaFileInfo().getPluginConfig());
178 } else {
179 // TODO throw exception
180 }
181 yangNode = yangNode.getNextSibling();
182 }
183
184 if (!(parent instanceof TempJavaCodeFragmentFilesContainer)) {
185 throw new TranslatorException("missing parent temp file handle");
186 }
187
188 /*
189 * Add the rpc information to the parent's service temp file.
190 */
191 try {
192 ((TempJavaCodeFragmentFilesContainer) parent).getTempJavaCodeFragmentFiles().getServiceTempFiles()
193 .addJavaSnippetInfoToApplicableTempFiles(javaAttributeInfoOfInput, javaAttributeInfoOfOutput,
194 ((JavaFileInfoContainer) parent).getJavaFileInfo().getPluginConfig(),
195 ((YangNode) this).getName(), isInputLeafHolder(), isOutputLeafHolder(),
196 isInputSingleChildHolder(), isOutputSingleChildHolder());
197 } catch (IOException e) {
198 throw new TranslatorException("Failed to generate code for RPC node " + this.getName());
199 }
200 // No file will be generated during RPC exit.
201 }
202
203 /**
204 * Creates an attribute info object corresponding to a data model node and
205 * return it.
206 *
207 * @param childNode child data model node(input / output) for which the java code generation
208 * is being handled
209 * @param currentNode parent node (module / sub-module) in which the child node is an attribute
210 * @return AttributeInfo attribute details required to add in temporary
211 * files
212 */
213 public JavaAttributeInfo getChildNodeAsAttributeInParentService(
214 YangNode childNode, YangNode currentNode) {
215
216 YangNode parentNode = getParentNodeInGenCode(currentNode);
217
218 String childNodeName = ((JavaFileInfoContainer) childNode).getJavaFileInfo().getJavaName();
219 /*
220 * Get the import info corresponding to the attribute for import in
221 * generated java files or qualified access
222 */
223 JavaQualifiedTypeInfo qualifiedTypeInfo = getQualifiedTypeInfoOfCurNode(currentNode,
224 getCapitalCase(childNodeName));
225 if (!(parentNode instanceof TempJavaCodeFragmentFilesContainer)) {
226 throw new TranslatorException("Parent node does not have file info");
227 }
228
229 TempJavaFragmentFiles tempJavaFragmentFiles;
230 tempJavaFragmentFiles = ((TempJavaCodeFragmentFilesContainer) parentNode)
231 .getTempJavaCodeFragmentFiles()
232 .getServiceTempFiles();
233
234 if (tempJavaFragmentFiles == null) {
235 throw new TranslatorException("Parent node does not have service file info");
236 }
237 boolean isQualified = addImportToService(qualifiedTypeInfo);
238 return getAttributeInfoForTheData(qualifiedTypeInfo, childNodeName, null, isQualified, false);
239 }
240
241 /**
242 * Process input/output nodes.
243 *
244 * @param node YANG node
245 * @param yangPluginConfig plugin configurations
246 */
247 private void processNodeEntry(YangNode node, YangPluginConfig yangPluginConfig) {
248 YangLeavesHolder holder = (YangLeavesHolder) node;
249 if (node.getChild() == null) {
250 if (holder.getListOfLeaf() != null && holder.getListOfLeafList().isEmpty()
251 && holder.getListOfLeaf().size() == 1) {
252 setCodeGenFlagForNode(node, false);
253 } else if (holder.getListOfLeaf().isEmpty() && holder.getListOfLeafList() != null
254 && holder.getListOfLeafList().size() == 1) {
255 setCodeGenFlagForNode(node, false);
256 } else {
257 setCodeGenFlagForNode(node, true);
258 }
259 } else if (node.getChild() != null && holder.getListOfLeaf().isEmpty()
260 && holder.getListOfLeafList().isEmpty()) {
261 if (getNumberOfChildNodes(node) == 1) {
262 setCodeGenFlagForNode(node, false);
263 } else {
264 setCodeGenFlagForNode(node, true);
265 }
266 } else {
267 setCodeGenFlagForNode(node, true);
268 }
269 }
270
271 /**
272 * Process input/output nodes.
273 *
274 * @param node YANG node
275 * @param yangPluginConfig plugin configurations
276 * @return java attribute info
277 */
278 private JavaAttributeInfo processNodeExit(YangNode node, YangPluginConfig yangPluginConfig) {
279 YangLeavesHolder holder = (YangLeavesHolder) node;
280 if (node.getChild() == null) {
281 if (holder.getListOfLeaf() != null && holder.getListOfLeafList().isEmpty()
282 && holder.getListOfLeaf().size() == 1) {
283 return processNodeWhenOnlyOneLeafIsPresent(node, yangPluginConfig);
284
285 } else if (holder.getListOfLeaf().isEmpty() && holder.getListOfLeafList() != null
286 && holder.getListOfLeafList().size() == 1) {
287 return processNodeWhenOnlyOneLeafListIsPresent(node, yangPluginConfig);
288 } else {
289 return processNodeWhenMultipleContaintsArePresent(node);
290 }
291 } else if (node.getChild() != null && holder.getListOfLeaf().isEmpty()
292 && holder.getListOfLeafList().isEmpty()) {
293 if (getNumberOfChildNodes(node) == 1) {
294 return processNodeWhenOnlyOneChildNodeIsPresent(node, yangPluginConfig);
295 } else {
296 return processNodeWhenMultipleContaintsArePresent(node);
297 }
298 } else {
299 return processNodeWhenMultipleContaintsArePresent(node);
300 }
301 }
302
303 /**
304 * Process input/output node when one leaf is present.
305 *
306 * @param node input/output node
307 * @param yangPluginConfig plugin configurations
308 * @return java attribute for node
309 */
310 private JavaAttributeInfo processNodeWhenOnlyOneLeafIsPresent(YangNode node,
311 YangPluginConfig yangPluginConfig) {
312
313 YangLeavesHolder holder = (YangLeavesHolder) node;
314 List<YangLeaf> listOfLeaves = holder.getListOfLeaf();
315
316 for (YangLeaf leaf : listOfLeaves) {
317 if (!(leaf instanceof JavaLeafInfoContainer)) {
318 throw new TranslatorException("Leaf does not have java information");
319 }
320 JavaLeafInfoContainer javaLeaf = (JavaLeafInfoContainer) leaf;
321 javaLeaf.setConflictResolveConfig(yangPluginConfig.getConflictResolver());
322 javaLeaf.updateJavaQualifiedInfo();
323 JavaAttributeInfo javaAttributeInfo = getAttributeInfoForTheData(
324 javaLeaf.getJavaQualifiedInfo(),
325 javaLeaf.getJavaName(yangPluginConfig.getConflictResolver()),
326 javaLeaf.getDataType(),
327 addTypeImport(javaLeaf.getDataType(), false, yangPluginConfig), false);
328 setLeafHolderFlag(node, true);
329 return javaAttributeInfo;
330 }
331 return null;
332 }
333
334 /**
335 * Process input/output node when one leaf list is present.
336 *
337 * @param node input/output node
338 * @param yangPluginConfig plugin configurations
339 * @return java attribute for node
340 */
341 private JavaAttributeInfo processNodeWhenOnlyOneLeafListIsPresent(YangNode node,
342 YangPluginConfig yangPluginConfig) {
343
344 YangLeavesHolder holder = (YangLeavesHolder) node;
345 List<YangLeafList> listOfLeafList = holder.getListOfLeafList();
346
347 for (YangLeafList leafList : listOfLeafList) {
348 if (!(leafList instanceof JavaLeafInfoContainer)) {
349 throw new TranslatorException("Leaf-list does not have java information");
350 }
351 JavaLeafInfoContainer javaLeaf = (JavaLeafInfoContainer) leafList;
352 javaLeaf.setConflictResolveConfig(yangPluginConfig.getConflictResolver());
353 javaLeaf.updateJavaQualifiedInfo();
354 ((TempJavaCodeFragmentFilesContainer) this.getParent()).getTempJavaCodeFragmentFiles()
355 .getServiceTempFiles().getJavaImportData().setIfListImported(true);
356 JavaAttributeInfo javaAttributeInfo = getAttributeInfoForTheData(
357 javaLeaf.getJavaQualifiedInfo(),
358 javaLeaf.getJavaName(yangPluginConfig.getConflictResolver()),
359 javaLeaf.getDataType(),
360 addTypeImport(javaLeaf.getDataType(), true, yangPluginConfig),
361 true);
362 setLeafHolderFlag(node, true);
363 return javaAttributeInfo;
364 }
365 return null;
366 }
367
368 /**
369 * Process input/output node when one child node is present.
370 *
371 * @param node input/output node
372 * @param yangPluginConfig plugin configurations
373 * @return java attribute for node
374 */
375 private JavaAttributeInfo processNodeWhenOnlyOneChildNodeIsPresent(YangNode node,
376 YangPluginConfig yangPluginConfig) {
377 JavaFileInfo rpcInfo = getJavaFileInfo();
378 String clsInfo = "";
379 JavaQualifiedTypeInfo childInfo = new JavaQualifiedTypeInfo();
380 if (node.getChild() instanceof YangJavaUses) {
381 childInfo = resolveGroupingsQuailifiedInfo(((YangJavaUses) node.getChild()).getRefGroup(),
382 yangPluginConfig);
383 clsInfo = getCapitalCase(getCamelCase(((YangJavaUses) node.getChild()).getRefGroup().getName(),
384 yangPluginConfig.getConflictResolver()));
385 } else {
386 String pkg = (rpcInfo.getPackage() + "." + rpcInfo.getJavaName() + "."
387 + getCamelCase(node.getName(), yangPluginConfig.getConflictResolver())).toLowerCase();
388 clsInfo = getCapitalCase(
389 getCamelCase(node.getChild().getName(), yangPluginConfig.getConflictResolver()));
390 childInfo.setPkgInfo(pkg);
391 childInfo.setClassInfo(clsInfo);
392 }
393 boolean isList = false;
394 if (node.getChild().getNodeType().equals(LIST_NODE)) {
395 isList = true;
396 }
397 boolean isQualified = addImportToService(childInfo);
398
399 JavaAttributeInfo javaAttributeInfo =
400 getAttributeInfoForTheData(childInfo, clsInfo, null, isQualified, isList);
401
402 setLeafHolderFlag(node, false);
403 setSingleChildHolderFlag(node, true);
404 return javaAttributeInfo;
405 }
406
407 /**
408 * Process input/output node when multiple leaf and child nodes are present.
409 *
410 * @param node input/output node
411 * @return java attribute for node
412 */
413 private JavaAttributeInfo processNodeWhenMultipleContaintsArePresent(YangNode node) {
414
415 setLeafHolderFlag(node, false);
416 setSingleChildHolderFlag(node, false);
417 return getChildNodeAsAttributeInParentService(node, this);
418 }
419
420 /**
421 * Adds type import to the RPC import list.
422 *
423 * @param type YANG type
424 * @param isList is list attribute
425 * @param pluginConfig plugin configurations
426 * @return type import to the RPC import list
427 */
428 private boolean addTypeImport(YangType<?> type, boolean isList, YangPluginConfig pluginConfig) {
429
430 String classInfo = getJavaImportClass(type, isList, pluginConfig.getConflictResolver());
431 if (classInfo == null) {
432 classInfo = getJavaDataType(type);
433 return false;
434 } else {
435 classInfo = getJavaImportClass(type, isList, pluginConfig.getConflictResolver());
436 String pkgInfo = getJavaImportPackage(type, isList, pluginConfig.getConflictResolver());
437 JavaQualifiedTypeInfo importInfo = new JavaQualifiedTypeInfo();
438 importInfo.setPkgInfo(pkgInfo);
439 importInfo.setClassInfo(classInfo);
440 if (!((JavaFileInfoContainer) this.getParent()).getJavaFileInfo().getJavaName().equals(classInfo)) {
441 return addImportToService(importInfo);
442 } else {
443 return true;
444 }
445 }
446 }
447
448 /**
449 * Adds to service class import list.
450 *
451 * @param importInfo import info
452 * @return true or false
453 */
454 private boolean addImportToService(JavaQualifiedTypeInfo importInfo) {
455 if (((TempJavaCodeFragmentFilesContainer) this.getParent()).getTempJavaCodeFragmentFiles()
456 .getServiceTempFiles().getJavaImportData().addImportInfo(importInfo)) {
457 return !((TempJavaCodeFragmentFilesContainer) this.getParent()).getTempJavaCodeFragmentFiles()
458 .getServiceTempFiles().getJavaImportData().getImportSet().contains(importInfo);
459 } else {
460 return true;
461 }
462 }
463
464 /**
465 * Sets leaf holder flag for input/output.
466 *
467 * @param node input/output node
468 * @param flag true or false
469 */
470 private void setLeafHolderFlag(YangNode node, boolean flag) {
471 if (node instanceof YangJavaInput) {
472 setInputLeafHolder(flag);
473 } else {
474 setOutputLeafHolder(flag);
475 }
476 }
477
478 /**
479 * Sets sing child holder flag for input/output.
480 *
481 * @param node input/output node
482 * @param flag true or false
483 */
484 private void setSingleChildHolderFlag(YangNode node, boolean flag) {
485 if (node instanceof YangJavaInput) {
486 setInputSingleChildHolder(flag);
487 } else {
488 setOutputSingleChildHolder(flag);
489 }
490 }
491
492 /**
493 * Sets code generator flag for input and output.
494 *
495 * @param node YANG node
496 * @param flag cod generator flag
497 */
498 private void setCodeGenFlagForNode(YangNode node, boolean flag) {
499 if (node instanceof YangJavaInput) {
500 ((YangJavaInput) node).setCodeGenFlag(flag);
501 } else {
502 ((YangJavaOutput) node).setCodeGenFlag(flag);
503 }
504
505 }
506
507 /**
508 * Counts the number of child nodes of a YANG node.
509 *
510 * @param node YANG node
511 * @return count of children
512 */
513 private int getNumberOfChildNodes(YangNode node) {
514 YangNode tempNode = node.getChild();
515 int count = 0;
516 if (tempNode != null) {
517 count = 1;
518 }
519 while (tempNode != null) {
520
521 tempNode = tempNode.getNextSibling();
522 if (tempNode != null) {
523 count++;
524 }
525 }
526 return count;
527 }
528
529 /**
530 * Returns true if input is a leaf holder.
531 *
532 * @return true if input is a leaf holder
533 */
534 public boolean isInputLeafHolder() {
535 return isInputLeafHolder;
536 }
537
538 /**
539 * Sets true if input is a leaf holder.
540 *
541 * @param isInputLeafHolder true if input is a leaf holder
542 */
543 public void setInputLeafHolder(boolean isInputLeafHolder) {
544 this.isInputLeafHolder = isInputLeafHolder;
545 }
546
547 /**
548 * Returns true if output is a leaf holder.
549 *
550 * @return true if output is a leaf holder
551 */
552 public boolean isOutputLeafHolder() {
553 return isOutputLeafHolder;
554 }
555
556 /**
557 * Sets true if output is a leaf holder.
558 *
559 * @param isOutputLeafHolder true if output is a leaf holder
560 */
561 public void setOutputLeafHolder(boolean isOutputLeafHolder) {
562 this.isOutputLeafHolder = isOutputLeafHolder;
563 }
564
565 /**
566 * Returns true if input is single child holder.
567 *
568 * @return true if input is single child holder
569 */
570 public boolean isInputSingleChildHolder() {
571 return isInputSingleChildHolder;
572 }
573
574 /**
575 * Sets true if input is single child holder.
576 *
577 * @param isInputSingleChildHolder true if input is single child holder
578 */
579 public void setInputSingleChildHolder(boolean isInputSingleChildHolder) {
580 this.isInputSingleChildHolder = isInputSingleChildHolder;
581 }
582
583 /**
584 * Returns true if output is single child holder.
585 *
586 * @return true if output is single child holder
587 */
588 public boolean isOutputSingleChildHolder() {
589 return isOutputSingleChildHolder;
590 }
591
592 /**
593 * Sets true if output is single child holder.
594 *
595 * @param isOutputSingleChildHolder true if output is single child holder
596 */
597 public void setOutputSingleChildHolder(boolean isOutputSingleChildHolder) {
598 this.isOutputSingleChildHolder = isOutputSingleChildHolder;
599 }
600
Bharat saraswalab4c6ba2016-05-17 14:19:38 +0530601}