package uk.ac.ebi.quickgo.annotation.download.converter.helpers;

import java.util.Objects;

/**
 /**
 * Return a version of the qualifier suitable for output to the user, replacing nulls with empty strings, and
 * ensuring the 'not' appears in upper case.
 * @author Tony Wardell
 * Date: 10/04/2018
 * Time: 10:46
 * Created with IntelliJ IDEA.
 */
public class Qualifier {

    private static final String EMPTY_STRING = "";

    private Qualifier() {}

    /**
     * For GAF, there are a limited set of usable values, otherwise show a empty string.
     * @param qualifier input string
     * @return string representation for GAF format.
     */
    public static String gafQualifierAsString(String qualifier) {

        if (Objects.isNull(qualifier)) {
            return EMPTY_STRING;
        }

        String lcQualifier = qualifier.toLowerCase();

        if (lcQualifier.contains("contributes_to") || lcQualifier.contains("colocalizes_with")) {
            if (lcQualifier.contains("not")) {
                return showNotInUpperCase(qualifier);
            } else {
                return qualifier;
            }
        } else {
            //For the qualifiers that are not displayed, if they are negated, then show (only the not as) NOT
            if (lcQualifier.contains("not")) {
                return "NOT";
            }
        }
        return EMPTY_STRING;
    }

    private static String showNotInUpperCase(String qualifier) {
        return qualifier.replace("not", "NOT");
    }
}

@@ -420,16 +420,264 @@
 NG = %22%22;
+%0A    private static final String CONTRIBUTES_TO = %22contributes_to%22;%0A    private static final String COLOCALIZES_WITH = %22colocalizes_with%22;%0A    private static final String NOT_LOWERCASE = %22not%22;%0A    private static final String NOT_UPPERCASE = %22NOT%22;
 %0A%0A    pr
@@ -1133,32 +1133,30 @@
 ontains(
-%22contributes_to%22
+CONTRIBUTES_TO
 ) %7C%7C lcQ
@@ -1173,34 +1173,32 @@
 ontains(
-%22colocalizes_with%22
+COLOCALIZES_WITH
 )) %7B%0A   
@@ -1223,37 +1223,45 @@
 lifier.contains(
-%22not%22
+NOT_LOWERCASE
 )) %7B%0A           
@@ -1536,21 +1536,29 @@
 ontains(
-%22not%22
+NOT_LOWERCASE
 )) %7B%0A   
@@ -1577,21 +1577,29 @@
  return 
-%22
 NOT
-%22
+_UPPERCASE
 ;%0A      
@@ -1754,20 +1754,36 @@
 ace(
-%22not%22
+NOT_LOWERCASE
 , 
-%22
 NOT
-%22
+_UPPERCASE
 );%0A 

Use constants