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:
020: /**
021: * RowField.java Created: Mon Jan 27 13:58:34 2003
022: *
023: * @author <a href="mailto:kobit@users.sourceforge.net">Artur Hefczyc</a>
024: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/unsupported/vpf/src/main/java/org/geotools/data/vpf/io/RowField.java $
025: * @version $Id: RowField.java 20876 2006-08-07 12:51:29Z jgarnett $
026: */
027: public class RowField extends Number implements DataTypesDefinition {
028: /**
029: * Describe variable <code>value</code> here.
030: *
031: */
032: private Object value = null;
033:
034: /**
035: * Describe variable <code>type</code> here.
036: *
037: */
038: private char type = CHAR_NULL_VALUE;
039:
040: /**
041: * Creates a new <code><code>RowField</code></code> instance.
042: *
043: * @param value an <code><code>Object</code></code> value
044: * @param type a <code><code>char</code></code> value
045: */
046: public RowField(Object value, char type) {
047: this .value = value;
048: this .type = type;
049: }
050:
051: /**
052: * Method <code>toString</code> is used to perform
053: *
054: * @return a <code><code>String</code></code> value
055: */
056: public String toString() {
057: if (value != null) {
058: return value.toString().trim();
059: } else {
060: return null;
061: }
062: }
063:
064: /**
065: * Method <code>equals</code> is used to perform
066: *
067: * @param obj an <code><code>Object</code></code> value
068: * @return a <code><code>boolean</code></code> value
069: */
070: public boolean equals(Object obj) {
071: if ((obj == null) || !(obj instanceof RowField)) {
072: return false;
073: }
074: return toString().equals(obj.toString());
075: }
076:
077: public int hashCode() {
078: return toString().hashCode();
079: }
080:
081: /**
082: * Method <code>getType</code> is used to perform
083: *
084: * @return a <code><code>char</code></code> value
085: */
086: public char getType() {
087: return type;
088: }
089:
090: /**
091: * Method <code>getValue</code> is used to perform
092: *
093: * @return an <code><code>Object</code></code> value
094: */
095: public Object getValue() {
096: return value;
097: }
098:
099: /* (non-Javadoc)
100: * @see java.lang.Number#intValue()
101: */
102: public int intValue() {
103: return ((Number) value).intValue();
104: }
105:
106: /* (non-Javadoc)
107: * @see java.lang.Number#longValue()
108: */
109: public long longValue() {
110: return ((Number) value).longValue();
111: }
112:
113: /* (non-Javadoc)
114: * @see java.lang.Number#byteValue()
115: */
116: public byte byteValue() {
117: return ((Number) value).byteValue();
118: }
119:
120: /* (non-Javadoc)
121: * @see java.lang.Number#shortValue()
122: */
123: public short shortValue() {
124: return ((Number) value).shortValue();
125: }
126:
127: /* (non-Javadoc)
128: * @see java.lang.Number#floatValue()
129: */
130: public float floatValue() {
131: return ((Number) value).floatValue();
132: }
133:
134: /* (non-Javadoc)
135: * @see java.lang.Number#doubleValue()
136: */
137: public double doubleValue() {
138: return ((Number) value).doubleValue();
139: }
140:
141: }
|