View Javadoc

1   /*******************************************************************************
2    *  Copyright (c) 2005, 2006 Imola Informatica.
3    *  All rights reserved. This program and the accompanying materials
4    *  are made available under the terms of the LGPL License v2.1
5    *  which accompanies this distribution, and is available at
6    *  http://www.gnu.org/licenses/lgpl.html
7    ******************************************************************************/
8   
9   
10  package it.imolinfo.jbi4cics.commareaparser;
11  
12  import it.imolinfo.jbi4cics.exception.ParseException;
13  import it.imolinfo.jbi4cics.typemapping.cobol.CobolType;
14  import it.imolinfo.jbi4cics.typemapping.cobol.CobolTypeDescriptor;
15  
16  public class OccursDefinition {
17  
18    private int minSize;
19    private int maxSize;
20    private int size;
21    private String variableName;
22    private boolean dynamic;
23  
24    public OccursDefinition() {
25    }
26  
27    /**
28     * @return the dynamic
29     */
30    public boolean isDynamic() {
31      return dynamic;
32    }
33    /**
34     * @param dynamic the dynamic to set
35     */
36    public void setDynamic(boolean dynamic) {
37      this.dynamic = dynamic;
38    }
39    /**
40     * @return the maxSize
41     */
42    public int getMaxSize() {
43      return maxSize;
44    }
45    /**
46     * @param maxSize the maxSize to set
47     */
48    public void setMaxSize(int maxSize) {
49      this.maxSize = maxSize;
50    }
51    /**
52     * @return the minSize
53     */
54    public int getMinSize() {
55      return minSize;
56    }
57    /**
58     * @param minSize the minSize to set
59     */
60    public void setMinSize(int minSize) {
61      this.minSize = minSize;
62    }
63    /**
64     * @return the size
65     */
66    public int getSize() {
67      return size;
68    }
69    /**
70     * @param size the size to set
71     */
72    public void setSize(int size) {
73      this.size = size;
74    }
75    /**
76     * @return the variableName
77     */
78    public String getVariableName() {
79      return variableName;
80    }
81    /**
82     * @param variableName the variableName to set
83     */
84    public void setVariableName(String variableName) {
85      this.variableName = variableName;
86    }
87  
88    public void populate(CobolTypeDescriptor cobolTypeDescriptor)
89            throws ParseException{
90      cobolTypeDescriptor.setType(CobolType.OCCURS);
91      if (isDynamic()){
92        throw new ParseException("CIC000001_Occurs_not_supported");
93      }
94      else {
95        cobolTypeDescriptor.setOccursSize(size);
96      }
97    }
98  }