本文整理汇总了Java中com.sun.jdi.BooleanValue类的典型用法代码示例。如果您正苦于以下问题:Java BooleanValue类的具体用法?Java BooleanValue怎么用?Java BooleanValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BooleanValue类属于com.sun.jdi包,在下文中一共展示了BooleanValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeUntaggedValueChecked
import com.sun.jdi.BooleanValue; //导入依赖的package包/类
void writeUntaggedValueChecked(Value val) throws InvalidTypeException {
byte tag = ValueImpl.typeValueKey(val);
if (isObjectTag(tag)) {
if (val == null) {
writeObjectRef(0);
} else {
if (!(val instanceof ObjectReference)) {
throw new InvalidTypeException();
}
writeObjectRef(((ObjectReferenceImpl)val).ref());
}
} else {
switch (tag) {
case JDWP.Tag.BYTE:
if(!(val instanceof ByteValue))
throw new InvalidTypeException();
writeByte(((PrimitiveValue)val).byteValue());
break;
case JDWP.Tag.CHAR:
if(!(val instanceof CharValue))
throw new InvalidTypeException();
writeChar(((PrimitiveValue)val).charValue());
break;
case JDWP.Tag.FLOAT:
if(!(val instanceof FloatValue))
throw new InvalidTypeException();
writeFloat(((PrimitiveValue)val).floatValue());
break;
case JDWP.Tag.DOUBLE:
if(!(val instanceof DoubleValue))
throw new InvalidTypeException();
writeDouble(((PrimitiveValue)val).doubleValue());
break;
case JDWP.Tag.INT:
if(!(val instanceof IntegerValue))
throw new InvalidTypeException();
writeInt(((PrimitiveValue)val).intValue());
break;
case JDWP.Tag.LONG:
if(!(val instanceof LongValue))
throw new InvalidTypeException();
writeLong(((PrimitiveValue)val).longValue());
break;
case JDWP.Tag.SHORT:
if(!(val instanceof ShortValue))
throw new InvalidTypeException();
writeShort(((PrimitiveValue)val).shortValue());
break;
case JDWP.Tag.BOOLEAN:
if(!(val instanceof BooleanValue))
throw new InvalidTypeException();
writeBoolean(((PrimitiveValue)val).booleanValue());
break;
}
}
}
示例2: testValueOf
import com.sun.jdi.BooleanValue; //导入依赖的package包/类
@Test
public void testValueOf() throws Exception {
Map<String, Object> options = formatter.getDefaultOptions();
Value boolVar = getVM().mirrorOf(true);
Value newValue = formatter.valueOf("true", boolVar.type(), options);
assertTrue("should return boolean type", newValue instanceof BooleanValue);
assertTrue("should return boolean type", ((BooleanValue)newValue).value());
assertEquals("Should be able to restore boolean value.", "true",
formatter.toString(newValue, options));
newValue = formatter.valueOf("True", boolVar.type(), options);
assertTrue("should return boolean type", newValue instanceof BooleanValue);
assertTrue("should return boolean type", ((BooleanValue)newValue).value());
newValue = formatter.valueOf("false", boolVar.type(), options);
assertTrue("should return boolean type", newValue instanceof BooleanValue);
assertFalse("should return boolean 'false'", ((BooleanValue)newValue).value());
newValue = formatter.valueOf("False", boolVar.type(), options);
assertTrue("should return boolean type", newValue instanceof BooleanValue);
assertFalse("should return boolean 'false'", ((BooleanValue)newValue).value());
newValue = formatter.valueOf("abc", boolVar.type(), options);
assertTrue("should return boolean type", newValue instanceof BooleanValue);
assertFalse("should return boolean 'false'", ((BooleanValue)newValue).value());
}
示例3: evaluate
import com.sun.jdi.BooleanValue; //导入依赖的package包/类
public Object evaluate(EvaluationContextImpl context) throws EvaluateException {
Object value;
while (true) {
value = myConditionEvaluator.evaluate(context);
if (!(value instanceof BooleanValue)) {
throw EvaluateExceptionUtil.BOOLEAN_EXPECTED;
}
else {
if (!((BooleanValue)value).booleanValue()) {
break;
}
}
if (body(context)) break;
}
return value;
}
示例4: evaluate
import com.sun.jdi.BooleanValue; //导入依赖的package包/类
public Object evaluate(EvaluationContextImpl context) throws EvaluateException {
Object value = context.getDebugProcess().getVirtualMachineProxy().mirrorOfVoid();
while (true) {
if (body(context)) break;
value = myConditionEvaluator.evaluate(context);
if (!(value instanceof BooleanValue)) {
throw EvaluateExceptionUtil.BOOLEAN_EXPECTED;
}
else {
if (!((BooleanValue)value).booleanValue()) {
break;
}
}
}
return value;
}
示例5: evaluate
import com.sun.jdi.BooleanValue; //导入依赖的package包/类
public Object evaluate(EvaluationContextImpl context) throws EvaluateException {
Object value = context.getDebugProcess().getVirtualMachineProxy().mirrorOfVoid();
value = evaluateInitialization(context, value);
while (true) {
// condition
Object codition = evaluateCondition(context);
if (codition instanceof Boolean) {
if (!(Boolean)codition) break;
}
else if (codition instanceof BooleanValue) {
if (!((BooleanValue)codition).booleanValue()) break;
}
else {
throw EvaluateExceptionUtil.BOOLEAN_EXPECTED;
}
// body
if (body(context)) break;
// update
value = evaluateUpdate(context, value);
}
return value;
}
示例6: evaluate
import com.sun.jdi.BooleanValue; //导入依赖的package包/类
public Object evaluate(EvaluationContextImpl context) throws EvaluateException {
Object value = myConditionEvaluator.evaluate(context);
if(!(value instanceof BooleanValue)) {
throw EvaluateExceptionUtil.BOOLEAN_EXPECTED;
} else {
if(((BooleanValue)value).booleanValue()) {
value = myThenEvaluator.evaluate(context);
myModifier = myThenEvaluator.getModifier();
}
else {
if(myElseEvaluator != null) {
value = myElseEvaluator.evaluate(context);
myModifier = myElseEvaluator.getModifier();
} else {
value = context.getDebugProcess().getVirtualMachineProxy().mirrorOfVoid();
myModifier = null;
}
}
}
return value;
}
示例7: evaluate
import com.sun.jdi.BooleanValue; //导入依赖的package包/类
public Object evaluate(EvaluationContextImpl context) throws EvaluateException {
Object value = myConditionEvaluator.evaluate(context);
if(!(value instanceof BooleanValue)) {
throw EvaluateExceptionUtil.BOOLEAN_EXPECTED;
} else {
if(((BooleanValue)value).booleanValue()) {
value = myThenEvaluator.evaluate(context);
myModifier = myThenEvaluator.getModifier();
}
else {
if(myElseEvaluator != null) {
value = myElseEvaluator.evaluate(context);
myModifier = myElseEvaluator.getModifier();
} else {
value = context.getDebugProcess().getVirtualMachineProxy().mirrorOf();
myModifier = null;
}
}
}
return value;
}
示例8: testEvaluate
import com.sun.jdi.BooleanValue; //导入依赖的package包/类
@Test
public void testEvaluate() throws Throwable {
ObjectReference promise = remote.evaluateForked("3+4");
ThreadReference thread = ((ThreadReference) remote.invokeMethod(
promise, "thread"));
Value result1 = remote.invokeMethod(promise, "result");
Value ex = remote.invokeMethod(promise, "throwable");
printThreadState();
VMTargetStarter.sleep(100);
printThreadState();
boolean isFinished = ((BooleanValue) remote.invokeMethod(promise,
"isFinished")).booleanValue();
assertTrue(isFinished);
ObjectReference result = (ObjectReference) remote.invokeMethod(promise,
"result");
IntegerValue intValue = (IntegerValue) remote.invokeMethod(result,
"intValue");
assertEquals(7, intValue.intValue());
}
示例9: getPrimitiveObject
import com.sun.jdi.BooleanValue; //导入依赖的package包/类
private Data getPrimitiveObject(String name, Value value) {
Data object = null;
if (value instanceof BooleanValue)
object = new SimpleData(name,((BooleanValue) value).booleanValue());
else if (value instanceof ByteValue)
object = new SimpleData(name,((ByteValue) value).byteValue());
else if (value instanceof CharValue)
object = new SimpleData(name,((CharValue) value).charValue());
else if (value instanceof DoubleValue)
object = new SimpleData(name,((DoubleValue) value).doubleValue());
else if (value instanceof FloatValue)
object = new SimpleData(name,((FloatValue) value).floatValue());
else if (value instanceof IntegerValue)
object = new SimpleData(name,((IntegerValue) value).intValue());
else if (value instanceof LongValue)
object = new SimpleData(name,((LongValue) value).longValue());
else if (value instanceof ShortValue)
object = new SimpleData(name,((ShortValue)value).shortValue());
return object;
}
示例10: retrieveScreenshots
import com.sun.jdi.BooleanValue; //导入依赖的package包/类
private static void retrieveScreenshots(JPDAThreadImpl t, final ThreadReference tr, VirtualMachine vm, DebuggerEngine engine, JPDADebuggerImpl d, final List<RemoteScreenshot> screenshots) throws RetrievalException {
try {
final ClassType windowClass = getClass(vm, tr, "javafx.stage.Window");
Method getWindows = windowClass.concreteMethodByName("impl_getWindows", "()Ljava/util/Iterator;");
Method windowName = windowClass.concreteMethodByName("impl_getMXWindowType", "()Ljava/lang/String;");
ObjectReference iterator = (ObjectReference)windowClass.invokeMethod(tr, getWindows, Collections.EMPTY_LIST, ObjectReference.INVOKE_SINGLE_THREADED);
ClassType iteratorClass = (ClassType)iterator.referenceType();
Method hasNext = iteratorClass.concreteMethodByName("hasNext", "()Z");
Method next = iteratorClass.concreteMethodByName("next", "()Ljava/lang/Object;");
boolean nextFlag = false;
do {
BooleanValue bv = (BooleanValue)iterator.invokeMethod(tr, hasNext, Collections.EMPTY_LIST, ObjectReference.INVOKE_SINGLE_THREADED);
nextFlag = bv.booleanValue();
if (nextFlag) {
ObjectReference window = (ObjectReference)iterator.invokeMethod(tr, next, Collections.EMPTY_LIST, ObjectReference.INVOKE_SINGLE_THREADED);
StringReference name = (StringReference)window.invokeMethod(tr, windowName, Collections.EMPTY_LIST, ObjectReference.INVOKE_SINGLE_THREADED);
SGComponentInfo windowInfo = new SGComponentInfo(t, window);
screenshots.add(createRemoteFXScreenshot(engine, vm, tr, name.value(), window, windowInfo));
}
} while (nextFlag);
} catch (Exception e) {
throw new RetrievalException(e.getMessage(), e);
}
}
示例11: pauseMedia
import com.sun.jdi.BooleanValue; //导入依赖的package包/类
private static void pauseMedia(ThreadReference tr, VirtualMachine vm) throws InvalidTypeException, ClassNotLoadedException, IncompatibleThreadStateException, InvocationException {
final ClassType audioClipClass = getClass(vm, tr, "com.sun.media.jfxmedia.AudioClip");
final ClassType mediaManagerClass = getClass(vm, tr, "com.sun.media.jfxmedia.MediaManager");
final InterfaceType mediaPlayerClass = getInterface(vm, tr, "com.sun.media.jfxmedia.MediaPlayer");
final ClassType playerStateEnum = getClass(vm, tr, "com.sun.media.jfxmedia.events.PlayerStateEvent$PlayerState");
if (audioClipClass != null) {
Method stopAllClips = audioClipClass.concreteMethodByName("stopAllClips", "()V");
audioClipClass.invokeMethod(tr, stopAllClips, Collections.EMPTY_LIST, ObjectReference.INVOKE_SINGLE_THREADED);
}
if (mediaManagerClass != null && mediaPlayerClass != null && playerStateEnum != null) {
Method getAllPlayers = mediaManagerClass.concreteMethodByName("getAllMediaPlayers", "()Ljava/util/List;");
ObjectReference plList = (ObjectReference)mediaManagerClass.invokeMethod(tr, getAllPlayers, Collections.EMPTY_LIST, ObjectReference.INVOKE_SINGLE_THREADED);
if (plList != null) {
ClassType listType = (ClassType)plList.referenceType();
Method iterator = listType.concreteMethodByName("iterator", "()Ljava/util/Iterator;");
ObjectReference plIter = (ObjectReference)plList.invokeMethod(tr, iterator, Collections.EMPTY_LIST, ObjectReference.INVOKE_SINGLE_THREADED);
ClassType iterType = (ClassType)plIter.referenceType();
Method hasNext = iterType.concreteMethodByName("hasNext", "()Z");
Method next = iterType.concreteMethodByName("next", "()Ljava/lang/Object;");
Field playingState = playerStateEnum.fieldByName("PLAYING");
Method getState = mediaPlayerClass.methodsByName("getState", "()Lcom/sun/media/jfxmedia/events/PlayerStateEvent$PlayerState;").get(0);
Method pausePlayer = mediaPlayerClass.methodsByName("pause", "()V").get(0);
boolean hasNextFlag = false;
do {
BooleanValue v = (BooleanValue)plIter.invokeMethod(tr, hasNext, Collections.EMPTY_LIST, ObjectReference.INVOKE_SINGLE_THREADED);
hasNextFlag = v.booleanValue();
if (hasNextFlag) {
ObjectReference player = (ObjectReference)plIter.invokeMethod(tr, next, Collections.EMPTY_LIST, ObjectReference.INVOKE_SINGLE_THREADED);
ObjectReference curState = (ObjectReference)player.invokeMethod(tr, getState, Collections.EMPTY_LIST, ObjectReference.INVOKE_SINGLE_THREADED);
if (playingState.equals(curState)) {
player.invokeMethod(tr, pausePlayer, Collections.EMPTY_LIST, ObjectReference.INVOKE_SINGLE_THREADED);
pausedPlayers.add(player);
}
}
} while (hasNextFlag);
}
}
}
示例12: sendStopUserCode
import com.sun.jdi.BooleanValue; //导入依赖的package包/类
public boolean sendStopUserCode() throws IllegalStateException {
if (closed) {
return false;
}
vm.suspend();
try {
ObjectReference myRef = getAgentObjectReference();
OUTER:
for (ThreadReference thread : vm.allThreads()) {
// could also tag the thread (e.g. using name), to find it easier
AGENT: for (StackFrame frame : thread.frames()) {
if (REMOTE_AGENT_CLASS.equals(frame.location().declaringType().name())) {
String n = frame.location().method().name();
if (AGENT_INVOKE_METHOD.equals(n) || AGENT_VARVALUE_METHOD.equals(n)) {
ObjectReference thiz = frame.thisObject();
if (myRef != null && myRef != thiz) {
break AGENT;
}
if (((BooleanValue) thiz.getValue(thiz.referenceType().fieldByName("inClientCode"))).value()) {
thiz.setValue(thiz.referenceType().fieldByName("expectingStop"), vm.mirrorOf(true));
ObjectReference stopInstance = (ObjectReference) thiz.getValue(thiz.referenceType().fieldByName("stopException"));
vm.resume();
thread.stop(stopInstance);
thiz.setValue(thiz.referenceType().fieldByName("expectingStop"), vm.mirrorOf(false));
}
return true;
}
}
}
}
} catch (ClassNotLoadedException | IncompatibleThreadStateException | InvalidTypeException ex) {
throw new IllegalStateException(ex);
} finally {
vm.resume();
}
return false;
}
示例13: evaluateCondition
import com.sun.jdi.BooleanValue; //导入依赖的package包/类
private boolean evaluateCondition(Tree arg0, EvaluationContext evaluationContext, ExpressionTree condition) {
Mirror conditionValue = condition.accept(this, evaluationContext);
if (conditionValue instanceof ObjectReference) {
conditionValue = unboxIfCan(arg0, (ObjectReference) conditionValue, evaluationContext);
}
if (!(conditionValue instanceof BooleanValue)) {
String type = "N/A"; // NOI18N
if (conditionValue instanceof Value) {
type = ((Value) conditionValue).type().name();
}
Assert.error(arg0, "notABoolean", condition.toString(), conditionValue, type);
}
return ((BooleanValue) conditionValue).value();
}
示例14: checkedBooleanValue
import com.sun.jdi.BooleanValue; //导入依赖的package包/类
final boolean checkedBooleanValue() throws InvalidTypeException {
/*
* Always disallow a conversion to boolean from any other
* primitive
*/
if (this instanceof BooleanValue) {
return booleanValue();
} else {
throw new InvalidTypeException("Can't convert non-boolean value to boolean");
}
}
示例15: equals
import com.sun.jdi.BooleanValue; //导入依赖的package包/类
public boolean equals(Object obj) {
if ((obj != null) && (obj instanceof BooleanValue)) {
return (value == ((BooleanValue)obj).value()) &&
super.equals(obj);
} else {
return false;
}
}