// Path: src/main/java/com/amanvishnani/sim8085/domain/IAddress.java
// public interface IAddress {
//     String hexValue();
//     Integer intValue();
//     IData getLSB();
//     IData getMSB();
//     IData getData();
//     void setData(IData data);
//     static IAddress ZERO = Address.from(0);
//     static IAddress FFFF = Address.from("FFFF");
// }
// 
// Path: src/main/java/com/amanvishnani/sim8085/domain/IData.java
// public interface IData {
//     IData ZERO = Data.from("00");
//     String hexValue();
//     Integer intValue();
//     IOperationResult add(IData data);
//     IOperationResult add(IData data, Integer carry);
//     IOperationResult minus(IData data);
//     IRegister toRegister();
//     public IData getLSB();
// }
// 
// Path: src/main/java/com/amanvishnani/sim8085/domain/IOpcode.java
// public interface IOpcode {
//     String getInstruction();
//     IData getOpcodeData();
//     Integer getOpcodeLength();
// }


import com.amanvishnani.sim8085.domain.IAddress;
import com.amanvishnani.sim8085.domain.IData;
import com.amanvishnani.sim8085.domain.IOpcode;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
    public String extractLabel(String lineInstruction) {
        Pattern instructionPattern = Pattern.compile(LABEL_REGEX);
        Matcher m1  = instructionPattern.matcher(lineInstruction);
        if(m1.find())
            return m1.group(1);
        else
            return "";
    }

    public IData extractData(String x) {
        Pattern instructionPattern = Pattern.compile(OPERAND_DATA_REGEX);
        Matcher m1  = instructionPattern.matcher(x);
        if(m1.find()) {
            return Data.from(m1.group(2));
        } else {
            return null;
        }
    }

    public String extractOperandLabel(IOpcode opcode) {
        String x = opcode.getInstruction();
        Pattern instructionPattern = Pattern.compile(OPERAND_LABEL_REGEX);
        Matcher m1  = instructionPattern.matcher(x);
        if(m1.find()) {
            return m1.group(1);
        } else {
            return "";
        }
    }

// Path: src/main/java/com/amanvishnani/sim8085/domain/IAddress.java
// public interface IAddress {
//     String hexValue();
//     Integer intValue();
//     IData getLSB();
//     IData getMSB();
//     IData getData();
//     void setData(IData data);
//     static IAddress ZERO = Address.from(0);
//     static IAddress FFFF = Address.from("FFFF");
// }
// 
// Path: src/main/java/com/amanvishnani/sim8085/domain/IData.java
// public interface IData {
//     IData ZERO = Data.from("00");
//     String hexValue();
//     Integer intValue();
//     IOperationResult add(IData data);
//     IOperationResult add(IData data, Integer carry);
//     IOperationResult minus(IData data);
//     IRegister toRegister();
//     public IData getLSB();
// }
// 
// Path: src/main/java/com/amanvishnani/sim8085/domain/IOpcode.java
// public interface IOpcode {
//     String getInstruction();
//     IData getOpcodeData();
//     Integer getOpcodeLength();
// }


// Path: src/main/java/com/amanvishnani/sim8085/domain/Impl/Parser.java
import com.amanvishnani.sim8085.domain.IAddress;
import com.amanvishnani.sim8085.domain.IData;
import com.amanvishnani.sim8085.domain.IOpcode;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

    public String extractLabel(String lineInstruction) {
        Pattern instructionPattern = Pattern.compile(LABEL_REGEX);
        Matcher m1  = instructionPattern.matcher(lineInstruction);
        if(m1.find())
            return m1.group(1);
        else
            return "";
    }

    public IData extractData(String x) {
        Pattern instructionPattern = Pattern.compile(OPERAND_DATA_REGEX);
        Matcher m1  = instructionPattern.matcher(x);
        if(m1.find()) {
            return Data.from(m1.group(2));
        } else {
            return null;
        }
    }

    public String extractOperandLabel(IOpcode opcode) {
        String x = opcode.getInstruction();
        Pattern instructionPattern = Pattern.compile(OPERAND_LABEL_REGEX);
        Matcher m1  = instructionPattern.matcher(x);
        if(m1.find()) {
            return m1.group(1);
        } else {
            return "";
        }
    }

    public IAddress extractOperandAddress(String x) {