svn-gvsig-desktop / trunk / libraries / libGDBMS / src / com / hardcode / gdbms / engine / values / AbstractValue.java @ 1956
History | View | Annotate | Download (4.11 KB)
1 |
package com.hardcode.gdbms.engine.values; |
---|---|
2 |
|
3 |
import com.hardcode.gdbms.engine.instruction.IncompatibleTypesException; |
4 |
|
5 |
|
6 |
/**
|
7 |
* Clase padre de todos los wrappers sobre tipos del sistema
|
8 |
*
|
9 |
* @author Fernando Gonz?lez Cort?s
|
10 |
*/
|
11 |
public abstract class AbstractValue implements Operations, Value { |
12 |
/**
|
13 |
* @see com.hardcode.gdbms.engine.instruction.Operations#and(com.hardcode.gdbms.engine.values.value);
|
14 |
*/
|
15 |
public Value and(Value value) throws IncompatibleTypesException { |
16 |
throw new IncompatibleTypesException("Cannot operate with " + value + |
17 |
" and " + this); |
18 |
} |
19 |
|
20 |
/**
|
21 |
* @see com.hardcode.gdbms.engine.instruction.Operations#or(com.hardcode.gdbms.engine.values.value);
|
22 |
*/
|
23 |
public Value or(Value value) throws IncompatibleTypesException { |
24 |
throw new IncompatibleTypesException("Cannot operate with " + value + |
25 |
" and " + this); |
26 |
} |
27 |
|
28 |
/**
|
29 |
* @see com.hardcode.gdbms.engine.instruction.Operations#producto(com.hardcode.gdbms.engine.values.value);
|
30 |
*/
|
31 |
public Value producto(Value value) throws IncompatibleTypesException { |
32 |
throw new IncompatibleTypesException("Cannot operate with " + value + |
33 |
" and " + this); |
34 |
} |
35 |
|
36 |
/**
|
37 |
* @see com.hardcode.gdbms.engine.instruction.Operations#suma(com.hardcode.gdbms.engine.values.value);
|
38 |
*/
|
39 |
public Value suma(Value value) throws IncompatibleTypesException { |
40 |
throw new IncompatibleTypesException("Cannot operate with " + value + |
41 |
" and " + this); |
42 |
} |
43 |
|
44 |
/**
|
45 |
* @see com.hardcode.gdbms.engine.instruction.Operations#inversa(com.hardcode.gdbms.engine.values.Value)
|
46 |
*/
|
47 |
public Value inversa() throws IncompatibleTypesException { |
48 |
throw new IncompatibleTypesException(this + |
49 |
" does not have inverse value");
|
50 |
} |
51 |
|
52 |
/**
|
53 |
* @see com.hardcode.gdbms.engine.instruction.Operations#equals(com.hardcode.gdbms.engine.values.Value)
|
54 |
*/
|
55 |
public Value equals(Value value) throws IncompatibleTypesException { |
56 |
throw new IncompatibleTypesException("Cannot operate with " + value + |
57 |
" and " + this); |
58 |
} |
59 |
|
60 |
/**
|
61 |
* @see com.hardcode.gdbms.engine.instruction.Operations#notEquals(com.hardcode.gdbms.engine.values.Value)
|
62 |
*/
|
63 |
public Value notEquals(Value value) throws IncompatibleTypesException { |
64 |
throw new IncompatibleTypesException("Cannot operate with " + value + |
65 |
" and " + this); |
66 |
} |
67 |
|
68 |
/**
|
69 |
* @see com.hardcode.gdbms.engine.instruction.Operations#greater(com.hardcode.gdbms.engine.values.Value)
|
70 |
*/
|
71 |
public Value greater(Value value) throws IncompatibleTypesException { |
72 |
throw new IncompatibleTypesException("Cannot operate with " + value + |
73 |
" and " + this); |
74 |
} |
75 |
|
76 |
/**
|
77 |
* @see com.hardcode.gdbms.engine.instruction.Operations#less(com.hardcode.gdbms.engine.values.Value)
|
78 |
*/
|
79 |
public Value less(Value value) throws IncompatibleTypesException { |
80 |
throw new IncompatibleTypesException("Cannot operate with " + value + |
81 |
" and " + this); |
82 |
} |
83 |
|
84 |
/**
|
85 |
* @see com.hardcode.gdbms.engine.instruction.Operations#greaterEqual(com.hardcode.gdbms.engine.values.Value)
|
86 |
*/
|
87 |
public Value greaterEqual(Value value) throws IncompatibleTypesException { |
88 |
throw new IncompatibleTypesException("Cannot operate with " + value + |
89 |
" and " + this); |
90 |
} |
91 |
|
92 |
/**
|
93 |
* @see com.hardcode.gdbms.engine.instruction.Operations#lessEqual(com.hardcode.gdbms.engine.values.Value)
|
94 |
*/
|
95 |
public Value lessEqual(Value value) throws IncompatibleTypesException { |
96 |
throw new IncompatibleTypesException("Cannot operate with " + value + |
97 |
" and " + this); |
98 |
} |
99 |
|
100 |
/**
|
101 |
* @see com.hardcode.gdbms.engine.values.Operations#like(com.hardcode.gdbms.engine.values.Value)
|
102 |
*/
|
103 |
public Value like(Value value) throws IncompatibleTypesException { |
104 |
throw new IncompatibleTypesException("Cannot operate with " + value + |
105 |
" and " + this); |
106 |
} |
107 |
|
108 |
/**
|
109 |
* @see com.hardcode.gdbms.engine.values.Value#doEquals(java.lang.Object)
|
110 |
*/
|
111 |
public boolean doEquals(Object obj) { |
112 |
if (obj instanceof Value) { |
113 |
try {
|
114 |
return ((BooleanValue) this.equals((Value) obj)).getValue(); |
115 |
} catch (IncompatibleTypesException e) {
|
116 |
return false; |
117 |
} |
118 |
} else {
|
119 |
return false; |
120 |
} |
121 |
} |
122 |
|
123 |
/**
|
124 |
* @see java.lang.Object#equals(java.lang.Object)
|
125 |
*/
|
126 |
public boolean equals(Object obj) { |
127 |
return doEquals(obj);
|
128 |
} |
129 |
|
130 |
/**
|
131 |
* @see java.lang.Object#hashCode()
|
132 |
*/
|
133 |
public int hashCode() { |
134 |
return doHashCode();
|
135 |
} |
136 |
} |