Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/jdk.jdi/share/classes/com/sun/tools/jdi/BooleanValueImpl.java
41161 views
1
/*
2
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
package com.sun.tools.jdi;
27
28
import com.sun.jdi.BooleanValue;
29
import com.sun.jdi.Type;
30
import com.sun.jdi.VirtualMachine;
31
32
public class BooleanValueImpl extends PrimitiveValueImpl
33
implements BooleanValue
34
{
35
private boolean value;
36
37
BooleanValueImpl(VirtualMachine aVm, boolean aValue) {
38
super(aVm);
39
value = aValue;
40
}
41
42
public boolean equals(Object obj) {
43
if ((obj != null) && (obj instanceof BooleanValue)) {
44
return (value == ((BooleanValue)obj).value()) &&
45
super.equals(obj);
46
} else {
47
return false;
48
}
49
}
50
51
public int hashCode() {
52
/*
53
* TO DO: Better hash code
54
*/
55
return intValue();
56
}
57
58
public Type type() {
59
return vm.theBooleanType();
60
}
61
62
public boolean value() {
63
return value;
64
}
65
66
public boolean booleanValue() {
67
return value;
68
}
69
70
public byte byteValue() {
71
return (byte)(value ? 1 : 0);
72
}
73
74
public char charValue() {
75
return (char)(value ? 1 : 0);
76
}
77
78
public short shortValue() {
79
return (short)(value ? 1 : 0);
80
}
81
82
public int intValue() {
83
return (value ? 1 : 0);
84
}
85
86
public long longValue() {
87
return (value ? 1 : 0);
88
}
89
90
public float floatValue() {
91
return (float)(value ? 1.0 : 0.0);
92
}
93
94
public double doubleValue() {
95
return (value ? 1.0 : 0.0);
96
}
97
98
public String toString() {
99
return "" + value;
100
}
101
102
byte typeValueKey() {
103
return JDWP.Tag.BOOLEAN;
104
}
105
}
106
107