本文整理汇总了Java中com.sun.jdi.CharValue类的典型用法代码示例。如果您正苦于以下问题:Java CharValue类的具体用法?Java CharValue怎么用?Java CharValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CharValue类属于com.sun.jdi包,在下文中一共展示了CharValue类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: compareTo
import com.sun.jdi.CharValue; //导入依赖的package包/类
@Override
public int compareTo(CharValue o) {
return value - ((CharValue)o).value();
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:EvaluatorVisitor.java
示例2: writeUntaggedValueChecked
import com.sun.jdi.CharValue; //导入依赖的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;
}
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:72,代码来源:PacketStream.java
示例3: testValueOf
import com.sun.jdi.CharValue; //导入依赖的package包/类
@Test
public void testValueOf() throws Exception {
Map<String, Object> options = formatter.getDefaultOptions();
Value charVar = getVM().mirrorOf('c');
Value newValue = formatter.valueOf("M", charVar.type(), options);
assertTrue("should return char type", newValue instanceof CharValue);
assertEquals("should return char 'M'", 'M', ((CharValue)newValue).value());
newValue = formatter.valueOf("'N'", charVar.type(), options);
assertTrue("should return char type", newValue instanceof CharValue);
assertEquals("should return char 'N'", 'N', ((CharValue)newValue).value());
newValue = formatter.valueOf("?", charVar.type(), options);
assertTrue("should return char type", newValue instanceof CharValue);
assertEquals("should return char '?", '?', ((CharValue)newValue).value());
newValue = formatter.valueOf("/", charVar.type(), options);
assertTrue("should return char type", newValue instanceof CharValue);
assertEquals("should return char '/'", '/', ((CharValue)newValue).value());
newValue = formatter.valueOf("'", charVar.type(), options);
assertTrue("should return char type", newValue instanceof CharValue);
assertEquals("should return char '", '\'', ((CharValue)newValue).value());
}
开发者ID:Microsoft,项目名称:java-debug,代码行数:25,代码来源:CharacterFormatterTest.java
示例4: getPrimitiveObject
import com.sun.jdi.CharValue; //导入依赖的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;
}
开发者ID:DiegoArranzGarcia,项目名称:JavaTracer,代码行数:21,代码来源:ClassUtils.java
示例5: getValue
import com.sun.jdi.CharValue; //导入依赖的package包/类
static String getValue (Value v) {
if (v == null) {
return "null";
}
if (v instanceof VoidValue) {
return "void";
}
if (v instanceof CharValue) {
return "\'" + v.toString () + "\'";
}
if (v instanceof PrimitiveValue) {
return v.toString ();
}
try {
if (v instanceof StringReference) {
String str = ShortenedStrings.getStringWithLengthControl((StringReference) v);
return "\"" + str + "\"";
}
if (v instanceof ClassObjectReference) {
return "class " + ReferenceTypeWrapper.name(ClassObjectReferenceWrapper.reflectedType((ClassObjectReference) v));
}
if (v instanceof ArrayReference) {
return "#" + ObjectReferenceWrapper.uniqueID((ArrayReference) v) +
"(length=" + ArrayReferenceWrapper.length((ArrayReference) v) + ")";
}
return "#" + ObjectReferenceWrapper.uniqueID((ObjectReference) v);
} catch (InternalExceptionWrapper iex) {
return "";
} catch (ObjectCollectedExceptionWrapper oex) {
return "";
} catch (VMDisconnectedExceptionWrapper dex) {
return "";
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:AbstractVariable.java
示例6: equals
import com.sun.jdi.CharValue; //导入依赖的package包/类
public boolean equals(Object obj) {
if ((obj != null) && (obj instanceof CharValue)) {
return (value == ((CharValue)obj).value()) &&
super.equals(obj);
} else {
return false;
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:CharValueImpl.java
示例7: wrap
import com.sun.jdi.CharValue; //导入依赖的package包/类
public static F3Value wrap(F3VirtualMachine f3vm, Value value) {
if (value == null) {
return null;
}
if (value instanceof PrimitiveValue) {
if (value instanceof BooleanValue) {
return f3vm.booleanValue((BooleanValue)value);
} else if (value instanceof CharValue) {
return f3vm.charValue((CharValue)value);
} else if (value instanceof ByteValue) {
return f3vm.byteValue((ByteValue)value);
} else if (value instanceof ShortValue) {
return f3vm.shortValue((ShortValue)value);
} else if (value instanceof IntegerValue) {
return f3vm.integerValue((IntegerValue)value);
} else if (value instanceof LongValue) {
return f3vm.longValue((LongValue)value);
} else if (value instanceof FloatValue) {
return f3vm.floatValue((FloatValue)value);
} else if (value instanceof DoubleValue) {
return f3vm.doubleValue((DoubleValue)value);
} else {
throw new IllegalArgumentException("illegal primitive value : " + value);
}
} else if (value instanceof VoidValue) {
return f3vm.voidValue();
} else if (value instanceof ObjectReference) {
return wrap(f3vm, (ObjectReference)value);
} else {
throw new IllegalArgumentException("illegal value: " + value);
}
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:34,代码来源:F3Wrapper.java
示例8: setValue
import com.sun.jdi.CharValue; //导入依赖的package包/类
/**
* Replace a sequence element with another value.
*
* Object values must be assignment compatible with the element type.
* (This implies that the component type must be loaded through the
* declaring class's class loader). Primitive values must be
* assignment compatible with the component type.
*
* @param value the new value
* @param index the index of the component to set. If this is beyond the
* end of the sequence, the new value is appended to the sequence.
*
* @throws InvalidTypeException if the type of <CODE><I>value</I></CODE>
* is not compatible with the declared type of sequence elements.
* @throws ClassNotLoadedException if the sequence element type
* has not yet been loaded through the appropriate class loader.
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link com.sun.jdi.VirtualMachine#canBeModified()}.
* @return a new sequence with the specified element replaced/added.
*/
public F3SequenceReference setValue(int index, Value value) {
Types type = getElementType();
switch (type) {
case INT:
return setIntValue(index, (IntegerValue)value);
case FLOAT:
return setFloatValue(index, (FloatValue)value);
case OBJECT:
return setObjectValue(index, (ObjectReference)value);
case DOUBLE:
return setDoubleValue(index, (DoubleValue)value);
case BOOLEAN:
return setBooleanValue(index, (BooleanValue)value);
case LONG:
return setLongValue(index, (LongValue)value);
case SHORT:
return setShortValue(index, (ShortValue)value);
case BYTE:
return setByteValue(index, (ByteValue)value);
case CHAR:
return setCharValue(index, (CharValue)value);
case OTHER:
return setObjectValue(index, (ObjectReference)value);
default:
throw new IllegalArgumentException("Invalid sequence element type");
}
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:47,代码来源:F3SequenceReference.java
示例9: evaluate
import com.sun.jdi.CharValue; //导入依赖的package包/类
public Object evaluate(EvaluationContextImpl context) throws EvaluateException {
Value value = (Value)myOperandEvaluator.evaluate(context);
if (value == null) {
if (myIsPrimitive) {
throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.cannot.cast.null", myCastType));
}
return null;
}
VirtualMachineProxyImpl vm = context.getDebugProcess().getVirtualMachineProxy();
if (DebuggerUtilsEx.isInteger(value)) {
value = DebuggerUtilsEx.createValue(vm, myCastType, ((PrimitiveValue)value).longValue());
if (value == null) {
throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.cannot.cast.numeric", myCastType));
}
}
else if (DebuggerUtilsEx.isNumeric(value)) {
value = DebuggerUtilsEx.createValue(vm, myCastType, ((PrimitiveValue)value).doubleValue());
if (value == null) {
throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.cannot.cast.numeric", myCastType));
}
}
else if (value instanceof BooleanValue) {
value = DebuggerUtilsEx.createValue(vm, myCastType, ((BooleanValue)value).booleanValue());
if (value == null) {
throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.cannot.cast.boolean", myCastType));
}
}
else if (value instanceof CharValue) {
value = DebuggerUtilsEx.createValue(vm, myCastType, ((CharValue)value).charValue());
if (value == null) {
throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.cannot.cast.char", myCastType));
}
}
return value;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:36,代码来源:TypeCastEvaluator.java
示例10: unbox
import com.sun.jdi.CharValue; //导入依赖的package包/类
public static Value unbox(ObjectReference val, PrimitiveType type,
ThreadReference thread,
EvaluationContext context) throws InvalidTypeException,
ClassNotLoadedException,
IncompatibleThreadStateException,
InvocationException {
ReferenceType rt = val.referenceType();
String classType = rt.name();
PrimitiveValue pv;
if (classType.equals("java.lang.Boolean")) {
pv = invokeUnboxingMethod(val, "booleanValue", thread, context);
} else if (classType.equals("java.lang.Byte")) {
pv = invokeUnboxingMethod(val, "byteValue", thread, context);
} else if (classType.equals("java.lang.Character")) {
pv = invokeUnboxingMethod(val, "charValue", thread, context);
} else if (classType.equals("java.lang.Short")) {
pv = invokeUnboxingMethod(val, "shortValue", thread, context);
} else if (classType.equals("java.lang.Integer")) {
pv = invokeUnboxingMethod(val, "intValue", thread, context);
} else if (classType.equals("java.lang.Long")) {
pv = invokeUnboxingMethod(val, "longValue", thread, context);
} else if (classType.equals("java.lang.Float")) {
pv = invokeUnboxingMethod(val, "floatValue", thread, context);
} else if (classType.equals("java.lang.Double")) {
pv = invokeUnboxingMethod(val, "doubleValue", thread, context);
//throw new RuntimeException("Invalid type while unboxing: " + type.signature()); // never happens
} else {
return val;
}
VirtualMachine vm = pv.virtualMachine();
if (type instanceof BooleanType && !(pv instanceof BooleanValue)) {
return vm.mirrorOf(pv.booleanValue());
}
if (type instanceof ByteType && !(pv instanceof ByteValue)) {
return vm.mirrorOf(pv.byteValue());
}
if (type instanceof CharType && !(pv instanceof CharValue)) {
return vm.mirrorOf(pv.charValue());
}
if (type instanceof ShortType && !(pv instanceof ShortValue)) {
return vm.mirrorOf(pv.shortValue());
}
if (type instanceof IntegerType && !(pv instanceof IntegerValue)) {
return vm.mirrorOf(pv.intValue());
}
if (type instanceof LongType && !(pv instanceof LongValue)) {
return vm.mirrorOf(pv.longValue());
}
if (type instanceof FloatType && !(pv instanceof FloatValue)) {
return vm.mirrorOf(pv.floatValue());
}
if (type instanceof DoubleType && !(pv instanceof DoubleValue)) {
return vm.mirrorOf(pv.doubleValue());
}
return pv;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:57,代码来源:EvaluatorVisitor.java
示例11: compareTo
import com.sun.jdi.CharValue; //导入依赖的package包/类
public int compareTo(CharValue obj) {
char other = obj.value();
return value() - other;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:5,代码来源:CharValueImpl.java
示例12: mirrorOf
import com.sun.jdi.CharValue; //导入依赖的package包/类
public CharValue mirrorOf(char value) {
validateVM();
return new CharValueImpl(this,value);
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:5,代码来源:VirtualMachineImpl.java
示例13: compareTo
import com.sun.jdi.CharValue; //导入依赖的package包/类
@Override
public int compareTo(CharValue o) {
return value() - o.value();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:CharValueImpl.java
示例14: getValueAsChar
import com.sun.jdi.CharValue; //导入依赖的package包/类
private CharValue getValueAsChar(int index) {
Method getAsCharMethod = virtualMachine().f3SequenceType().getAsCharMethod();
return (CharValue) getElement(getAsCharMethod, index);
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:5,代码来源:F3SequenceReference.java
示例15: setCharValue
import com.sun.jdi.CharValue; //导入依赖的package包/类
private F3SequenceReference setCharValue(int index, CharValue value) {
Method setCharElementMethod = virtualMachine().f3SequencesType().setCharElementMethod();
return setElement(setCharElementMethod, index, value);
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:5,代码来源:F3SequenceReference.java
示例16: F3CharValue
import com.sun.jdi.CharValue; //导入依赖的package包/类
public F3CharValue(F3VirtualMachine f3vm, CharValue underlying) {
super(f3vm, underlying);
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:4,代码来源:F3CharValue.java
示例17: compareTo
import com.sun.jdi.CharValue; //导入依赖的package包/类
public int compareTo(CharValue o) {
return underlying().compareTo((CharValue)F3Wrapper.unwrap(o));
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:4,代码来源:F3CharValue.java
示例18: underlying
import com.sun.jdi.CharValue; //导入依赖的package包/类
@Override
protected CharValue underlying() {
return (CharValue) super.underlying();
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:5,代码来源:F3CharValue.java
示例19: charValue
import com.sun.jdi.CharValue; //导入依赖的package包/类
protected F3CharValue charValue(CharValue value) {
return new F3CharValue(this, value);
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:4,代码来源:F3VirtualMachine.java
注:本文中的com.sun.jdi.CharValue类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论