Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/com/sun/tools/jdi/BooleanValueImpl.java
38920 views
/*1* Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package com.sun.tools.jdi;2627import com.sun.jdi.*;2829public class BooleanValueImpl extends PrimitiveValueImpl30implements BooleanValue {31private boolean value;3233BooleanValueImpl(VirtualMachine aVm,boolean aValue) {34super(aVm);3536value = aValue;37}3839public boolean equals(Object obj) {40if ((obj != null) && (obj instanceof BooleanValue)) {41return (value == ((BooleanValue)obj).value())42&& super.equals(obj);43} else {44return false;45}46}4748public int hashCode() {49/*50* TO DO: Better hash code51*/52return intValue();53}5455public Type type() {56return vm.theBooleanType();57}5859public boolean value() {60return value;61}6263public boolean booleanValue() {64return value;65}6667public byte byteValue() {68return(byte)((value)?1:0);69}7071public char charValue() {72return(char)((value)?1:0);73}7475public short shortValue() {76return(short)((value)?1:0);77}7879public int intValue() {80return (value)?1:0;81}8283public long longValue() {84return(long)((value)?1:0);85}8687public float floatValue() {88return(float)((value)?1.0:0.0);89}9091public double doubleValue() {92return (value)?1.0:0.0;93}9495public String toString() {96return "" + value;97}9899byte typeValueKey() {100return JDWP.Tag.BOOLEAN;101}102}103104105