Class ConflictUtility


  • public class ConflictUtility
    extends java.lang.Object
    ConflictUtility provides some constants and static methods used by the Listing Merge portion of the multi-user merge. For now, the VariousChoicesPanel and VerticalChoicesPanel use HTML in JLabels to display color etc. This is because they also show radiobuttons and checkboxes.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ADDRESS_COLOR
      Color to use for displaying addresses.
      static java.lang.String BLUE  
      static java.lang.String DARK_CYAN  
      static java.lang.String EMPHASIZE_COLOR
      Color to use for displaying emphasized text.
      static java.lang.String GRAY  
      static java.lang.String GREEN  
      static java.lang.String MAROON  
      static java.lang.String NO_VALUE
      String to display when a version doesn't have a value for an element of the program.
      static java.lang.String NUMBER_COLOR
      Color to use for displaying numeric values.
      static java.lang.String OFFSET_COLOR
      Color to use for displaying offsets.
      static java.lang.String OLIVE  
      static java.lang.String ORANGE  
      static java.lang.String PINK  
      static java.lang.String PURPLE  
      static java.lang.String YELLOW  
    • Constructor Summary

      Constructors 
      Constructor Description
      ConflictUtility()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void addAddress​(java.lang.StringBuffer buf, Address addr)
      Adds a color program address to the indicated string buffer.
      static void addCount​(java.lang.StringBuffer buf, int value)
      Adds a color number to the indicated string buffer.
      static java.lang.String colorString​(java.lang.String rgbColor, int value)
      This creates a colored number by converting the number to a string and wrapping it with an HTML font tag that has a color attribute.
      static java.lang.String colorString​(java.lang.String rgbColor, java.lang.String text)
      This creates color text by wrapping a text string with an HTML font tag that has a color attribute.
      static java.lang.String getAddressConflictCount​(int addressNum, int totalAddresses, boolean isRange)
      Creates a standard address set conflict count message.
      static java.lang.String getAddressString​(Address address)
      Creates a string containing HTML tags to represent the address in color.
      static java.lang.String getAddressString​(Address address, boolean showAddressSpace)
      Creates a string containing HTML tags to represent the address in color.
      static java.lang.String getConflictCount​(int conflictNum, int totalConflicts)
      Creates a standard conflict count message.
      static java.lang.String getConflictCount​(int conflictNum, int totalConflicts, Address addr)
      Creates a standard conflict count message for an address.
      static java.lang.String getConflictCount​(int conflictNum, int totalConflicts, AddressRange range)
      Creates a standard conflict count message for an address range.
      static java.lang.String getEmphasizeString​(java.lang.String text)
      Creates a string containing HTML tags to represent the text in color for emphasis.
      static java.lang.String getHashString​(long hash)
      Creates a string containing HTML tags to represent the hash value in color as an unsigned hexadecimal value.
      static java.lang.String getNumberString​(int count)
      Creates a string containing HTML tags to represent the integer number in color.
      static java.lang.String getOffsetString​(int offset)
      Creates a string containing HTML tags to represent the offset value in color as a hexadecimal value.
      static java.lang.String getTruncatedHTMLString​(java.lang.String originalString, int truncLength)
      Surrounds the originalString with HTML tags.
      static java.lang.String spaces​(int num)
      Creates a string for the number of spaces indicated that can be used in HTML.
      static java.lang.String wrapAsHTML​(java.lang.String text)
      Puts HTML and BODY tags around the string.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • MAROON

        public static java.lang.String MAROON
      • GREEN

        public static java.lang.String GREEN
      • BLUE

        public static java.lang.String BLUE
      • PURPLE

        public static java.lang.String PURPLE
      • DARK_CYAN

        public static java.lang.String DARK_CYAN
      • OLIVE

        public static java.lang.String OLIVE
      • ORANGE

        public static java.lang.String ORANGE
      • PINK

        public static java.lang.String PINK
      • YELLOW

        public static java.lang.String YELLOW
      • GRAY

        public static java.lang.String GRAY
      • ADDRESS_COLOR

        public static java.lang.String ADDRESS_COLOR
        Color to use for displaying addresses.
      • NUMBER_COLOR

        public static java.lang.String NUMBER_COLOR
        Color to use for displaying numeric values.
      • EMPHASIZE_COLOR

        public static java.lang.String EMPHASIZE_COLOR
        Color to use for displaying emphasized text. (for example, this is used when displaying symbols.)
      • OFFSET_COLOR

        public static java.lang.String OFFSET_COLOR
        Color to use for displaying offsets.
      • NO_VALUE

        public static java.lang.String NO_VALUE
        String to display when a version doesn't have a value for an element of the program.
    • Constructor Detail

      • ConflictUtility

        public ConflictUtility()
    • Method Detail

      • wrapAsHTML

        public static java.lang.String wrapAsHTML​(java.lang.String text)
        Puts HTML and BODY tags around the string.
      • colorString

        public static java.lang.String colorString​(java.lang.String rgbColor,
                                                   java.lang.String text)
        This creates color text by wrapping a text string with an HTML font tag that has a color attribute.
        Parameters:
        rgbColor - (eg. "#8c0000")
        text - the text to be colored
        Returns:
        the tagged string.
      • colorString

        public static java.lang.String colorString​(java.lang.String rgbColor,
                                                   int value)
        This creates a colored number by converting the number to a string and wrapping it with an HTML font tag that has a color attribute.
        Parameters:
        rgbColor - (eg. "#8c0000")
        value - the integer number
        Returns:
        the tagged string.
      • spaces

        public static java.lang.String spaces​(int num)
        Creates a string for the number of spaces indicated that can be used in HTML. This string can be used to preserve spacing.
        Parameters:
        num - the number of spaces
        Returns:
        the string representing that many spaces in HTML.
      • addCount

        public static void addCount​(java.lang.StringBuffer buf,
                                    int value)
        Adds a color number to the indicated string buffer.
        Parameters:
        buf - the string buffer
        value - the integer number
      • addAddress

        public static void addAddress​(java.lang.StringBuffer buf,
                                      Address addr)
        Adds a color program address to the indicated string buffer.
        Parameters:
        buf - the string buffer
        addr - the program address
      • getConflictCount

        public static java.lang.String getConflictCount​(int conflictNum,
                                                        int totalConflicts)
        Creates a standard conflict count message. This indicates which conflict you are resolving of some total number of conflicts.
        Parameters:
        conflictNum - the current conflict number.
        totalConflicts - the total number of conflicts
        Returns:
        the message string containing HTML tags.
      • getConflictCount

        public static java.lang.String getConflictCount​(int conflictNum,
                                                        int totalConflicts,
                                                        Address addr)
        Creates a standard conflict count message for an address. This indicates which conflict you are resolving of some total number of conflicts at a given address.
        Parameters:
        conflictNum - the current conflict number.
        totalConflicts - the total number of conflicts
        addr - the address for the indicated conflicts.
        Returns:
        the message string containing HTML tags.
      • getConflictCount

        public static java.lang.String getConflictCount​(int conflictNum,
                                                        int totalConflicts,
                                                        AddressRange range)
        Creates a standard conflict count message for an address range. This indicates which conflict you are resolving of some total number of conflicts for a given address range.
        Parameters:
        conflictNum - the current conflict number.
        totalConflicts - the total number of conflicts
        range - the address range for the indicated conflicts.
        Returns:
        the message string containing HTML tags.
      • getAddressConflictCount

        public static java.lang.String getAddressConflictCount​(int addressNum,
                                                               int totalAddresses,
                                                               boolean isRange)
        Creates a standard address set conflict count message. This indicates which address or address range with conflicts you are resolving of some total number of addresses or address ranges with conflicts.
        Parameters:
        caddressNum - the current conflicting address number.
        totalAddresses - the total number of conflicting addresses.
        isRange - true if the current conflict is for an address range.
        Returns:
        the message string containing HTML tags.
      • getTruncatedHTMLString

        public static java.lang.String getTruncatedHTMLString​(java.lang.String originalString,
                                                              int truncLength)
        Surrounds the originalString with HTML tags. It truncates the string at truncLength number of characters and adds "..." if it is longer than truncLength. It also replaces newline characters with HTML break tags.
        Warning: The originalString should not contain special HTML tags. If it does, they may get truncated in the middle of a tag.
        Parameters:
        originalString -
        truncLength - truncate at this length
        Returns:
        the truncated message string containing HTML tags.
      • getAddressString

        public static java.lang.String getAddressString​(Address address)
        Creates a string containing HTML tags to represent the address in color.
        Parameters:
        address - the program address.
        Returns:
        the message string containing HTML tags.
      • getAddressString

        public static java.lang.String getAddressString​(Address address,
                                                        boolean showAddressSpace)
        Creates a string containing HTML tags to represent the address in color.
        Parameters:
        address - the program address.
        showAddressSpace - true indicates the address string should show the address space.
        Returns:
        the message string containing HTML tags.
      • getNumberString

        public static java.lang.String getNumberString​(int count)
        Creates a string containing HTML tags to represent the integer number in color.
        Parameters:
        count - the integer number
        Returns:
        the message string containing HTML tags.
      • getEmphasizeString

        public static java.lang.String getEmphasizeString​(java.lang.String text)
        Creates a string containing HTML tags to represent the text in color for emphasis.
        Parameters:
        text - the text to be emphasized.
        Returns:
        the message string containing HTML tags.
      • getOffsetString

        public static java.lang.String getOffsetString​(int offset)
        Creates a string containing HTML tags to represent the offset value in color as a hexadecimal value.
        Parameters:
        offset - the offset to be displayed in hexadecimal
        Returns:
        the message string containing HTML tags.
      • getHashString

        public static java.lang.String getHashString​(long hash)
        Creates a string containing HTML tags to represent the hash value in color as an unsigned hexadecimal value.
        Parameters:
        hash - the hash to be displayed in hexadecimal
        Returns:
        the message string containing HTML tags.