svn-gvsig-desktop / tags / v1_1_Build_1000 / libraries / libGDBMS / src / main / java / com / hardcode / gdbms / engine / values / IntValue.java @ 11885
History | View | Annotate | Download (2.07 KB)
1 | 3199 | fjp | package com.hardcode.gdbms.engine.values; |
---|---|---|---|
2 | |||
3 | import java.sql.Types; |
||
4 | |||
5 | |||
6 | |||
7 | /**
|
||
8 | * Wrapper sobre el tipo int
|
||
9 | *
|
||
10 | * @author Fernando Gonz?lez Cort?s
|
||
11 | */
|
||
12 | public class IntValue extends NumericValue { |
||
13 | private int value; |
||
14 | |||
15 | /**
|
||
16 | * Creates a new IntValue object.
|
||
17 | *
|
||
18 | * @param value DOCUMENT ME!
|
||
19 | */
|
||
20 | IntValue(int value) {
|
||
21 | this.value = value;
|
||
22 | } |
||
23 | |||
24 | /**
|
||
25 | * Creates a new IntValue object.
|
||
26 | */
|
||
27 | IntValue() { |
||
28 | } |
||
29 | |||
30 | /**
|
||
31 | * Establece el valor de este objeto
|
||
32 | *
|
||
33 | * @param value
|
||
34 | */
|
||
35 | public void setValue(int value) { |
||
36 | this.value = value;
|
||
37 | } |
||
38 | |||
39 | /**
|
||
40 | * Obtiene el valor de este objeto
|
||
41 | *
|
||
42 | * @return
|
||
43 | */
|
||
44 | public int getValue() { |
||
45 | return value;
|
||
46 | } |
||
47 | |||
48 | /**
|
||
49 | * @see java.lang.Object#toString()
|
||
50 | */
|
||
51 | public String toString() { |
||
52 | return "" + value; |
||
53 | } |
||
54 | |||
55 | /**
|
||
56 | * @see com.hardcode.gdbms.engine.values.NumericValue#intValue()
|
||
57 | */
|
||
58 | public int intValue() { |
||
59 | return (int) value; |
||
60 | } |
||
61 | |||
62 | /**
|
||
63 | * @see com.hardcode.gdbms.engine.values.NumericValue#longValue()
|
||
64 | */
|
||
65 | public long longValue() { |
||
66 | return (long) value; |
||
67 | } |
||
68 | |||
69 | /**
|
||
70 | * @see com.hardcode.gdbms.engine.values.NumericValue#floatValue()
|
||
71 | */
|
||
72 | public float floatValue() { |
||
73 | return (float) value; |
||
74 | } |
||
75 | |||
76 | /**
|
||
77 | * @see com.hardcode.gdbms.engine.values.NumericValue#doubleValue()
|
||
78 | */
|
||
79 | public double doubleValue() { |
||
80 | return (double) value; |
||
81 | } |
||
82 | |||
83 | /**
|
||
84 | * @see com.hardcode.gdbms.engine.values.NumericValue#getType()
|
||
85 | */
|
||
86 | public int getType() { |
||
87 | return ValueFactory.INTEGER;
|
||
88 | } |
||
89 | |||
90 | /**
|
||
91 | * @see com.hardcode.gdbms.engine.values.NumericValue#byteValue()
|
||
92 | */
|
||
93 | public byte byteValue() { |
||
94 | return (byte) value; |
||
95 | } |
||
96 | |||
97 | /**
|
||
98 | * @see com.hardcode.gdbms.engine.values.NumericValue#shortValue()
|
||
99 | */
|
||
100 | public short shortValue() { |
||
101 | return (short) value; |
||
102 | } |
||
103 | |||
104 | /**
|
||
105 | * @see com.hardcode.gdbms.engine.values.Value#getStringValue(com.hardcode.gdbms.engine.data.driver.ValueWriter)
|
||
106 | */
|
||
107 | public String getStringValue(ValueWriter writer) { |
||
108 | return writer.getStatementString(value, Types.INTEGER); |
||
109 | } |
||
110 | |||
111 | /**
|
||
112 | * @see com.hardcode.gdbms.engine.values.Value#getSQLType()
|
||
113 | */
|
||
114 | public int getSQLType() { |
||
115 | return Types.INTEGER; |
||
116 | } |
||
117 | 4851 | jmvivo | |
118 | public int getWidth() { |
||
119 | return 4; |
||
120 | } |
||
121 | 3199 | fjp | } |