class CoverageMetaData {

    public static DataType findCoverageDataType(String string) {
        string = string.toUpperCase();

        for (PrimitiveDataType dataType : PrimitiveDataType.values()) {
            if (string.equals(dataType.name().toUpperCase())) {
                return dataType;
            }
        }

        if (string.contains("INT")) {
            // Bits
            if (string.endsWith("16")) {
                return PrimitiveDataType.SHORT;
            }
            if (string.endsWith("32")) {
                return PrimitiveDataType.INT;
            }
            if (string.endsWith("64")) {
                return PrimitiveDataType.LONG;
            }
            // Bytes
            if (string.endsWith("1")) {
                return PrimitiveDataType.BYTE;
            }
            if (string.endsWith("2")) {
                return PrimitiveDataType.SHORT;
            }
            if (string.endsWith("4")) {
                return PrimitiveDataType.INT;
            }
            // Byte or Bit?  Assume Byte as it's larger
            if (string.endsWith("8")) {
                return PrimitiveDataType.LONG;
//                return PrimitiveDataType.BYTE;
            }
        }
        
        if (string.contains("INTEGER")) {
            return PrimitiveDataType.INT;
        }

        if (string.contains("FLOAT")) {
            // Bits
            if (string.endsWith("32")) {
                return PrimitiveDataType.FLOAT;
            }
            if (string.endsWith("64")) {
                return PrimitiveDataType.DOUBLE;
            }
            // Bytes
            if (string.endsWith("4")) {
                return PrimitiveDataType.FLOAT;
            }
            if (string.endsWith("8")) {
                return PrimitiveDataType.DOUBLE;
            }
        }

        return UnknownDataType;
    }

}