001: /*
002: * GeoTools - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2003-2006, Geotools Project Managment Committee (PMC)
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or (at your option) any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: */
016: package org.geotools.data.vpf.io;
017:
018: import org.geotools.data.vpf.ifc.DataTypesDefinition;
019: import org.geotools.data.vpf.util.DataUtils;
020:
021: /**
022: * This class contains definition of VPF standard table column definition
023: * according to specification found in: "Interface Standard for Vector Product
024: * Format." Objects of this type are immutable. Created: Thu Jan 02 23:11:27
025: * 2003
026: *
027: * @author <a href="mailto:kobit@users.fs.net">Artur Hefczyc</a>
028: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/unsupported/vpf/src/main/java/org/geotools/data/vpf/io/TableColumnDef.java $
029: * @version 1.0
030: */
031: public class TableColumnDef implements DataTypesDefinition {
032: /** Describe variable <code>name</code> here. */
033: private String name = null;
034:
035: /** Describe variable <code>type</code> here. */
036: private char type = CHAR_NULL_VALUE;
037:
038: /** Describe variable <code>elementsNumber</code> here. */
039: private int elementsNumber = 0;
040:
041: /** Describe variable <code>keyType</code> here. */
042: private char keyType = CHAR_NULL_VALUE;
043:
044: /** Describe variable <code>colDesc</code> here. */
045: private String colDesc = null;
046:
047: /** Describe variable <code>valDescTableName</code> here. */
048: private String valDescTableName = null;
049:
050: /** Describe variable <code>thematicIdx</code> here. */
051: private String thematicIdx = null;
052:
053: /** Describe variable <code>narrTable</code> here. */
054: private String narrTable = null;
055:
056: /**
057: * Creates a new <code>TableColumnDef</code> instance.
058: *
059: * @param name a <code>String</code> value
060: * @param type a <code>char</code> value
061: * @param elementsNumber an <code>int</code> value
062: * @param keyType a <code>char</code> value
063: * @param colDesc a <code>String</code> value
064: * @param valDescTableName a <code>String</code> value
065: * @param thematicIdx a <code>String</code> value
066: * @param narrTable a <code>String</code> value
067: */
068: public TableColumnDef(String name, char type, int elementsNumber,
069: char keyType, String colDesc, String valDescTableName,
070: String thematicIdx, String narrTable) {
071: this .name = name;
072: this .type = type;
073: this .elementsNumber = elementsNumber;
074: this .keyType = keyType;
075: this .colDesc = colDesc;
076: this .valDescTableName = valDescTableName;
077: this .thematicIdx = thematicIdx;
078: this .narrTable = narrTable;
079: }
080:
081: /**
082: * Describe <code>toString</code> method here.
083: *
084: * @return a <code>String</code> value
085: */
086: public String toString() {
087: String emptyStr = "";
088: StringBuffer buff = new StringBuffer();
089: StringBuffer sb = null;
090: sb = new StringBuffer(emptyStr + name);
091: sb.setLength(16);
092: buff.append(sb);
093: sb = new StringBuffer(emptyStr + type);
094: sb.setLength(5);
095: buff.append(sb);
096: sb = new StringBuffer(emptyStr + elementsNumber);
097: sb.setLength(5);
098: buff.append(sb);
099: sb = new StringBuffer(emptyStr + keyType);
100: sb.setLength(4);
101: buff.append(sb);
102: sb = new StringBuffer(emptyStr + colDesc);
103: sb.setLength(55);
104: buff.append(sb);
105: sb = new StringBuffer(emptyStr + valDescTableName);
106: sb.setLength(5);
107: buff.append(sb);
108: sb = new StringBuffer(emptyStr + thematicIdx);
109: sb.setLength(5);
110: buff.append(sb);
111: sb = new StringBuffer(emptyStr + narrTable);
112: sb.setLength(5);
113: buff.append(sb);
114:
115: return buff.toString();
116: }
117:
118: /**
119: * Gets the value of name
120: *
121: * @return the value of name
122: */
123: public String getName() {
124: return this .name;
125: }
126:
127: /**
128: * Gets the value of type
129: *
130: * @return the value of type
131: */
132: public char getType() {
133: return this .type;
134: }
135:
136: /**
137: * Gets the value of elementsNumber
138: *
139: * @return the value of elementsNumber
140: */
141: public int getElementsNumber() {
142: return this .elementsNumber;
143: }
144:
145: /**
146: * Gets the value of keyType
147: *
148: * @return the value of keyType
149: */
150: public char getKeyType() {
151: return this .keyType;
152: }
153:
154: /**
155: * Gets the value of colDesc
156: *
157: * @return the value of colDesc
158: */
159: public String getColDesc() {
160: return this .colDesc;
161: }
162:
163: /**
164: * Gets the value of valDescTableName
165: *
166: * @return the value of valDescTableName
167: */
168: public String getValDescTableName() {
169: return this .valDescTableName;
170: }
171:
172: /**
173: * Gets the value of thematicIdx
174: *
175: * @return the value of thematicIdx
176: */
177: public String getThematicIdx() {
178: return this .thematicIdx;
179: }
180:
181: /**
182: * Gets the value of narrTable
183: *
184: * @return the value of narrTable
185: */
186: public String getNarrTable() {
187: return this .narrTable;
188: }
189:
190: /**
191: * Describe <code>getColumnSize</code> method here.
192: *
193: * @return an <code>int</code> value
194: */
195: public int getColumnSize() {
196: return DataUtils.getDataTypeSize(type) * elementsNumber;
197: }
198:
199: /**
200: * Describe <code>isNumeric</code> method here.
201: *
202: * @return a <code>boolean</code> value
203: */
204: public boolean isNumeric() {
205: return DataUtils.isNumeric(type);
206: }
207: }
208:
209: // TableColumnDef
|