/** * Removes all of the instructions of this list. */ public void clear() { removeAll(false); }
/** Removes all the instructions of this list. */ public void clear() { removeAll(false); }
/** * Adds the given instructions to the end of this list. * * @param insnList an instruction list, which is cleared during the process. This list must be * different from 'this'. */ public void add(final InsnList insnList) { if (insnList.size == 0) { return; } size += insnList.size; if (lastInsn == null) { firstInsn = insnList.firstInsn; lastInsn = insnList.lastInsn; } else { AbstractInsnNode firstInsnListElement = insnList.firstInsn; lastInsn.nextInsn = firstInsnListElement; firstInsnListElement.previousInsn = lastInsn; lastInsn = insnList.lastInsn; } cache = null; insnList.removeAll(false); }
/** * Inserts the given instructions at the beginning of this list. * * @param insnList an instruction list, which is cleared during the process. This list must be * different from 'this'. */ public void insert(final InsnList insnList) { if (insnList.size == 0) { return; } size += insnList.size; if (firstInsn == null) { firstInsn = insnList.firstInsn; lastInsn = insnList.lastInsn; } else { AbstractInsnNode lastInsnListElement = insnList.lastInsn; firstInsn.previousInsn = lastInsnListElement; lastInsnListElement.nextInsn = firstInsn; firstInsn = insnList.firstInsn; } cache = null; insnList.removeAll(false); }
/** * Adds the given instructions to the end of this list. * * @param insns * an instruction list, which is cleared during the process. This * list must be different from 'this'. */ public void add(final InsnList insns) { if (insns.size == 0) { return; } size += insns.size; if (last == null) { first = insns.first; last = insns.last; } else { AbstractInsnNode elem = insns.first; last.next = elem; elem.prev = last; last = insns.last; } cache = null; insns.removeAll(false); }
/** * Inserts the given instructions at the begining of this list. * * @param insns * an instruction list, which is cleared during the process. This * list must be different from 'this'. */ public void insert(final InsnList insns) { if (insns.size == 0) { return; } size += insns.size; if (first == null) { first = insns.first; last = insns.last; } else { AbstractInsnNode elem = insns.last; first.prev = elem; elem.next = first; first = insns.first; } cache = null; insns.removeAll(false); }
/** * Inserts the given instructions after the specified instruction. * * @param previousInsn an instruction <i>of this list</i> after which the instructions must be * inserted. * @param insnList the instruction list to be inserted, which is cleared during the process. This * list must be different from 'this'. */ public void insert(final AbstractInsnNode previousInsn, final InsnList insnList) { if (insnList.size == 0) { return; } size += insnList.size; AbstractInsnNode firstInsnListElement = insnList.firstInsn; AbstractInsnNode lastInsnListElement = insnList.lastInsn; AbstractInsnNode nextInsn = previousInsn.nextInsn; if (nextInsn == null) { lastInsn = lastInsnListElement; } else { nextInsn.previousInsn = lastInsnListElement; } previousInsn.nextInsn = firstInsnListElement; lastInsnListElement.nextInsn = nextInsn; firstInsnListElement.previousInsn = previousInsn; cache = null; insnList.removeAll(false); }
/** * Inserts the given instructions before the specified instruction. * * @param nextInsn an instruction <i>of this list</i> before which the instructions must be * inserted. * @param insnList the instruction list to be inserted, which is cleared during the process. This * list must be different from 'this'. */ public void insertBefore(final AbstractInsnNode nextInsn, final InsnList insnList) { if (insnList.size == 0) { return; } size += insnList.size; AbstractInsnNode firstInsnListElement = insnList.firstInsn; AbstractInsnNode lastInsnListElement = insnList.lastInsn; AbstractInsnNode previousInsn = nextInsn.previousInsn; if (previousInsn == null) { firstInsn = firstInsnListElement; } else { previousInsn.nextInsn = firstInsnListElement; } nextInsn.previousInsn = lastInsnListElement; lastInsnListElement.nextInsn = nextInsn; firstInsnListElement.previousInsn = previousInsn; cache = null; insnList.removeAll(false); }
/** * Inserts the given instructions after the specified instruction. * * @param location * an instruction <i>of this list</i> after which the * instructions must be inserted. * @param insns * the instruction list to be inserted, which is cleared during * the process. This list must be different from 'this'. */ public void insert(final AbstractInsnNode location, final InsnList insns) { if (insns.size == 0) { return; } size += insns.size; AbstractInsnNode ifirst = insns.first; AbstractInsnNode ilast = insns.last; AbstractInsnNode next = location.next; if (next == null) { last = ilast; } else { next.prev = ilast; } location.next = ifirst; ilast.next = next; ifirst.prev = location; cache = null; insns.removeAll(false); }
/** * Inserts the given instructions before the specified instruction. * * @param location * an instruction <i>of this list</i> before which the * instructions must be inserted. * @param insns * the instruction list to be inserted, which is cleared during * the process. This list must be different from 'this'. */ public void insertBefore(final AbstractInsnNode location, final InsnList insns) { if (insns.size == 0) { return; } size += insns.size; AbstractInsnNode ifirst = insns.first; AbstractInsnNode ilast = insns.last; AbstractInsnNode prev = location.prev; if (prev == null) { first = ifirst; } else { prev.next = ifirst; } location.prev = ilast; ilast.next = location; ifirst.prev = prev; cache = null; insns.removeAll(false); }