// Path: src/main/java/com/amanvishnani/sim8085/Util.java
// public class Util {
//     
//     public static String padThreeZeros(String hexData) {
//         switch (hexData.length()) {
//             case 1:
//                 hexData = "000" + hexData;
//                 break;
//             case 2:
//                 hexData = "00" + hexData;
//                 break;
//             case 3:
//                 hexData = "0" + hexData;
//                 break;
//             default:
//                 break;
//         }
//         return hexData;
//     }
// 
// }
// 
// 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();
// }


import com.amanvishnani.sim8085.domain.IAddress;
import com.amanvishnani.sim8085.domain.IData;
import java.util.Objects;
import com.amanvishnani.sim8085.Util;
    public IData getLSB() {
        return LSB;
    }

    @Override
    public IData getMSB() {
        return MSB;
    }
    
    public static IAddress from(IData msb, IData lsb) {
        return new Address(msb.hexValue(), lsb.hexValue());
    }
    
    public static IAddress from(IData msb, IData lsb, IData data) {
        IAddress address = Address.from(msb, lsb);
        address.setData(data);
        return address;
    }
    
    public static IAddress from(Integer intAddress) {
        String hexAddress = Integer.toHexString(intAddress);
        return Address.from(hexAddress);
    }
    
    public static IAddress from(String hexAddress) {
        return Address.from(hexAddress, Data.from("00"));
    }
    
    public static IAddress from(String hexAddress, IData data) {
        hexAddress = hexAddress.toUpperCase();
// Path: src/main/java/com/amanvishnani/sim8085/Util.java
// public class Util {
//     
//     public static String padThreeZeros(String hexData) {
//         switch (hexData.length()) {
//             case 1:
//                 hexData = "000" + hexData;
//                 break;
//             case 2:
//                 hexData = "00" + hexData;
//                 break;
//             case 3:
//                 hexData = "0" + hexData;
//                 break;
//             default:
//                 break;
//         }
//         return hexData;
//     }
// 
// }
// 
// 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/Impl/Address.java
import com.amanvishnani.sim8085.domain.IAddress;
import com.amanvishnani.sim8085.domain.IData;
import java.util.Objects;
import com.amanvishnani.sim8085.Util;

    public IData getLSB() {
        return LSB;
    }

    @Override
    public IData getMSB() {
        return MSB;
    }
    
    public static IAddress from(IData msb, IData lsb) {
        return new Address(msb.hexValue(), lsb.hexValue());
    }
    
    public static IAddress from(IData msb, IData lsb, IData data) {
        IAddress address = Address.from(msb, lsb);
        address.setData(data);
        return address;
    }
    
    public static IAddress from(Integer intAddress) {
        String hexAddress = Integer.toHexString(intAddress);
        return Address.from(hexAddress);
    }
    
    public static IAddress from(String hexAddress) {
        return Address.from(hexAddress, Data.from("00"));
    }
    
    public static IAddress from(String hexAddress, IData data) {
        hexAddress = hexAddress.toUpperCase();
        hexAddress = Util.padThreeZeros(hexAddress);