01: /*******************************************************************************
02: * Copyright (c) 2000, 2005 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jdi.internal;
11:
12: import java.io.DataInputStream;
13: import java.io.DataOutputStream;
14: import java.io.IOException;
15:
16: import org.eclipse.jdi.internal.jdwp.JdwpID;
17:
18: import com.sun.jdi.BooleanValue;
19: import com.sun.jdi.Type;
20:
21: /**
22: * this class implements the corresponding interfaces
23: * declared by the JDI specification. See the com.sun.jdi package
24: * for more information.
25: *
26: */
27: public class BooleanValueImpl extends PrimitiveValueImpl implements
28: BooleanValue {
29: /** JDWP Tag. */
30: public static final byte tag = JdwpID.BOOLEAN_TAG;
31:
32: /**
33: * Creates new instance.
34: */
35: public BooleanValueImpl(VirtualMachineImpl vmImpl, Boolean value) {
36: super ("BooleanValue", vmImpl, value); //$NON-NLS-1$
37: }
38:
39: /**
40: * @returns tag.
41: */
42: public byte getTag() {
43: return tag;
44: }
45:
46: /**
47: * @returns type of value.
48: */
49: public Type type() {
50: return virtualMachineImpl().getBooleanType();
51: }
52:
53: /**
54: * @returns Value.
55: */
56: public boolean value() {
57: return booleanValue();
58: }
59:
60: /**
61: * @return Reads and returns new instance.
62: */
63: public static BooleanValueImpl read(MirrorImpl target,
64: DataInputStream in) throws IOException {
65: VirtualMachineImpl vmImpl = target.virtualMachineImpl();
66: boolean value = target.readBoolean("booleanValue", in); //$NON-NLS-1$
67: return new BooleanValueImpl(vmImpl, Boolean.valueOf(value));
68: }
69:
70: /**
71: * Writes value without value tag.
72: */
73: public void write(MirrorImpl target, DataOutputStream out)
74: throws IOException {
75: target.writeBoolean(((Boolean) fValue).booleanValue(),
76: "booleanValue", out); //$NON-NLS-1$
77: }
78: }
|