本文整理汇总了Java中com.sun.jdi.ArrayReference.length方法的典型用法代码示例。如果您正苦于以下问题:Java ArrayReference.length方法的具体用法?Java ArrayReference.length怎么用?Java ArrayReference.length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.jdi.ArrayReference
的用法示例。
在下文中一共展示了ArrayReference.length方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleNewArray
import com.sun.jdi.ArrayReference; //导入方法依赖的package包/类
boolean handleNewArray(final ArrayReference array, final Location location, final StackFrame frame)
{
if (array == null || !manager().generateArrayEvents())
{
return false;
}
// handle the instantiation of of small arrays
if (array != null && array.length() <= EventFactoryAdapter.SMALL_ARRAY_SIZE
&& contourFactory().lookupInstanceContour(array.type().name(), array.uniqueID()) == null)
{
handleTypeLoad((ReferenceType) array.type(), frame.thread());
// a specialized new event handles the immutable length of the array
manager().jiveDispatcher().dispatchNewEvent(array, frame.thread(), array.length());
visitArrayCells(location, frame, array);
return true;
}
return false;
}
示例2: equals
import com.sun.jdi.ArrayReference; //导入方法依赖的package包/类
@Override
public boolean equals(Object obj) {
if (!(obj instanceof JDIValue)) return false;
Value v = ((JDIValue) obj).value;
if (value == null) return v == null;
if (value instanceof StringReference) {
if (!(v instanceof StringReference)) return false;
return ((StringReference) value).value().equals(((StringReference) v).value());
}
if (value instanceof ArrayReference) {
if (!(v instanceof ArrayReference)) return false;
ArrayReference a1 = (ArrayReference) value;
ArrayReference a2 = (ArrayReference) v;
if (!a1.type().equals(a2.type())) return false;
if (a1.length() != a2.length()) return false;
int n = a1.length();
for (int i = 0; i < n; i++) {
if (!new JDIValue(a1.getValue(i)).equals(new JDIValue(a2.getValue(i)))) {
return false;
}
}
return true;
}
return value.equals(v);
}
示例3: getVariables
import com.sun.jdi.ArrayReference; //导入方法依赖的package包/类
@Override
public List<Variable> getVariables() {
if (variables.get() == null) {
synchronized (variables) {
if (variables.get() == null) {
if (isPrimitive()) {
variables.set(Collections.emptyList());
} else if (isArray()) {
variables.set(new LinkedList<>());
ArrayReference array = (ArrayReference) jdiValue;
for (int i = 0; i < array.length(); i++) {
variables.get().add(new JdbArrayElement(array.getValue(i), i, variablePath));
}
} else {
ObjectReference object = (ObjectReference) jdiValue;
variables.set(
object
.referenceType()
.allFields()
.stream()
.map(f -> new JdbField(f, object, variablePath))
.sorted(new JdbFieldComparator())
.collect(Collectors.toList()));
}
}
}
}
return variables.get();
}
示例4: visitArrayCells
import com.sun.jdi.ArrayReference; //导入方法依赖的package包/类
private boolean visitArrayCells(final Location location, final StackFrame frame,
final ArrayReference arrayRef)
{
// only process small arrays
if (!manager().generateArrayEvents() || arrayRef == null
|| arrayRef.length() > EventFactoryAdapter.SMALL_ARRAY_SIZE)
{
return false;
}
// retrieve the array reference type
final ArrayType at = (ArrayType) arrayRef.type();
// retrieve the array contour
final IContextContour array = contourFactory().lookupInstanceContour(at.name(),
arrayRef.uniqueID());
// make sure the respective array contour exists
if (array == null)
{
return false;
}
return visitArrayCells(location, frame, arrayRef, array);
}
示例5: getValues
import com.sun.jdi.ArrayReference; //导入方法依赖的package包/类
protected static List<Value> getValues(ArrayReference value) {
if (value.length() == 0)
return new ArrayList<Value>(0);
else
return value.getValues();
}
示例6: getArrayFromArrayReference
import com.sun.jdi.ArrayReference; //导入方法依赖的package包/类
private Data getArrayFromArrayReference(boolean forceWriteContent, String name,ArrayReference value, List<Long> objectsProcessed) {
Data object = null;
long arrayID = value.uniqueID();
if (forceWriteContent || !isExcludedClass(value)){
if (objectsProcessed.contains(arrayID)){
object = new ObjectData(name,value.uniqueID(),null,null,null,getClass(value.referenceType())+ "[]");
} else {
List<Data> elements = new ArrayList<>();
List<Value> values = value.getValues();
objectsProcessed.add(arrayID);
for (int i=0;i<values.size();i++){
Value v = values.get(i);
elements.add(getObj("["+i+"]",v,objectsProcessed));
}
object = new ArrayData(name,arrayID,elements,value.length(),getClass(value.referenceType()));
}
} else {
object = new IgnoredData(getClass(value.referenceType()),name);
}
return object;
}