Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libGDBMS / src / com / hardcode / gdbms / engine / values / BooleanValue.java @ 466

History | View | Annotate | Download (2.11 KB)

1 466 fernando
/* Generated by Together */
2
package com.hardcode.gdbms.engine.values;
3
4
import com.hardcode.gdbms.engine.instruction.IncompatibleTypesException;
5
6
7
/**
8
 * Wrapper para booleanos
9
 *
10
 * @author Fernando Gonz?lez Cort?s
11
 */
12
public class BooleanValue extends Value {
13
    private boolean value;
14
15
    /**
16
     * Creates a new BooleanValue object.
17
     *
18
     * @param value Valor booleano que tendr? este objeto
19
     */
20
    public BooleanValue(boolean value) {
21
        this.value = value;
22
    }
23
24
    /**
25
     * Creates a new BooleanValue object.
26
     */
27
    public BooleanValue() {
28
    }
29
30
    /**
31
     * Establece el valor de este objeto
32
     *
33
     * @param value
34
     */
35
    public void setValue(boolean value) {
36
        this.value = value;
37
    }
38
39
    /**
40
     * Obtiene el valor de este objeto
41
     *
42
     * @return
43
     */
44
    public boolean 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.instruction.Operations#and(com.hardcode.gdbms.engine.instruction.BooleanValue)
57
     */
58
    public Value and(BooleanValue value) throws IncompatibleTypesException {
59
        BooleanValue ret = new BooleanValue();
60
        ret.setValue(this.value && value.getValue());
61
62
        return ret;
63
    }
64
65
    /**
66
     * @see com.hardcode.gdbms.engine.instruction.Operations#and(com.hardcode.gdbms.engine.instruction.BooleanValue)
67
     */
68
    public Value or(BooleanValue value) throws IncompatibleTypesException {
69
        BooleanValue ret = new BooleanValue();
70
        ret.setValue(this.value || value.getValue());
71
72
        return ret;
73
    }
74
75
    /**
76
     * @see com.hardcode.gdbms.engine.instruction.Operations#and(com.hardcode.gdbms.engine.instruction.Value)
77
     */
78
    public Value and(Value v) throws IncompatibleTypesException {
79
        return v.and((BooleanValue) this);
80
    }
81
82
    /**
83
     * @see com.hardcode.gdbms.engine.instruction.Operations#and(com.hardcode.gdbms.engine.instruction.Value)
84
     */
85
    public Value or(Value v) throws IncompatibleTypesException {
86
        return v.or((BooleanValue) this);
87
    }
88
}