PageRenderTime 60ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/ojc-core/encodersl/encoder-coco/src/com/sun/encoder/coco/model/CocoDescriptionEntry.java

https://bitbucket.org/pymma/openesb-components
Java | 1525 lines | 995 code | 117 blank | 413 comment | 183 complexity | 6520f66223793898dc5edf891c3186b4 MD5 | raw file
  1. /*
  2. * BEGIN_HEADER - DO NOT EDIT
  3. *
  4. * The contents of this file are subject to the terms
  5. * of the Common Development and Distribution License
  6. * (the "License"). You may not use this file except
  7. * in compliance with the License.
  8. *
  9. * You can obtain a copy of the license at
  10. * https://open-jbi-components.dev.java.net/public/CDDLv1.0.html.
  11. * See the License for the specific language governing
  12. * permissions and limitations under the License.
  13. *
  14. * When distributing Covered Code, include this CDDL
  15. * HEADER in each file and include the License file at
  16. * https://open-jbi-components.dev.java.net/public/CDDLv1.0.html.
  17. * If applicable add the following below this CDDL HEADER,
  18. * with the fields enclosed by brackets "[]" replaced with
  19. * your own identifying information: Portions Copyright
  20. * [year] [name of copyright owner]
  21. */
  22. /*
  23. * @(#)CocoDescriptionEntry.java
  24. *
  25. * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
  26. *
  27. * END_HEADER - DO NOT EDIT
  28. */
  29. package com.sun.encoder.coco.model;
  30. import java.util.ArrayList;
  31. import java.util.Collections;
  32. import java.util.List;
  33. import java.util.ListIterator;
  34. import javax.xml.XMLConstants;
  35. import javax.xml.namespace.QName;
  36. import org.apache.xmlbeans.impl.xb.xsdschema.Element;
  37. import org.apache.xmlbeans.impl.xb.xsdschema.AnnotationDocument.Annotation;
  38. import com.sun.encoder.coco.appinfo.CocoEncoding;
  39. import com.sun.encoder.coco.appinfo.CocoEncoding.Sign;
  40. import com.sun.encoder.coco.appinfo.CocoEncoding.Usage;
  41. import com.sun.encoder.coco.runtime.messages.ErrorManager;
  42. import com.sun.encoder.coco.runtime.messages.Message;
  43. import com.sun.encoder.coco.runtime.messages.MessageCatalog;
  44. /**
  45. * Represents a Cobol Copybook item description entry.
  46. *
  47. * @author Noel Ang
  48. *
  49. */
  50. public class CocoDescriptionEntry {
  51. /**
  52. * Enumeration of usage types.
  53. */
  54. public interface UsageType {
  55. public static final int BINARY = 1;
  56. public static final int COMP = 2; // synonymous with BINARY but requires unique value
  57. public static final int COMP1 = 21;
  58. public static final int COMP2 = 22;
  59. public static final int COMP3 = 23;
  60. public static final int COMP4 = 24;
  61. public static final int COMP5 = 25;
  62. public static final int DISPLAY = 3;
  63. public static final int DISPLAY1 = 31;
  64. public static final int PACDEC = 4;
  65. public static final int INDEX = 5;
  66. }
  67. public interface UsageTypeName {
  68. public static final String BINARY = "BINARY";
  69. public static final String COMP = "COMP";
  70. public static final String COMP1 = "COMP-1";
  71. public static final String COMP2 = "COMP-2";
  72. public static final String COMP3 = "COMP-3";
  73. public static final String COMP4 = "COMP-4";
  74. public static final String COMP5 = "COMP-5";
  75. public static final String DISPLAY = "DISPLAY";
  76. public static final String DISPLAY1 = "DISPLAY1";
  77. public static final String PACDEC = "PACKED-DECIMAL";
  78. public static final String INDEX = "INDEX";
  79. }
  80. public interface BarkKey {
  81. public static final String IS_ELEMENTARY = "Elementary?";
  82. public static final String IS_REDEFINITION = "Redefinition?";
  83. public static final String IS_REDEFINED = "Redefined?";
  84. public static final String IS_BLANK_WHEN_ZERO = "BlankWhenZero?";
  85. public static final String IS_JUSTIFIED = "Justified?";
  86. public static final String IS_SIGNED = "Signed?";
  87. public static final String IS_SIGN_SEPARATE = "SignIsSeparate?";
  88. public static final String IS_SIGN_LEADING = "SignIsLeading?";
  89. public static final String IS_SIGN_TRAILING = "SignIsTrailing?";
  90. public static final String LEVEL = "Level";
  91. public static final String OCCURS_DEPENDS = "OccursDependsOn";
  92. public static final String REDEFINITION_ID = "RedefinitionObject";
  93. public static final String LENGTH = "Length";
  94. public static final String MAX_OCCURS = "MaxOccurs";
  95. public static final String MIN_OCCURS = "MinOccurs";
  96. public static final String PICTURE = "Picture";
  97. public static final String PICTURE_CATEGORY = "PictureCategory";
  98. public static final String PICTURE_DECIMAL_POS = "PictureDecimalPos";
  99. public static final String PICTURE_DECIMAL_SCALING_SPAN =
  100. "PictureDecimalScalePositions";
  101. public static final String USAGE = "Usage";
  102. public static final String JAVATYPE = "JavaType";
  103. public static final String FQN = "FQN";
  104. }
  105. public enum JavaType {
  106. INT, LONG, STRING, BIGDEC, BYTEARRAY, FLOAT, DOUBLE
  107. }
  108. protected ArrayList mChildren;
  109. protected CocoDescriptionEntry mParent;
  110. protected String mName;
  111. protected String mOriginalName;
  112. protected String mFQN;
  113. protected int mLevel;
  114. protected String mIndicatorValue;
  115. protected boolean mIsContinuation;
  116. protected boolean mIsComment;
  117. protected boolean mIsBlankWhenZero;
  118. protected boolean mIsJustified;
  119. protected boolean mIsSigned;
  120. protected CocoDescriptionEntry mOccursDepends;
  121. protected int mOccursMax;
  122. protected int mOccursMin;
  123. // added begin (88778,88779) - for late resolution of DEPENDING ON data-name (might with qualifiers)
  124. protected String mOccursDependsName;
  125. protected List mOccursDependsQualifiers;
  126. // added end
  127. protected CocoPicture mPicture;
  128. protected CocoDescriptionEntry mRedefinedTarget;
  129. protected List mRedefinitions;
  130. protected int mUsage;
  131. protected CocoSign mSign;
  132. protected boolean mIsSetSign;
  133. protected boolean mIsSeparateSign;
  134. private boolean mIsUsageExplicit;
  135. private boolean mIsNameFiller;
  136. private boolean mIsNameBlank;
  137. // remember an reserved word encountered exception
  138. // so that it can be thrown later during parsing of an
  139. // data item entry
  140. private CocoParseException mReservedWordAfterLevel;
  141. private final ErrorManager mErrorMgr =
  142. ErrorManager.getManager("OpenESB.encoder.COBOLCopybook."
  143. + getClass().getName());
  144. /**
  145. * Default constructor
  146. */
  147. public CocoDescriptionEntry() {
  148. mName = "";
  149. mOriginalName = "";
  150. mLevel = -1;
  151. mIndicatorValue = "";
  152. mPicture = null;
  153. mRedefinedTarget = null;
  154. mOccursDepends = null;
  155. mRedefinitions = Collections.synchronizedList(new ArrayList());
  156. mIsContinuation = false;
  157. mIsComment = false;
  158. mIsBlankWhenZero = false;
  159. mIsJustified = false;
  160. mUsage = UsageType.DISPLAY;
  161. mOccursMin = 1;
  162. mOccursMax = 1;
  163. mParent = null;
  164. mChildren = new ArrayList();
  165. mIsSetSign = false;
  166. mSign = com.sun.encoder.coco.model.CocoSign.TrailingSign;
  167. mIsSeparateSign = false;
  168. mIsUsageExplicit = false;
  169. mIsNameFiller = false;
  170. mIsNameBlank = false;
  171. }
  172. @Override
  173. public String toString() {
  174. StringBuilder sb = new StringBuilder();
  175. // sb.append("CocoDescriptionEntry@").append(Integer.toHexString(hashCode()));
  176. sb.append(" name='").append(mName).append("'");
  177. if (mOriginalName != null && mOriginalName.length() > 0) {
  178. sb.append(" originalName='").append(mOriginalName).append("'");
  179. }
  180. if (mLevel > -1) {
  181. sb.append(" level=").append(mLevel);
  182. }
  183. sb.append(" usage=").append(getUsageName(mUsage));
  184. sb.append(" occursMin=").append(mOccursMin);
  185. sb.append(" occursMax=").append(mOccursMax);
  186. if (mIndicatorValue != null && mIndicatorValue.length() > 0) {
  187. sb.append(" indicator=").append(mIndicatorValue);
  188. }
  189. if (mPicture != null) {
  190. sb.append(" picture=[").append(mPicture).append("]");
  191. }
  192. if (mRedefinedTarget != null) {
  193. sb.append(" redefinedTarget=[").append(mRedefinedTarget).append("]");
  194. }
  195. if (mOccursDepends != null) {
  196. sb.append(" occursDepends=[").append(mOccursDepends).append("]");
  197. }
  198. if (mRedefinitions.size() > 0) {
  199. sb.append(" redefinitions=").append(mRedefinitions);
  200. }
  201. if (mIsContinuation) {
  202. sb.append(" IsContinuation");
  203. }
  204. if (mIsComment) {
  205. sb.append(" IsComment");
  206. }
  207. if (mIsBlankWhenZero) {
  208. sb.append(" IsBlankWhenZero");
  209. }
  210. if (mIsJustified) {
  211. sb.append(" IsJustified");
  212. }
  213. if (mParent != null) {
  214. sb.append(" parent=[").append(mParent).append("]");
  215. }
  216. if (mChildren != null && mChildren.size() > 0) {
  217. sb.append(" children.size=").append(mChildren.size());
  218. }
  219. if (mIsSetSign) {
  220. sb.append(" IsSetSign");
  221. }
  222. sb.append(" sign=").append(mSign);
  223. if (mIsSeparateSign) {
  224. sb.append(" IsSignSeparate");
  225. }
  226. if (mIsUsageExplicit) {
  227. sb.append(" IsUsageExplicit");
  228. }
  229. if (mIsNameFiller) {
  230. sb.append(" IsNameFiller");
  231. }
  232. if (mIsNameBlank) {
  233. sb.append(" IsNameBlank");
  234. }
  235. return sb.toString();
  236. }
  237. /**
  238. * Create an entry.
  239. *
  240. * @param name Name for entry
  241. *
  242. * @param level Level number for entry
  243. */
  244. public CocoDescriptionEntry(String name, int level)
  245. throws IllegalArgumentException {
  246. if ((level < com.sun.encoder.coco.model.CocoLanguage.MIN_LEVEL_NUMBER
  247. || level > com.sun.encoder.coco.model.CocoLanguage.MAX_LEVEL_NUMBER)
  248. && (level != 66 && level != 77 && level != 88 )) {
  249. Message msg = MessageCatalog.getMessage("CCCB4108");
  250. String text = msg.formatText(new Object[] {
  251. String.valueOf(name),
  252. String.valueOf(level)
  253. });
  254. mErrorMgr.log(ErrorManager.Severity.ERROR, null, text);
  255. throw new IllegalArgumentException(text);
  256. }
  257. setName(name);
  258. mLevel = level;
  259. mIndicatorValue = "";
  260. mPicture = null;
  261. mRedefinedTarget = null;
  262. mOccursDepends = null;
  263. mRedefinitions = Collections.synchronizedList(new ArrayList());
  264. mIsContinuation = false;
  265. mIsComment = false;
  266. mIsBlankWhenZero = false;
  267. mIsJustified = false;
  268. mUsage = UsageType.DISPLAY;
  269. mOccursMin = 1;
  270. mOccursMax = 1;
  271. mParent = null;
  272. mChildren = new ArrayList();
  273. mIsSigned = false;
  274. mIsSetSign = false;
  275. mSign = com.sun.encoder.coco.model.CocoSign.TrailingSign;
  276. mIsSeparateSign = false;
  277. mIsUsageExplicit = false;
  278. mIsNameFiller = false;
  279. mIsNameBlank = false;
  280. }
  281. /**
  282. * Obtain name of entry.
  283. *
  284. * @return name specified for entry; blank string if no name assigned
  285. */
  286. public String getName() {
  287. return mName;
  288. }
  289. /**
  290. * Specify name for entry.
  291. *
  292. * @param name Name for entry. If null, it is ignored and a blank name
  293. * assigned instead.
  294. */
  295. public void setName(String name) {
  296. if (name != null) {
  297. name = name.trim();
  298. if (name.length() > 0) {
  299. mName = name;
  300. } else {
  301. mName = "";
  302. }
  303. } else {
  304. mName = "";
  305. }
  306. }
  307. /**
  308. * Gets the original name of the entry (whatever name read from the copybook
  309. * without any modification).
  310. *
  311. * @return the name of the entry (whatever name read from the copybook
  312. * without any modification)
  313. */
  314. public String getOriginalName() {
  315. return mOriginalName;
  316. }
  317. /**
  318. * Sets the original name of the entry (whatever name read from the copybook
  319. * without any modification).
  320. *
  321. * @param originalName the original name of the entry
  322. */
  323. public void setOriginalName(String originalName) {
  324. if (originalName != null) {
  325. originalName = originalName.trim();
  326. if (originalName.length() > 0) {
  327. mOriginalName = originalName;
  328. } else {
  329. mOriginalName = "";
  330. }
  331. } else {
  332. mOriginalName = "";
  333. }
  334. }
  335. /**
  336. * Checks if the entry's name is FILLER.
  337. *
  338. * @return true if the entry's name is FILLER
  339. */
  340. public boolean isNameFiller() {
  341. return mIsNameFiller;
  342. }
  343. /**
  344. * Sets the isNameFiller flag.
  345. *
  346. * @param isFiller
  347. */
  348. public void setNameFiller(boolean isFiller) {
  349. mIsNameFiller = isFiller;
  350. }
  351. /**
  352. * Checks if the entry has a blank name.
  353. *
  354. * @return true is the name is blank
  355. */
  356. public boolean isNameBlank() {
  357. return mIsNameBlank;
  358. }
  359. /**
  360. * Sets the isNameBlank flag.
  361. *
  362. * @param isBlank
  363. */
  364. public void setNameBlank(boolean isBlank) {
  365. mIsNameBlank = isBlank;
  366. }
  367. /**
  368. * Obtain the FQN of the entry
  369. * @return the fully qualified name for the entry
  370. */
  371. public String getFQN() {
  372. return this.mFQN;
  373. }
  374. /**
  375. * set the FQN for the entry
  376. * @param name
  377. */
  378. public void setFQN(String name) {
  379. this.mFQN = name;
  380. }
  381. /**
  382. * Obtain level number of entry.
  383. *
  384. * @return level assigned to entry, or -1
  385. */
  386. public int getLevel() {
  387. return mLevel;
  388. }
  389. /**
  390. * Specify level for entry.
  391. *
  392. * @param level Level number for entry
  393. *
  394. * @throws java.lang.IllegalArgumentException if the level number is illegal
  395. *
  396. * @see com.sun.encoder.coco.model.CocoLanguage#MIN_LEVEL_NUMBER
  397. *
  398. * @see com.sun.encoder.coco.model.CocoLanguage#MAX_LEVEL_NUMBER
  399. */
  400. public void setLevel(int level) throws IllegalArgumentException {
  401. if ((level < com.sun.encoder.coco.model.CocoLanguage.MIN_LEVEL_NUMBER
  402. || level > com.sun.encoder.coco.model.CocoLanguage.MAX_LEVEL_NUMBER)
  403. && (level != 66 && level != 77 && level != 88 )) {
  404. Message msg = MessageCatalog.getMessage("CCCB4108");
  405. String text = msg.formatText(new Object[] {
  406. String.valueOf(mName),
  407. String.valueOf(level)
  408. });
  409. mErrorMgr.log(ErrorManager.Severity.ERROR, null, text);
  410. throw new IllegalArgumentException(text);
  411. }
  412. mLevel = level;
  413. }
  414. /**
  415. * Obtain indicator value for entry.
  416. *
  417. * @return symbol specified for this entry via {@link #setIndicatorValue(java.lang.String)}
  418. * or a blank string if no symbol was specified
  419. *
  420. * @see #setIndicatorValue(java.lang.String)
  421. */
  422. public String getIndicatorValue() {
  423. return mIndicatorValue;
  424. }
  425. /**
  426. * Specify the indicator symbol, if any, for this entry. The indicator symbol
  427. * is the Indicator Area datum in a Cobol Copybook item description entry.
  428. *
  429. * @param value Indicator area symbol of this entry. If null is specified,
  430. * it is ignored and a blank string is used instead.
  431. */
  432. public void setIndicatorValue(String value) {
  433. if (value == null) {
  434. mIndicatorValue = "";
  435. } else {
  436. mIndicatorValue = value;
  437. }
  438. }
  439. /**
  440. * Indicates whether this entry is a continuation of the/a previous entry, or not.
  441. *
  442. * @return true if the entry is a continuation, false if it is not
  443. */
  444. public boolean isContinuation() {
  445. return mIsContinuation;
  446. }
  447. /**
  448. * Specify whether this entry is a continuation (of the/a previous entry), or not.
  449. *
  450. * @param is True to indicate this is a continuation entry, else false
  451. */
  452. public void setContinuation(boolean is) {
  453. mIsContinuation = is;
  454. }
  455. /**
  456. * Indicate whether this entry is a comment entry.
  457. *
  458. * @return true if the entry is a comment, false if it is not
  459. */
  460. public boolean isComment() {
  461. return mIsComment;
  462. }
  463. /**
  464. * Specify whether this entry is a comment.
  465. *
  466. * @param is True to indicate this is a comment, else false
  467. */
  468. public void setComment(boolean is) {
  469. mIsComment = is;
  470. }
  471. /**
  472. * Indicate if this entry has specifies a BLANK WHEN ZERO clause.
  473. *
  474. * @return true if this entry specifies a BLANK WHEN ZERO clause, else false
  475. */
  476. public boolean isBlankWhenZero() {
  477. return mIsBlankWhenZero;
  478. }
  479. /**
  480. * Specify whether or not this entry specifies a BLANK WHEN ZERO clause.
  481. *
  482. * @param is True to indicate BLANK WHEN ZERO, else false
  483. */
  484. public void setBlankWhenZero(boolean is) {
  485. mIsBlankWhenZero = is;
  486. }
  487. /**
  488. * Indicate if this entry has specifies a JUSTIFIED clause.
  489. *
  490. * @return true if this entry specifies a JUSTIFIED clause, else false
  491. */
  492. public boolean isJustified() {
  493. return mIsJustified;
  494. }
  495. /**
  496. * Specify whether or not this entry specifies a JUSTIFIED clause.
  497. *
  498. * @param is True to indicate JUSTIFIED, else false
  499. */
  500. public void setJustified(boolean is) {
  501. mIsJustified = is;
  502. }
  503. /**
  504. * Get the USAGE type for entry.
  505. *
  506. * @return usage type as number
  507. *
  508. * @see UsageType
  509. */
  510. public int getUsage() {
  511. return mUsage;
  512. }
  513. /**
  514. * Specify the USAGE type for the entry.
  515. *
  516. * @param type type value
  517. *
  518. * @throws java.lang.IllegalArgumentException if the specified type is not valid
  519. *
  520. * @see UsageType
  521. */
  522. public void setUsage(int type) throws IllegalArgumentException {
  523. switch (type) {
  524. case UsageType.DISPLAY:
  525. mUsage = type;
  526. mIsUsageExplicit = true;
  527. break;
  528. case UsageType.DISPLAY1:
  529. mUsage = type;
  530. mIsUsageExplicit = true;
  531. break;
  532. case UsageType.BINARY:
  533. case UsageType.COMP:
  534. mUsage = type;
  535. mIsUsageExplicit = true;
  536. break;
  537. case UsageType.COMP1:
  538. if (mPicture != null) {
  539. Message msg = MessageCatalog.getMessage("CCCB4109");
  540. String text = msg.formatText(new Object[] {
  541. getName(),
  542. });
  543. mErrorMgr.log(ErrorManager.Severity.ERROR, null, text);
  544. throw new IllegalArgumentException(text);
  545. }
  546. mUsage = type;
  547. mIsUsageExplicit = true;
  548. break;
  549. case UsageType.COMP2:
  550. if (mPicture != null) {
  551. Message msg = MessageCatalog.getMessage("CCCB4110");
  552. String text = msg.formatText(new Object[] {
  553. getName(),
  554. });
  555. mErrorMgr.log(ErrorManager.Severity.ERROR, null, text);
  556. throw new IllegalArgumentException(text);
  557. }
  558. mUsage = type;
  559. mIsUsageExplicit = true;
  560. break;
  561. case UsageType.COMP3:
  562. mUsage = type;
  563. mIsUsageExplicit = true;
  564. break;
  565. case UsageType.COMP4:
  566. mUsage = type;
  567. mIsUsageExplicit = true;
  568. break;
  569. case UsageType.COMP5:
  570. mUsage = type;
  571. mIsUsageExplicit = true;
  572. break;
  573. case UsageType.PACDEC:
  574. mUsage = type;
  575. mIsUsageExplicit = true;
  576. break;
  577. case UsageType.INDEX:
  578. mUsage = type;
  579. mIsUsageExplicit = true;
  580. break;
  581. default:
  582. Message msg = MessageCatalog.getMessage("CCCB4112");
  583. String text = msg.formatText(new Object[] {
  584. getName(),
  585. String.valueOf(type)
  586. });
  587. mErrorMgr.log(ErrorManager.Severity.ERROR, null, text);
  588. throw new IllegalArgumentException(text);
  589. }
  590. }
  591. /**
  592. * Retrieve PICTURE clause character-string associated with this entry.
  593. *
  594. * @return PICTURE character-string, or a blank string if no entry has no PIC
  595. */
  596. public String getPicture() {
  597. String pic = "";
  598. if (mPicture != null) {
  599. pic = mPicture.getPicture();
  600. }
  601. return pic;
  602. }
  603. /**
  604. * Specify the PIC string to associate with this entry.
  605. *
  606. * @param picture PIC string for entry
  607. *
  608. * @throws java.lang.IllegalArgumentException if the entry disallows a PIC string
  609. * (e.g., COMP-1 and COMP-2 items)
  610. */
  611. public void setPicture(com.sun.encoder.coco.model.CocoPicture picture) throws IllegalArgumentException {
  612. if (mUsage == UsageType.COMP1 || mUsage == UsageType.COMP2) {
  613. if (picture != null) {
  614. Message msg = MessageCatalog.getMessage("CCCB4111");
  615. String text = msg.toString();
  616. mErrorMgr.log(ErrorManager.Severity.ERROR, null, text);
  617. throw new IllegalArgumentException(text);
  618. }
  619. }
  620. if (picture.getCategory() == CocoPicture.Category.DBCS) {
  621. mUsage = UsageType.DISPLAY1;
  622. }
  623. mPicture = picture;
  624. evaluateForSign();
  625. }
  626. /**
  627. * Compute the number of bytes an elementary entry occupies.
  628. *
  629. * @param picture an instance of CocoPicture
  630. * @param usage usage information as refering to UsageType
  631. * @param separateSign a boolean value indicating whether the sign is separate character
  632. *
  633. * @return size of the entry in bytes, which may be zero (0) if the entry
  634. * does not have a picture, and its usage type requires one.
  635. */
  636. public static int computeElementarySize(CocoPicture picture, int usage, boolean separateSign) {
  637. int length = 0;
  638. if (picture == null) {
  639. switch (usage) {
  640. case UsageType.COMP1:
  641. length = 4;
  642. break;
  643. case UsageType.COMP2:
  644. length = 8;
  645. break;
  646. }
  647. } else if (picture.getCategory() == CocoPicture.Category.EX_FLOAT) {
  648. String pic = picture.getPicture();
  649. int stopIdx = pic.indexOf('E');
  650. int numBytes = 0;
  651. for (int i = 0; i < stopIdx; i++) {
  652. if ("9.".indexOf(pic.charAt(i)) != -1) {
  653. numBytes++;
  654. }
  655. }
  656. length = numBytes + 5; // mantissa sign + 'E' + exponent sign + exponent 9(2)
  657. } else {
  658. String pic = picture.getPicture();
  659. boolean stop = false;
  660. for (int i = 0; i < pic.length() && !stop; i++) {
  661. char ch = pic.charAt(i);
  662. switch (ch) {
  663. case 'A':
  664. case 'E':
  665. case 'X':
  666. length += 1;
  667. break;
  668. case 'G':
  669. case 'N':
  670. length += 2;
  671. break;
  672. case 'B':
  673. length += (picture.getCategory() == CocoPicture.Category.DBCS ? 2 : 1);
  674. break;
  675. case 'S':
  676. length += (separateSign ? 1 : 0);
  677. break;
  678. case 'C': // CR
  679. case 'D': // DB
  680. i += 1;
  681. length += 2;
  682. break;
  683. case 'V':
  684. case 'P':
  685. length += 0;
  686. break;
  687. default:
  688. switch (usage) {
  689. case UsageType.BINARY:
  690. case UsageType.COMP:
  691. case UsageType.COMP4:
  692. case UsageType.COMP5: {
  693. int digitCount = 0;
  694. for (int j = 0; j < pic.length(); j++) {
  695. char numch = pic.charAt(j);
  696. if ("90Z".indexOf(numch) != -1 ) {
  697. digitCount++;
  698. }
  699. }
  700. if (digitCount > 0) {
  701. if (digitCount < 5) {
  702. length = 2;
  703. } else if (digitCount < 10) {
  704. length = 4;
  705. } else {
  706. length = 8;
  707. }
  708. }
  709. stop = true;
  710. break;
  711. }
  712. case UsageType.PACDEC:
  713. case UsageType.COMP3: {
  714. int digitCount = 0;
  715. for (int j = 0; j < pic.length(); j++) {
  716. if ("90Z".indexOf(pic.charAt(j)) != -1 ) {
  717. digitCount++;
  718. }
  719. }
  720. boolean oddNumbered = ((digitCount % 2) != 0);
  721. length = (digitCount / 2) + (digitCount % 2);
  722. length += (oddNumbered ? 0 : 1); // for sign nibble
  723. stop = true;
  724. break;
  725. }
  726. case UsageType.INDEX:
  727. length = 4;
  728. stop = true;
  729. break;
  730. case UsageType.DISPLAY:
  731. length += 1;
  732. break;
  733. case UsageType.DISPLAY1:
  734. length += 2;
  735. break;
  736. }
  737. break;
  738. }
  739. }
  740. }
  741. return length;
  742. }
  743. /**
  744. * Retrieve number of bytes the entry occupies.
  745. * If the entry does not represent an elementary item, then the value it
  746. * yields is the sum of the sizes of its subordinate items.
  747. *
  748. * @return size of the entry in bytes, which may be zero (0) if the entry
  749. * does not have a picture, and its usage type requires one.
  750. *
  751. * @see #isElementary()
  752. */
  753. public int getSize() {
  754. /*
  755. * If item is elementary and repeating, return length of 1 occurence.
  756. * If item is elementary and non-repeating, return length.
  757. * If item is non-elementary, return sum length of its subordinates.
  758. */
  759. int length = 0;
  760. if (!isElementary()) {
  761. ListIterator it = mChildren.listIterator();
  762. while (it.hasNext()) {
  763. //Same logic in RuleNode's readRule() method
  764. CocoDescriptionEntry entry = (CocoDescriptionEntry) it.next();
  765. int multiplier = (entry.getOccursOn() == null
  766. ? entry.getMaximumOccurs() : 1);
  767. length += (entry.getSize() * multiplier);
  768. }
  769. } else {
  770. length = computeElementarySize(mPicture, mUsage, isSeparateSign());
  771. }
  772. return length;
  773. }
  774. /**
  775. * Determines a suitable Java type to represent the data of this entry. The
  776. * picture of the entry, as well as its usage type, affect the determination.
  777. *
  778. * @return Java type ordinal value mapped to {@link JavaType}
  779. *
  780. * @see JavaType
  781. */
  782. public JavaType getJavaType() {
  783. JavaType type;
  784. if (mPicture != null) {
  785. CocoPicture.Category category = mPicture.getCategory();
  786. switch (category) {
  787. case ALPHABETIC:
  788. type = JavaType.STRING;
  789. break;
  790. case ALPHANUMERIC:
  791. type = JavaType.STRING;
  792. break;
  793. case ALPHANUMERIC_EDITED:
  794. type = JavaType.STRING;
  795. break;
  796. case DBCS:
  797. type = JavaType.BYTEARRAY;
  798. break;
  799. case EX_FLOAT:
  800. type = JavaType.BIGDEC;
  801. break;
  802. case NUMERIC_EDITED:
  803. type = JavaType.STRING;
  804. break;
  805. case NUMERIC:
  806. int decPos = mPicture.getDecimalPosition();
  807. if (decPos > 0) {
  808. type = JavaType.BIGDEC;
  809. } else {
  810. int numDigits = mPicture.countDigits();
  811. if (decPos < 0) {
  812. numDigits += Math.abs(decPos);
  813. }
  814. if (numDigits <= 9) {
  815. type = JavaType.INT;
  816. } else if (numDigits <= 18) {
  817. type = JavaType.LONG;
  818. } else {
  819. type = JavaType.BIGDEC;
  820. }
  821. }
  822. break;
  823. default: // Should not end up here!!
  824. Message msg = MessageCatalog.getMessage("CCCB4113");
  825. String text = msg.formatText(new Object[] {
  826. getName(),
  827. mPicture.getPicture()
  828. });
  829. mErrorMgr.log(ErrorManager.Severity.ERROR, null, text);
  830. throw new RuntimeException(text);
  831. }
  832. } else {
  833. switch (mUsage) {
  834. case UsageType.COMP1:
  835. type = JavaType.FLOAT;
  836. break;
  837. case UsageType.COMP2:
  838. type = JavaType.DOUBLE;
  839. break;
  840. default:
  841. type = JavaType.STRING;
  842. }
  843. }
  844. return type;
  845. }
  846. public static JavaType getJavaType(String typeName) {
  847. int trial = 1;
  848. if (typeName == null) {
  849. return null; // (-1);
  850. }
  851. while (trial != 0) {
  852. if (typeName.equals("int")) {
  853. return JavaType.INT;
  854. }
  855. if (typeName.equals("long")) {
  856. return JavaType.LONG;
  857. }
  858. if (typeName.equals("float")) {
  859. return JavaType.FLOAT;
  860. }
  861. if (typeName.equals("double")) {
  862. return JavaType.DOUBLE;
  863. }
  864. if (typeName.equals("BigDecimal") || typeName.equals("java.math.BigDecimal")) {
  865. return JavaType.BIGDEC;
  866. }
  867. if (typeName.equals("byte[]") || typeName.equals("byte []")) {
  868. return JavaType.BYTEARRAY;
  869. }
  870. if (typeName.equals("java.lang.String") || typeName.equals("String")) {
  871. return JavaType.STRING;
  872. }
  873. if (trial == 1) {
  874. typeName = typeName.trim();
  875. trial--;
  876. }
  877. }
  878. return null; // -1;
  879. }
  880. public String getJavaTypeName() {
  881. String javaType;
  882. switch (getJavaType()) {
  883. case BIGDEC:
  884. javaType = "java.math.BigDecimal";
  885. break;
  886. case BYTEARRAY:
  887. javaType = "byte[]";
  888. break;
  889. case INT:
  890. javaType = "int";
  891. break;
  892. case LONG:
  893. javaType = "long";
  894. break;
  895. case STRING:
  896. javaType = "java.lang.String";
  897. break;
  898. case DOUBLE:
  899. javaType = "double";
  900. break;
  901. case FLOAT:
  902. javaType = "float";
  903. break;
  904. default:
  905. javaType = "java.lang.String";
  906. }
  907. return javaType;
  908. }
  909. public static String getJavaTypeName(JavaType type) {
  910. String javaType;
  911. switch (type) {
  912. case INT:
  913. javaType = "int";
  914. break;
  915. case LONG:
  916. javaType = "long";
  917. break;
  918. case FLOAT:
  919. javaType = "float";
  920. break;
  921. case DOUBLE:
  922. javaType = "double";
  923. break;
  924. case BYTEARRAY:
  925. javaType = "byte[]";
  926. break;
  927. case STRING:
  928. javaType = "java.lang.String";
  929. break;
  930. case BIGDEC:
  931. javaType = "java.math.BigDecimal";
  932. break;
  933. default:
  934. javaType = null;
  935. }
  936. return javaType;
  937. }
  938. public boolean isPrimitiveJavaType() {
  939. switch (getJavaType()) {
  940. case BIGDEC:
  941. return false;
  942. case BYTEARRAY:
  943. return false;
  944. case INT:
  945. return true;
  946. case LONG:
  947. return true;
  948. case DOUBLE:
  949. return true;
  950. case FLOAT:
  951. return true;
  952. case STRING:
  953. return false;
  954. default:
  955. return false;
  956. }
  957. }
  958. public static boolean isPrimitiveJavaType(JavaType type) {
  959. switch (type) {
  960. case BIGDEC:
  961. return false;
  962. case BYTEARRAY:
  963. return false;
  964. case INT:
  965. return true;
  966. case LONG:
  967. return true;
  968. case DOUBLE:
  969. return true;
  970. case FLOAT:
  971. return true;
  972. case STRING:
  973. return false;
  974. default:
  975. return false;
  976. }
  977. }
  978. /**
  979. * Indicate if the entry is redefined by another entry.
  980. *
  981. * @return true if the entry is redefined by another (one or more) entry, else
  982. * false
  983. */
  984. public boolean isRedefined() {
  985. return (mRedefinitions.size() > 0);
  986. }
  987. /**
  988. * Indicate if the entry is a redefinition of another entry.
  989. *
  990. * @return true if the entry redefines another entry, else false
  991. */
  992. public boolean isRedefinition() {
  993. return (mRedefinedTarget != null);
  994. }
  995. /**
  996. * Get the entry that this entry redefines.
  997. *
  998. * @return entry that this entry redefines, or null if this entry is not
  999. * a redefinition
  1000. */
  1001. public CocoDescriptionEntry getRedefinedTarget() {
  1002. return mRedefinedTarget;
  1003. }
  1004. /**
  1005. * Determine number of redefinitions of this entry.
  1006. *
  1007. * @return number of redefinitions
  1008. */
  1009. public int countRedefinitions() {
  1010. return mRedefinitions.size();
  1011. }
  1012. /**
  1013. * Get redefinition of entry.
  1014. *
  1015. * @param idx Ordinal of the desired redefinition, counting from 0
  1016. *
  1017. * @return the indicated redefining entry
  1018. *
  1019. * @throws java.lang.IndexOutOfBoundsException if idx < 0 or idx >= number of
  1020. * redefinitions associated with entry
  1021. */
  1022. public CocoDescriptionEntry getRedefinition(int idx)
  1023. throws IndexOutOfBoundsException {
  1024. return (CocoDescriptionEntry) mRedefinitions.get(idx);
  1025. }
  1026. /**
  1027. * Specify the entry that this entry redefines.
  1028. *
  1029. * @param entry The entry that this entry redefines
  1030. *
  1031. * @throws java.lang.IllegalArgumentException if the specified entry is null, or is
  1032. * the redefining entry itself, or is a redefinition itself, or has
  1033. * a level number that is not equal to this entry's level
  1034. *
  1035. * @throws java.lang.IllegalStateException if this entry already redefines another
  1036. * entry, and the specified entry is not it
  1037. */
  1038. public void setRedefinedTarget(CocoDescriptionEntry entry)
  1039. throws IllegalArgumentException, IllegalStateException {
  1040. if (entry == null) {
  1041. throw new NullPointerException();
  1042. }
  1043. /* can't redefine myself */
  1044. if (entry == this) {
  1045. Message msg = MessageCatalog.getMessage("CCCB4114");
  1046. String text = msg.formatText(new Object[] {
  1047. getName(),
  1048. });
  1049. mErrorMgr.log(ErrorManager.Severity.ERROR, null, text);
  1050. throw new IllegalArgumentException(text);
  1051. }
  1052. /* can't re-use redefine */
  1053. if ((mRedefinedTarget != null) && (mRedefinedTarget != entry)) {
  1054. Message msg = MessageCatalog.getMessage("CCCB4115");
  1055. String text = msg.formatText(new Object[] {
  1056. getName(),
  1057. entry.getName(),
  1058. mRedefinedTarget.getName()
  1059. });
  1060. mErrorMgr.log(ErrorManager.Severity.ERROR, null, text);
  1061. throw new IllegalStateException(text);
  1062. }
  1063. /* can't redefine an entry of a different level */
  1064. if (mLevel != entry.getLevel()) {
  1065. Message msg = MessageCatalog.getMessage("CCCB4116");
  1066. String text = msg.formatText(new Object[] {
  1067. getName(),
  1068. entry.getName(),
  1069. String.valueOf(mLevel),
  1070. String.valueOf(entry.getLevel())
  1071. });
  1072. mErrorMgr.log(ErrorManager.Severity.ERROR, null, text);
  1073. throw new IllegalArgumentException(text);
  1074. }
  1075. /* If the item I am redefining, itself redefines something-else,
  1076. I redefine that something-else directly */
  1077. if (entry.isRedefinition()) {
  1078. entry = entry.getRedefinedTarget();
  1079. }
  1080. mRedefinedTarget = entry;
  1081. if (!entry.mRedefinitions.contains(this)) {
  1082. entry.mRedefinitions.add(this);
  1083. // Unless explicitly specified, a redefinition's usage
  1084. // is equivalent to the usage of the non-elementary item
  1085. // in whose scope its redefined item exists.
  1086. //
  1087. // 05 A COMP3
  1088. // 10 B PIC S(5)
  1089. // 10 C REDEFINES B PIC S(5)
  1090. // 10 D REDEFINES B PIC 9(3) DISPLAY
  1091. //
  1092. // B is usage COMP3 because of A (covered elsewhere)
  1093. // C is usage COMP3 also
  1094. // D is usage DISPLAY because it is explicitly specified
  1095. if (!mIsUsageExplicit) {
  1096. CocoDescriptionEntry parentEntry = entry.getParent();
  1097. if (null != parentEntry) {
  1098. setUsage(parentEntry.getUsage());
  1099. mIsUsageExplicit = false;
  1100. }
  1101. }
  1102. }
  1103. }
  1104. /**
  1105. * Retrieve the minimum number of times the data represented by this entry is
  1106. * to occur.
  1107. *
  1108. * @return the minimum number of occurences of the entry's data
  1109. */
  1110. public int getMinimumOccurs() {
  1111. return mOccursMin;
  1112. }
  1113. /**
  1114. * Retrieve the maximum number of times the data represented by this entry is to
  1115. * occur.
  1116. *
  1117. * @return the maximum number of occurences of the entry's data
  1118. */
  1119. public int getMaximumOccurs() {
  1120. return mOccursMax;
  1121. }
  1122. /**
  1123. * Retrieve the entry whose value determines how many times this entry is to
  1124. * occur.
  1125. *
  1126. * @return the entry whose value determines the occurence count of this entry,
  1127. * or null if this entry has no such dependence
  1128. */
  1129. public CocoDescriptionEntry getOccursOn() {
  1130. return mOccursDepends;
  1131. }
  1132. /**
  1133. * get the data name after DEPENDING ON
  1134. * @return the name (it is the base name part - qualifiers are in another attribute)
  1135. */
  1136. public String getDependOnName() {
  1137. return this.mOccursDependsName;
  1138. }
  1139. /**
  1140. * set the base name for the data name after DEPENDING ON
  1141. * @param name - the base name
  1142. */
  1143. public void setDependOnName(String name) {
  1144. this.mOccursDependsName = name;
  1145. }
  1146. /**
  1147. * get the qualifiers for the data name after DEPENDING ON
  1148. * @return the qualifiers;
  1149. */
  1150. public List getDependOnNameQualifiers() {
  1151. return this.mOccursDependsQualifiers;
  1152. }
  1153. /**
  1154. * set the qualifiers for the data name after DEPENDING ON
  1155. * @param name - the qualifiers.
  1156. */
  1157. public void setDependOnNameQualifiers(List qualifiers) {
  1158. this.mOccursDependsQualifiers = qualifiers;
  1159. }
  1160. /**
  1161. * Specify the minimum and maximum occurence count of this entry.
  1162. *
  1163. * @param count Occurence count
  1164. *
  1165. * @throws java.lang.IllegalArgumentException if count is not positive value
  1166. */
  1167. public void setOccurs(int count) throws IllegalArgumentException {
  1168. if (count < 1) {
  1169. Message msg = MessageCatalog.getMessage("CCCB4117");
  1170. String text = msg.formatText(new Object[] {
  1171. String.valueOf(count)
  1172. });
  1173. mErrorMgr.log(ErrorManager.Severity.ERROR, null, text);
  1174. throw new IllegalArgumentException(text);
  1175. }
  1176. mOccursMin = count;
  1177. mOccursMax = count;
  1178. mOccursDepends = null;
  1179. }
  1180. /**
  1181. * set the entry that this OCCURS entry depends on because of DEPENDING ON clause
  1182. *
  1183. */
  1184. public void setDependsOnTarget(CocoDescriptionEntry entry) {
  1185. this.mOccursDepends = entry;
  1186. }
  1187. /**
  1188. * Assign sign information to the entry.
  1189. *
  1190. * @param sign {@link com.sun.encoder.coco.model.CocoSign#LeadingSign} or {@link com.sun.encoder.coco.model.CocoSign#TrailingSign}.
  1191. */
  1192. public void setSign(com.sun.encoder.coco.model.CocoSign sign) {
  1193. if (sign != null) {
  1194. mIsSetSign = true;
  1195. mSign = sign;
  1196. }
  1197. evaluateForSign();
  1198. }
  1199. /**
  1200. * Specify whether or not this entry's sign is represented by a separate
  1201. * symbol.
  1202. *
  1203. * @param hasSeparateSign use true if the entry's sign is separate, false if it
  1204. * is not.
  1205. */
  1206. public void setSeparateSign(boolean hasSeparateSign) {
  1207. mIsSeparateSign = hasSeparateSign;
  1208. evaluateForSign();
  1209. }
  1210. /**
  1211. * Indicate whether or not this entry's sign is represented by a separate
  1212. * symbol.
  1213. *
  1214. * @return true if the entry's sign is separate, false if it is not
  1215. */
  1216. public boolean isSeparateSign() {
  1217. return mIsSeparateSign;
  1218. }
  1219. public boolean isSigned() {
  1220. return mIsSigned;
  1221. }
  1222. private void evaluateForSign() {
  1223. mIsSigned = mPicture != null && (mPicture.getPicture().indexOf("S") != -1);
  1224. if (!mIsSigned) {
  1225. mIsSeparateSign = false;
  1226. }
  1227. }
  1228. /**
  1229. * Specify the minimum and maximum occurence count of this entry, and the
  1230. * the entry whose value determines the actual occurence count for this entry.
  1231. *
  1232. * @param low Minimum occurence count
  1233. *
  1234. * @param high Maximum occurence count
  1235. *
  1236. * @param depends Entry whose value determines this entry's actual occurence
  1237. * count
  1238. *
  1239. * @throws java.lang.IllegalArgumentException if low less than 1 when
  1240. * high == low, or if high < low, or when low or high is a negative
  1241. * value, or when depends is null.
  1242. */
  1243. public void setOccurs(int low, int high, CocoDescriptionEntry depends)
  1244. throws IllegalArgumentException {
  1245. if (low < 1 && low == high) {
  1246. Message msg = MessageCatalog.getMessage("CCCB4118");
  1247. String text = msg.formatText(new Object[] {
  1248. String.valueOf(low),
  1249. String.valueOf(high)
  1250. });
  1251. mErrorMgr.log(ErrorManager.Severity.ERROR, null, text);
  1252. throw new IllegalArgumentException(text);
  1253. }
  1254. if (low < 0) {
  1255. Message msg = MessageCatalog.getMessage("CCCB4118");
  1256. String text = msg.formatText(new Object[] {
  1257. String.valueOf(low),
  1258. String.valueOf(high)
  1259. });
  1260. mErrorMgr.log(ErrorManager.Severity.ERROR, null, text);
  1261. throw new IllegalArgumentException(text);
  1262. }
  1263. if (high < 0) {
  1264. Message msg = MessageCatalog.getMessage("CCCB4118");
  1265. String text = msg.formatText(new Object[] {
  1266. String.valueOf(low),
  1267. String.valueOf(high)
  1268. });
  1269. mErrorMgr.log(ErrorManager.Severity.ERROR, null, text);
  1270. throw new IllegalArgumentException(text);
  1271. }
  1272. if (high < low) {
  1273. Message msg = MessageCatalog.getMessage("CCCB4118");
  1274. String text = msg.formatText(new Object[] {
  1275. String.valueOf(low),
  1276. String.valueOf(high)
  1277. });
  1278. mErrorMgr.log(ErrorManager.Severity.ERROR, null, text);
  1279. throw new IllegalArgumentException(text);
  1280. }
  1281. if (null == depends) {
  1282. Message msg = MessageCatalog.getMessage("CCCB4119");
  1283. String text = msg.toString();
  1284. mErrorMgr.log(ErrorManager.Severity.ERROR, null, text);
  1285. throw new IllegalArgumentException(text);
  1286. }
  1287. this.mOccursDependsName = null;
  1288. this.mOccursDependsQualifiers = null;
  1289. mOccursMin = low;
  1290. mOccursMax = high;
  1291. mOccursDepends = depends;
  1292. }
  1293. /**
  1294. * set OCCURS information for the entry but leave the DEPENDING ON target resolved later
  1295. *
  1296. * @param low
  1297. * @param high
  1298. * @param qualifiers
  1299. * @param depend_on_name
  1300. * @throws IllegalArgumentException
  1301. */
  1302. public void setOccursResolveLater(int low, int high, List qualifiers,
  1303. String depend_on_name)
  1304. throws IllegalArgumentException {
  1305. if (low < 1 && low == high) {
  1306. Message msg = MessageCatalog.getMessage("CCCB4118");
  1307. String text = msg.formatText(new Object[]{
  1308. String.valueOf(low),
  1309. String.valueOf(high)
  1310. });
  1311. mErrorMgr.log(ErrorManager.Severity.ERROR, null, text);
  1312. throw new IllegalArgumentException(text);
  1313. }
  1314. if (low < 0) {
  1315. Message msg = MessageCatalog.getMessage("CCCB4118");
  1316. String text = msg.formatText(new Object[]{
  1317. String.valueOf(low),
  1318. String.valueOf(high)
  1319. });
  1320. mErrorMgr.log(ErrorManager.Severity.ERROR, null, text);
  1321. throw new IllegalArgumentException(text);
  1322. }
  1323. if (high < 0) {
  1324. Message msg = MessageCatalog.getMessage("CCCB4118");
  1325. String text = msg.formatText(new Object[]{
  1326. String.valueOf(low),
  1327. String.valueOf(high)
  1328. });
  1329. mErrorMgr.log(ErrorManager.Severity.ERROR, null, text);
  1330. throw new IllegalArgumentException(text);
  1331. }
  1332. if (high < low) {
  1333. Message msg = MessageCatalog.getMessage("CCCB4118");
  1334. String text = msg.formatText(new Object[]{
  1335. String.valueOf(low),
  1336. String.valueOf(high)
  1337. });
  1338. mErrorMgr.log(ErrorManager.Severity.ERROR, null, text);
  1339. throw new IllegalArgumentException(text);
  1340. }
  1341. //if (null == depends) {
  1342. // Message msg = MessageCatalog.getMessage("CCCB4119");
  1343. // String text = msg.toString();
  1344. // mErrorMgr.log(ErrorManager.Severity.ERROR, null, text);
  1345. // throw new IllegalArgumentException(text);
  1346. //}
  1347. String normalName = "";
  1348. if (depend_on_name != null) {
  1349. normalName = depend_on_name.toUpperCase();
  1350. }
  1351. mOccursDependsName = normalName;
  1352. mOccursDependsQualifiers = normalizeQualifiers(qualifiers);
  1353. mOccursMin = low;
  1354. mOccursMax = high;
  1355. mOccursDepends = null;
  1356. }
  1357. /**
  1358. * helper to upper case all the qualifier names;
  1359. * @return
  1360. */
  1361. private List normalizeQualifiers(List qualifiers) {
  1362. if ( qualifiers != null && qualifiers.size() > 0 ) {
  1363. for ( int i = 0; i < qualifiers.size(); i++ ) {
  1364. String qn = (String)qualifiers.get(i);
  1365. if ( qn != null )
  1366. qualifiers.set(i, qn.toUpperCase());
  1367. }
  1368. }
  1369. return qualifiers;
  1370. }
  1371. /**
  1372. * Get the parent of this entry, if any.
  1373. *
  1374. * @return parent of this entry, or null, if none is designated
  1375. */
  1376. public CocoDescriptionEntry getParent() {
  1377. return mParent;
  1378. }
  1379. /**
  1380. * Specify the parent of this entry.
  1381. *
  1382. * @param entry Parent for this entry
  1383. *
  1384. * @throws java.lang.IllegalArgumentException if the parent specified is this entry, or if
  1385. * the parent is already a child of this entry
  1386. */
  1387. public void setParent(CocoDescriptionEntry entry) throws IllegalArgumentException {
  1388. if (entry == this) {
  1389. Message msg = MessageCatalog.getMessage("CCCB4120");
  1390. String text = msg.formatText(new Object[] {
  1391. getName()
  1392. });
  1393. mErrorMgr.log(ErrorManager.Severity.ERROR, null, text);
  1394. throw new IllegalArgumentException(text);
  1395. }
  1396. if (mChildren.contains(entry)) {
  1397. Message msg = MessageCatalog.getMessage("CCCB4121");
  1398. String text = msg.formatText(new Object[] {
  1399. entry.getName(),
  1400. getName()
  1401. });
  1402. mErrorMgr.log(ErrorManager.Severity.ERROR, null, text);
  1403. throw new IllegalArgumentException(text);
  1404. }
  1405. mParent = entry;
  1406. }
  1407. /**
  1408. * Indicate whether or not the entry is an Cobol elementary