@Override public Iterator<Instance> walk(Instance instance) { Object t = instance.getValueOfField("table"); if (t instanceof ObjectArrayInstance) { return new InstanceIterator(".table", (ObjectArrayInstance) t); } else { return Collections.<Instance>emptySet().iterator(); } }
@Override public Iterator<Move> track(Instance instance) { Object t = instance.getValueOfField("table"); if (t instanceof ObjectArrayInstance) { return new MoveIterator(".table", (ObjectArrayInstance) t); } else { return Collections.<Move>emptySet().iterator(); } }
static Properties getProperties(Instance propertiesInstance) { ObjectArrayDump entriesObj = (ObjectArrayDump) propertiesInstance.getValueOfField("table"); // NOI18N if (entriesObj != null) { Instance defaultsObj = (Instance) propertiesInstance.getValueOfField("defaults"); // NOI18N Iterator<Instance> enIt = entriesObj.getValues().iterator(); Properties props; if (defaultsObj != null) { props = new Properties(getProperties(defaultsObj)); } else { props = new Properties(); } while (enIt.hasNext()) { Instance entry = (Instance) enIt.next(); for (; entry != null; entry = (Instance) entry.getValueOfField("next")) { // NOI18N Instance key = (Instance) entry.getValueOfField("key"); // NOI18N Instance val = (Instance) entry.getValueOfField("value"); // NOI18N if (key != null) { props.setProperty(getString(key), getString(val)); } } } return props; } return null; }
static String getString(Instance stringInstance) { if (stringInstance == null) { return "*null*"; // NOI18N } String className = stringInstance.getJavaClass().getName(); if (String.class.getName().equals(className)) { PrimitiveArrayDump chars = (PrimitiveArrayDump) stringInstance.getValueOfField("value"); // NOI18N if (chars != null) { Integer offset = (Integer) stringInstance.getValueOfField("offset"); // NOI18N Integer len = (Integer) stringInstance.getValueOfField("count"); // NOI18N if (offset == null) { offset = Integer.valueOf(0); } if (len == null) { len = new Integer(chars.getLength()); } char[] charArr = chars.getChars(offset.intValue(), len.intValue()); return new String(charArr).intern(); } return "*null*"; // NOI18N } // what? Non-string in system properties? return "*"+className+"#"+stringInstance.getInstanceNumber()+"*"; // NOI18N } }
@SuppressWarnings("unchecked") public static <T> T primitiveValue(Instance obj) { if (obj == null) { return null; } String className = obj.getJavaClass().getName(); if (BOX_TYPES.contains(className)) { return (T)obj.getValueOfField("value"); } else { throw new IllegalArgumentException("Is not a primitive wrapper: " + obj.getInstanceId() + " (" + obj.getJavaClass().getName() + ")"); } }
public static String stringValue(Instance obj) { if (obj == null) return null; if (!"java.lang.String".equals(obj.getJavaClass().getName())) throw new IllegalArgumentException("Is not a string: " + obj.getInstanceId() + " (" + obj.getJavaClass().getName() + ")"); Boolean COMPACT_STRINGS = (Boolean) obj.getJavaClass().getValueOfStaticField("COMPACT_STRINGS"); if (COMPACT_STRINGS == null) return stringValue_java8(obj); // We're pre Java 9 Object valueInstance = obj.getValueOfField("value"); PrimitiveArrayInstance chars = (PrimitiveArrayInstance) valueInstance; byte UTF16 = 1; byte coder = COMPACT_STRINGS ? (Byte) obj.getValueOfField("coder") : UTF16; int len = chars.getLength() >> coder; char[] text = new char[len]; List<String> values = (List) chars.getValues(); if (coder == UTF16) for (int i = 0; i < text.length; i++) { text[i] = (char) ((Integer.parseInt(values.get(i*2+1)) << 8) | (Integer.parseInt(values.get(i*2)) & 0xFF)); } else for (int i = 0; i < text.length; i++) text[i] = (char) Integer.parseInt(values.get(i)); return new String(text); }
obj = i.getValueOfField(fv.getField().getName());
return (T) i.getValueOfField(fv.getField().getName());
@Override public Iterator<Instance> walk(Instance instance) { Object t = instance.getValueOfField("table"); if (t instanceof ObjectArrayInstance) { return new InstanceIterator(".table", (ObjectArrayInstance) t); } else { return Collections.<Instance>emptySet().iterator(); } }
@Override public Iterator<Move> track(Instance instance) { Object t = instance.getValueOfField("table"); if (t instanceof ObjectArrayInstance) { return new MoveIterator(".table", (ObjectArrayInstance) t); } else { return Collections.<Move>emptySet().iterator(); } }
static Properties getProperties(Instance propertiesInstance) { ObjectArrayDump entriesObj = (ObjectArrayDump) propertiesInstance.getValueOfField("table"); // NOI18N if (entriesObj != null) { Instance defaultsObj = (Instance) propertiesInstance.getValueOfField("defaults"); // NOI18N Iterator enIt = entriesObj.getValues().iterator(); Properties props; if (defaultsObj != null) { props = new Properties(getProperties(defaultsObj)); } else { props = new Properties(); } while (enIt.hasNext()) { Instance entry = (Instance) enIt.next(); for (; entry != null; entry = (Instance) entry.getValueOfField("next")) { // NOI18N Instance key = (Instance) entry.getValueOfField("key"); // NOI18N Instance val = (Instance) entry.getValueOfField("value"); // NOI18N if (key != null) { props.setProperty(getString(key), getString(val)); } } } return props; } return null; }
static Properties getProperties(Instance propertiesInstance) { ObjectArrayDump entriesObj = (ObjectArrayDump) propertiesInstance.getValueOfField("table"); // NOI18N if (entriesObj != null) { Instance defaultsObj = (Instance) propertiesInstance.getValueOfField("defaults"); // NOI18N Iterator<Instance> enIt = entriesObj.getValues().iterator(); Properties props; if (defaultsObj != null) { props = new Properties(getProperties(defaultsObj)); } else { props = new Properties(); } while (enIt.hasNext()) { Instance entry = (Instance) enIt.next(); for (; entry != null; entry = (Instance) entry.getValueOfField("next")) { // NOI18N Instance key = (Instance) entry.getValueOfField("key"); // NOI18N Instance val = (Instance) entry.getValueOfField("value"); // NOI18N if (key != null) { props.setProperty(getString(key), getString(val)); } } } return props; } return null; }
static String getString(Instance stringInstance) { if (stringInstance == null) { return "*null*"; // NOI18N } String className = stringInstance.getJavaClass().getName(); if (String.class.getName().equals(className)) { PrimitiveArrayDump chars = (PrimitiveArrayDump) stringInstance.getValueOfField("value"); // NOI18N if (chars != null) { Integer offset = (Integer) stringInstance.getValueOfField("offset"); // NOI18N Integer len = (Integer) stringInstance.getValueOfField("count"); // NOI18N if (offset == null) { offset = Integer.valueOf(0); } if (len == null) { len = new Integer(chars.getLength()); } char[] charArr = chars.getChars(offset.intValue(), len.intValue()); return new String(charArr).intern(); } return "*null*"; // NOI18N } // what? Non-string in system properties? return "*"+className+"#"+stringInstance.getInstanceNumber()+"*"; // NOI18N } }
static String getString(Instance stringInstance) { if (stringInstance == null) { return "*null*"; // NOI18N } String className = stringInstance.getJavaClass().getName(); if (String.class.getName().equals(className)) { PrimitiveArrayDump chars = (PrimitiveArrayDump) stringInstance.getValueOfField("value"); // NOI18N if (chars != null) { Integer offset = (Integer) stringInstance.getValueOfField("offset"); // NOI18N Integer len = (Integer) stringInstance.getValueOfField("count"); // NOI18N if (offset == null) { offset = Integer.valueOf(0); } if (len == null) { len = new Integer(chars.getLength()); } char[] charArr = chars.getChars(offset.intValue(), len.intValue()); return new String(charArr).intern(); } return "*null*"; // NOI18N } // what? Non-string in system properties? return "*"+className+"#"+stringInstance.getInstanceNumber()+"*"; // NOI18N } }
@SuppressWarnings("unchecked") public static <T> T primitiveValue(Instance obj) { if (obj == null) { return null; } String className = obj.getJavaClass().getName(); if (BOX_TYPES.contains(className)) { return (T)obj.getValueOfField("value"); } else { throw new IllegalArgumentException("Is not a primitive wrapper: " + obj.getInstanceId() + " (" + obj.getJavaClass().getName() + ")"); } }
public static String stringValue(Instance obj) { if (obj == null) return null; if (!"java.lang.String".equals(obj.getJavaClass().getName())) throw new IllegalArgumentException("Is not a string: " + obj.getInstanceId() + " (" + obj.getJavaClass().getName() + ")"); Boolean COMPACT_STRINGS = (Boolean) obj.getJavaClass().getValueOfStaticField("COMPACT_STRINGS"); if (COMPACT_STRINGS == null) return stringValue_java8(obj); // We're pre Java 9 Object valueInstance = obj.getValueOfField("value"); PrimitiveArrayInstance chars = (PrimitiveArrayInstance) valueInstance; byte UTF16 = 1; byte coder = COMPACT_STRINGS ? (Byte) obj.getValueOfField("coder") : UTF16; int len = chars.getLength() >> coder; char[] text = new char[len]; List<String> values = (List) chars.getValues(); if (coder == UTF16) for (int i = 0; i < text.length; i++) { text[i] = (char) ((Integer.parseInt(values.get(i*2+1)) << 8) | (Integer.parseInt(values.get(i*2)) & 0xFF)); } else for (int i = 0; i < text.length; i++) text[i] = (char) Integer.parseInt(values.get(i)); return new String(text); }
obj = i.getValueOfField(fv.getField().getName());
return (T) i.getValueOfField(fv.getField().getName());