<commit_before>package sec.web.renderer.utilities;

import ArmyC2.C2SD.Rendering.JavaRenderer;
import ArmyC2.C2SD.Rendering.TacticalGraphicIconRenderer;
import ArmyC2.C2SD.Utilities.ErrorLogger;
import ArmyC2.C2SD.Utilities.MilStdAttributes;
import ArmyC2.C2SD.Utilities.MilStdSymbol;
import ArmyC2.C2SD.Utilities.ModifiersUnits;
//import ArmyC2.C2SD.Utilities.MilStdAttributes;
import ArmyC2.C2SD.Utilities.RendererSettings;
import ArmyC2.C2SD.Utilities.SymbolDef;
import ArmyC2.C2SD.Utilities.SymbolDefTable;
import ArmyC2.C2SD.Utilities.SymbolUtilities;
import java.awt.Color;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import sec.web.json.utilities.JSONArray;
import sec.web.json.utilities.JSONException;
import sec.web.json.utilities.JSONObject;

/**
 *
 * @author stephen.pinizzotto
 */
@SuppressWarnings("unused")
public class JavaRendererUtilities {
    
    public static String HOSTILE_FILL_COLOR = "FFFF8080";
    public static String FRIENDLY_FILL_COLOR = "FF80E0FF";
    public static String NEUTRAL_FILL_COLOR = "FFAAFFAA";    
    public static String UNKNOWN_FILL_COLOR = "FFFFFF80";
    
    /**
     * Returns the default MIL-STD-2525C fill color for a symbol
     * code in ARGB format.  The string is formated AARRGGBB in
     * hex values.
     * 
     * @param symbolCode A 15 character MIL-STD-2525C symbol ID
     * @return the default "light" color of the symbol as specified
     * by the MIL-STD-2525C.  Returns null if it does not recognize
     * the affiliation.
     */
//    public static String getAffiliationFillColor(String symbolCode)
//    {
//        String color; 
//        
//        //if no color has been assigned use black, although, we should
//        // probably check affiliation here.
//        String affiliation = SymbolUtilities.getAffiliation(symbolCode);
//        if (affiliation.equals("F") || affiliation.equals("M") || 
//                affiliation.equals("D") || affiliation.equals("M"))                        
//        {
//            color = JavaRendererUtilities.FRIENDLY_FILL_COLOR;
//        }
//        else if (affiliation.equals("H") || affiliation.equals("S") || 
//                affiliation.equals("J") || affiliation.equals("K"))
//        {
//            color = JavaRendererUtilities.HOSTILE_FILL_COLOR;
//        }
//        else if (affiliation.equals("N") || affiliation.equals("L"))
//        {   
//            color = JavaRendererUtilities.NEUTRAL_FILL_COLOR;
//        }
//        else if (affiliation.equals("U") || affiliation.equals("P") || 
//                affiliation.equals("G") || affiliation.equals("W"))
//        {
//            color = JavaRendererUtilities.UNKNOWN_FILL_COLOR;
//        }
//        else
//        {   
//            color = null;
//        }                    
//        
//        return color;
//    }
    
    /**
     * Converts ARGB string format to the Google used ABGR string
     * format.  Google reverses the blue and red positioning.
     * @param rgbString A color string of the format AARRGGBB in hex value.
     * @return the reverse of the input string in hex.  The format should now be 
     * AABBGGRR
     */
    public static String ARGBtoABGR(String rgbString) {
        char[] c = rgbString.toCharArray();

        char temp1 = c[2];
        char temp2 = c[3];
        c[2] = c[6];
        c[3] = c[7];
        c[6] = temp1;
        c[7] = temp2;

        String bgrString = new String(c);

        return bgrString;
    }
    
