/** * counts all blocks including nested block that are closed off at the current pc * * @param pc * the current pc * @return how many blocks have ended at the pc */ public int countBlockEndsAtPC(int pc) { if (blocks.isEmpty()) { return 0; } int count = 0; Iterator<IfBlock> it = blocks.iterator(); while (it.hasNext()) { IfBlock block = it.next(); if (pc >= block.getStart()) { if (block.hasSubBlocks()) { count += block.getSubIfBlocks().countBlockEndsAtPC(pc); } } if (pc == block.getEnd()) { count++; } } return count; }
/** * counts all blocks including nested block that are closed off at the current pc * * @param pc * the current pc * @return how many blocks have ended at the pc */ public int countBlockEndsAtPC(int pc) { if (blocks.isEmpty()) { return 0; } int count = 0; Iterator<IfBlock> it = blocks.iterator(); while (it.hasNext()) { IfBlock block = it.next(); if (pc >= block.getStart()) { if (block.hasSubBlocks()) { count += block.getSubIfBlocks().countBlockEndsAtPC(pc); } } if (pc == block.getEnd()) { count++; } } return count; }
int blockCount = ifBlocks.countBlockEndsAtPC(getPC());
int blockCount = ifBlocks.countBlockEndsAtPC(getPC());