package sds.classfile.bytecode;

import java.io.IOException;
import sds.classfile.ClassFileStream;

 /**
 * This class is for opcode has branch.<br>
 * <a href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.if_cond">
 * ifeq, ifne, iflt, ifge, ifgt, ifle
 * </a><br>
 * <a href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.if_icmp_cond">
 * if_icmpeq, if_icmpne, if_icmplt, if_icmpge, if_icmpgt, if_icmple
 * </a><br>
 * <a href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.if_acmp_cond">
 * if_acmpeq, if_acmpne
 * </a><br>
 * <a href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.goto">
 * goto
 * </a>,
 * <a href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.jsr">
 * jsr
 * </a>,
 * <a href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ifnull">
 * ifnull
 * </a>,
 * <a href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ifnonnull">
 * ifnonnull
 * </a>.
 * @author inagaki
 */
public class BranchOpcode extends OpcodeInfo {
	int branch;

	/**
	 * constructor.
	 * @param opcodeType opcode type
	 * @param pc index into the code array
	 */
	public BranchOpcode(MnemonicTable opcodeType, int pc) {
		super(opcodeType, pc);
	}

	@Override
	public void read(ClassFileStream data) throws IOException {
		this.branch = data.readShort();
	}

	/**
	 * returns branch bytes.<br>
	 * value of jump point.
	 * @return branch bytes
	 */
	public int getBranch() {
		return branch;
	}

	@Override
	public String toString() {
		return super.toString() + ": " + (branch + getPc());
	}
}
@@ -93,16 +93,248 @@
 tream;%0A%0A
+import static sds.classfile.bytecode.MnemonicTable._goto;%0Aimport static sds.classfile.bytecode.MnemonicTable.goto_w;%0Aimport static sds.classfile.bytecode.MnemonicTable.jsr;%0Aimport static sds.classfile.bytecode.MnemonicTable.jsr_w;%0A%0A
  /**%0A * 
@@ -1790,24 +1790,314 @@
 branch;%0A%09%7D%0A%0A
+%09/**%0A%09 * returns whether this opcode is if_xx.%0A%09 * @return in case of this opcode is if_xx, it returns true.%0A%09 * otherwise, it returns false.%0A%09 */%0A%09public boolean isIf() %7B%0A%09%09return  (opcodeType != _goto) && (opcodeType != goto_w) &&%0A%09%09%09%09(opcodeType !=   jsr) && (opcodeType !=  jsr_w);%0A%09%7D%0A%0A
 %09@Override%0A%09
@@ -2182,8 +2182,9 @@
 ));%0A%09%7D%0A%7D
+%0A

add method for returning whether itself is if opcode.