    /**<commit_msg>Fixed error if color string is 6 characters.<commit_after>package sec.web.renderer.utilities;

import ArmyC2.C2SD.Rendering.JavaRenderer;
import ArmyC2.C2SD.Rendering.TacticalGraphicIconRenderer;
import ArmyC2.C2SD.Utilities.ErrorLogger;
import ArmyC2.C2SD.Utilities.MilStdAttributes;
import ArmyC2.C2SD.Utilities.MilStdSymbol;
import ArmyC2.C2SD.Utilities.ModifiersUnits;
//import ArmyC2.C2SD.Utilities.MilStdAttributes;
import ArmyC2.C2SD.Utilities.RendererSettings;
import ArmyC2.C2SD.Utilities.SymbolDef;
import ArmyC2.C2SD.Utilities.SymbolDefTable;
import ArmyC2.C2SD.Utilities.SymbolUtilities;
import java.awt.Color;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import sec.web.json.utilities.JSONArray;
import sec.web.json.utilities.JSONException;
import sec.web.json.utilities.JSONObject;

/**
 *
 * @author stephen.pinizzotto
 */
@SuppressWarnings("unused")
public class JavaRendererUtilities {
    
    public static String HOSTILE_FILL_COLOR = "FFFF8080";
    public static String FRIENDLY_FILL_COLOR = "FF80E0FF";
    public static String NEUTRAL_FILL_COLOR = "FFAAFFAA";    
    public static String UNKNOWN_FILL_COLOR = "FFFFFF80";
    
    /**
     * Returns the default MIL-STD-2525C fill color for a symbol
     * code in ARGB format.  The string is formated AARRGGBB in
     * hex values.
     * 
     * @param symbolCode A 15 character MIL-STD-2525C symbol ID
     * @return the default "light" color of the symbol as specified
     * by the MIL-STD-2525C.  Returns null if it does not recognize
     * the affiliation.
     */
//    public static String getAffiliationFillColor(String symbolCode)
//    {
//        String color; 
//        
//        //if no color has been assigned use black, although, we should
//        // probably check affiliation here.
//        String affiliation = SymbolUtilities.getAffiliation(symbolCode);
//        if (affiliation.equals("F") || affiliation.equals("M") || 
//                affiliation.equals("D") || affiliation.equals("M"))                        
//        {
//            color = JavaRendererUtilities.FRIENDLY_FILL_COLOR;
//        }
//        else if (affiliation.equals("H") || affiliation.equals("S") || 
//                affiliation.equals("J") || affiliation.equals("K"))
//        {
//            color = JavaRendererUtilities.HOSTILE_FILL_COLOR;
//        }
//        else if (affiliation.equals("N") || affiliation.equals("L"))
//        {   
//            color = JavaRendererUtilities.NEUTRAL_FILL_COLOR;
//        }
//        else if (affiliation.equals("U") || affiliation.equals("P") || 
//                affiliation.equals("G") || affiliation.equals("W"))
//        {
//            color = JavaRendererUtilities.UNKNOWN_FILL_COLOR;
//        }
//        else
//        {   
//            color = null;
//        }                    
//        
//        return color;
//    }
    
    /**
     * Converts ARGB string format to the Google used ABGR string
     * format.  Google reverses the blue and red positioning.
     * @param rgbString A color string of the format AARRGGBB in hex value.
     * @return the reverse of the input string in hex.  The format should now be 
     * AABBGGRR
     */
    public static String ARGBtoABGR(String rgbString) {
        if(rgbString.length()==6)
        {
            String s="FF";
            rgbString=s.concat(rgbString);
        }
        char[] c = rgbString.toCharArray();
        
        char temp1 = c[2];
        char temp2 = c[3];
        c[2] = c[6];
        c[3] = c[7];
        c[6] = temp1;
        c[7] = temp2;

        String bgrString = new String(c);

        return bgrString;
    }
    
    /**
{'fraction_non_alphanumeric': 0.1158316633266533, 'fraction_numerical': 0.01603206412825651, 'mean_word_length': 2.3584567070435174, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3638706', 'n_tokens_mistral': 2350, 'n_tokens_neox': 2306, 'n_words': 525}