| /******************************************************************************* |
| * Copyright (c) 2010 IBM Corporation and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * IBM Corporation - initial API and implementation |
| *******************************************************************************/ |
| package org.eclipse.wst.jsdt.debug.internal.crossfire.jsdi; |
| |
| import org.eclipse.wst.jsdt.debug.core.jsdi.BooleanValue; |
| import org.eclipse.wst.jsdt.debug.core.jsdi.VirtualMachine; |
| |
| /** |
| * Default implementation of a {@link BooleanValue} for Crossfire |
| * |
| * @since 1.0 |
| */ |
| public class CFBooleanValue extends CFMirror implements BooleanValue { |
| |
| private boolean bool = false; |
| |
| /** |
| * Constructor |
| * |
| * @param vm |
| * @param bool the underlying boolean value |
| */ |
| public CFBooleanValue(VirtualMachine vm, boolean bool) { |
| super(vm); |
| this.bool = bool; |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.wst.jsdt.debug.core.jsdi.PrimitiveValue#intValue() |
| */ |
| public int intValue() { |
| return (bool ? 1 : 0); |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.wst.jsdt.debug.core.jsdi.PrimitiveValue#doubleValue() |
| */ |
| public double doubleValue() { |
| return (bool ? 1 : 0); |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.wst.jsdt.debug.core.jsdi.PrimitiveValue#booleanValue() |
| */ |
| public boolean booleanValue() { |
| return bool; |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.wst.jsdt.debug.core.jsdi.PrimitiveValue#stringValue() |
| */ |
| public String stringValue() { |
| return Boolean.toString(bool); |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.wst.jsdt.debug.core.jsdi.Value#valueString() |
| */ |
| public String valueString() { |
| return stringValue(); |
| } |
| |
| /* (non-Javadoc) |
| * @see java.lang.Object#toString() |
| */ |
| public String toString() { |
| return stringValue(); |
| } |
| } |