/** * 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 closest previous 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 before the matching Instruction. If no match is found, * moves the iterator to {@link #beforeFirst}. * * @return true if match found */ public boolean searchBackward(Instruction template) { if (template == null) return false; while (hasPrevious()) if (template.equalsInstruction(previous())) return true; return false; }
/** * Find the closest previous 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 before the matching Instruction. If no match is found, * moves the iterator to {@link #beforeFirst}. * * @return true if match found */ public boolean searchBackward(Instruction template) { if (template == null) return false; while (hasPrevious()) if (template.equalsInstruction(previous())) 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; }
/** * JumpInstructions are equal if they represent the same operation and * the instruction they jump to is the * same, or if the jump Instruction of either is unset. */ public boolean equalsInstruction(Instruction other) { if (this == other) return true; if (!super.equalsInstruction(other)) return false; Instruction target = ((JumpInstruction) other).getTarget(); return target == null || getTarget() == null || target == getTarget(); }
/** * JumpInstructions are equal if they represent the same operation and * the instruction they jump to is the * same, or if the jump Instruction of either is unset. */ public boolean equalsInstruction(Instruction other) { if (this == other) return true; if (!super.equalsInstruction(other)) return false; Instruction target = ((JumpInstruction) other).getTarget(); return target == null || getTarget() == null || target == getTarget(); }
/** * FieldInstructions are equal if the field they reference is the same, * or if the field of either is unset. */ public boolean equalsInstruction(Instruction other) { if (other == this) return true; if (!(other instanceof FieldInstruction)) return false; if (!super.equalsInstruction(other)) return false; FieldInstruction ins = (FieldInstruction) other; String s1 = getFieldName(); String s2 = ins.getFieldName(); if (!(s1 == null || s2 == null || s1.equals(s2))) return false; s1 = getFieldTypeName(); s2 = ins.getFieldTypeName(); if (!(s1 == null || s2 == null || s1.equals(s2))) return false; s1 = getFieldDeclarerName(); s2 = ins.getFieldDeclarerName(); if (!(s1 == null || s2 == null || s1.equals(s2))) return false; return true; }
/** * FieldInstructions are equal if the field they reference is the same, * or if the field of either is unset. */ public boolean equalsInstruction(Instruction other) { if (other == this) return true; if (!(other instanceof FieldInstruction)) return false; if (!super.equalsInstruction(other)) return false; FieldInstruction ins = (FieldInstruction) other; String s1 = getFieldName(); String s2 = ins.getFieldName(); if (!(s1 == null || s2 == null || s1.equals(s2))) return false; s1 = getFieldTypeName(); s2 = ins.getFieldTypeName(); if (!(s1 == null || s2 == null || s1.equals(s2))) return false; s1 = getFieldDeclarerName(); s2 = ins.getFieldDeclarerName(); if (!(s1 == null || s2 == null || s1.equals(s2))) return false; return true; }
if (!(other instanceof MethodInstruction)) return false; if (!super.equalsInstruction(other)) return false;
if (!(other instanceof MethodInstruction)) return false; if (!super.equalsInstruction(other)) return false;