View Javadoc

1   // Copyright 2006-2007, by the California Institute of Technology.
2   // ALL RIGHTS RESERVED. United States Government Sponsorship acknowledged.
3   // Any commercial use must be negotiated with the Office of Technology Transfer
4   // at the California Institute of Technology.
5   //
6   // This software is subject to U. S. export control laws and regulations
7   // (22 C.F.R. 120-130 and 15 C.F.R. 730-774). To the extent that the software
8   // is subject to U.S. export control laws and regulations, the recipient has
9   // the responsibility to obtain export licenses or other export authority as
10  // may be required before exporting such information to foreign countries or
11  // providing access to foreign nationals.
12  //
13  // $Id: ElementDefinition.java 2941 2007-09-27 20:21:50Z pramirez $
14  //
15  
16  package gov.nasa.pds.tools.dict;
17  
18  import java.util.ArrayList;
19  import java.util.Collection;
20  import java.util.List;
21  
22  /***
23   * @author pramirez
24   * @version $Revision: 2941 $
25   * 
26   */
27  public class ElementDefinition extends Definition {
28      private String dataType;
29      private String unitId;
30      private List unitList;
31      private String valueType;
32      private int minLength;
33      private int maxLength;
34      private Collection values;
35      private Number minimum;
36      private Number maximum;
37      
38      public ElementDefinition(String identifier) {
39          super(identifier);
40          dataType = "NULL";
41          unitList = new ArrayList();
42          unitId = "NONE";
43          valueType = "NONE";
44          minLength = 0;
45          maxLength = Integer.MAX_VALUE;
46          values = new ArrayList();
47          minimum = null;
48          maximum = null;
49      }
50      
51      /***
52       * @return Returns the dataType.
53       */
54      public String getDataType() {
55          return dataType;
56      }
57      
58      /***
59       * @param dataType The dataType to set.
60       */
61      public void setDataType(String dataType) {
62          this.dataType = dataType;
63      }
64      
65      /***
66       * @return Returns the maximum.
67       */
68      public Number getMaximum() {
69          return maximum;
70      }
71      
72      /***
73       * @param maximum The maximum to set.
74       */
75      public void setMaximum(Number maximum) {
76          this.maximum = maximum;
77      }
78      
79      /***
80       * @return Returns the maxLength.
81       */
82      public int getMaxLength() {
83          return maxLength;
84      }
85      
86      /***
87       * @param maxLength The maxLength to set.
88       */
89      public void setMaxLength(int maxLength) {
90          this.maxLength = maxLength;
91      }
92      
93      /***
94       * @return Returns the minimum.
95       */
96      public Number getMinimum() {
97          return minimum;
98      }
99      
100     /***
101      * @param minimum The minimum to set.
102      */
103     public void setMinimum(Number minimum) {
104         this.minimum = minimum;
105     }
106     
107     /***
108      * @return Returns the minLength.
109      */
110     public int getMinLength() {
111         return minLength;
112     }
113     
114     /***
115      * @param minLength The minLength to set.
116      */
117     public void setMinLength(int minLength) {
118         this.minLength = minLength;
119     }
120     
121     /***
122      * @return Returns the unit id that can be looked up in a dictionary.
123      */
124     public String getUnitId() {
125         return unitId;
126     }
127     
128     /***
129      * @param unitId
130      */
131     public void setUnitId(String unitId) {
132         this.unitId = unitId;
133     }
134     
135     public void setUnitList(List unitList) {
136         this.unitList = unitList;
137     }
138 
139     /***
140      * @return Returns the values.
141      */
142     public Collection getValues() {
143         return values;
144     }
145     
146     /***
147      * @param values The values to set.
148      */
149     public void setValues(Collection values) {
150         this.values = values;
151     }
152     
153     /***
154      * @return Returns the valueType.
155      */
156     public String getValueType() {
157         return valueType;
158     }
159     
160     /***
161      * @param valueType The valueType to set.
162      */
163     public void setValueType(String valueType) {
164         this.valueType = valueType;
165     }
166     
167     public boolean hasValidValues() {
168         if (values.size() > 0)
169             return true;
170         return false;
171     }
172     
173     public boolean hasMaximum() {
174         if (maximum != null)
175             return true;
176         return false;
177     }
178     
179     public boolean hasMinimum() {
180         if (minimum != null)
181             return true;
182         return false;
183     }
184     
185     public boolean isUnitAllowed(String unit) {
186         return unitList.contains(unit);
187     }
188  
189 }