/** * Find the next instruction from the current iterator position that * matches the given one, according to the {@link Object#equals} methods of * the instruction types. This allows for matching based on template * instructions, as the equals methods of most instructions return * true if the information for the given instruction has not been filled * in. If a match is found, the iterator is placed after the matching * Instruction. If no match is found, moves the iterator to * {@link #afterLast}. * * @return true if match found */ public boolean searchForward(Instruction template) { if (template == null) return false; while (hasNext()) if (template.equalsInstruction(next())) return true; return false; }
/** * Find the next instruction from the current iterator position that * matches the given one, according to the {@link Object#equals} methods of * the instruction types. This allows for matching based on template * instructions, as the equals methods of most instructions return * true if the information for the given instruction has not been filled * in. If a match is found, the iterator is placed after the matching * Instruction. If no match is found, moves the iterator to * {@link #afterLast}. * * @return true if match found */ public boolean searchForward(Instruction template) { if (template == null) return false; while (hasNext()) if (template.equalsInstruction(next())) return true; return false; }
/** * Set the name of the class to load. */ private void setClassName(String name, Class wrapper) { if (_invalid) throw new IllegalStateException(); // remember the position of the code iterator Instruction before = (_code.hasNext()) ? _code.next() : null; _code.before(_ins); _code.next(); if (wrapper != null) _code.getstatic().setField(wrapper, "TYPE", Class.class); else setObject(name); // move to the old position if (before != null) _code.before(before); else _code.afterLast(); _invalid = true; }
/** * Set the name of the class to load. */ private void setClassName(String name, Class wrapper) { if (_invalid) throw new IllegalStateException(); // remember the position of the code iterator Instruction before = (_code.hasNext()) ? _code.next() : null; _code.before(_ins); _code.next(); if (wrapper != null) _code.getstatic().setField(wrapper, "TYPE", Class.class); else setObject(name); // move to the old position if (before != null) _code.before(before); else _code.afterLast(); _invalid = true; }