Class MetadataServices

java.lang.Object
noaa.coastwatch.util.MetadataServices

public class MetadataServices extends Object
The MetadataServices class defines various static methods relating to metadata manipulation.
Since:
3.1.8
Author:
Peter Hollemans
  • Field Details

  • Method Details

    • collapse

      public static String collapse(String attValue)
      Creates a collapsed version of an attribute value. The collapsed version of the attribute has no repeated composite values. For example, the string "GOES-10\nGOES-10\nGOES-12" will be collapsed to simply "GOES-10\nGOES-12".
      Parameters:
      attValue - the attribute value to collapse.
      Returns:
      the collapsed attribute value.
    • collapse

      public static Object collapse(Object attValue)
      Creates a collapsed version of an attribute value. The collapsed version of the attribute has no repeated composite values.
      Parameters:
      attValue - the attribute value to collapse.
      Returns:
      the collapsed attribute value.
      See Also:
    • format

      public static String format(String attValue, String split)
      Creates a formatted version of an attribute value. The formatted version is collapsed and the splitting string replaced with a user-specified string.
      Parameters:
      attValue - the attribute value to format.
      split - the string to use for splitting composite values.
      Returns:
      the formatted attribute value.
    • append

      public static String append(String attValue, String appendValue)
      Appends a new value to the end of an attribute.
      Parameters:
      attValue - the existing attribute value, may be null.
      appendValue - the attribute value to append.
      Returns:
      the new composite attribute value.
    • toArray

      public static Object toArray(Object value) throws ClassNotFoundException
      Converts a wrapped Java primitive to a primitive array.
      Parameters:
      value - the object value to convert.
      Returns:
      a Java primitive array of length 1.
      Throws:
      ClassNotFoundException - if the value class is unknown.
    • append

      public static Object append(Object attValue, Object appendValue)
      Appends a new value to the end of an attribute.
      Parameters:
      attValue - the existing attribute value, may be null.
      appendValue - the attribute value to append.
      Returns:
      the new composite attribute value.
    • getCommandLine

      public static String getCommandLine(String prog, String[] argv)
      Creates a command line string from program name and arguments.
      Parameters:
      prog - the program name.
      argv - the array of arguments.
      Returns:
      the assembled command line string.
    • toString

      public static String toString(Object attValue)
      Converts an attribute value to a string.
      Parameters:
      attValue - the attribute value to convert.
      Returns:
      the attribute value as a string or "null" if the attribute value is null.
    • similarity

      public static double similarity(String s1, String s2)
      Calculates the similarity between strings.
      Parameters:
      s1 - the first string to compare.
      s2 - the second srting to compare.
      Returns:
      the similarity between strings as a number in the range [0..1] where 0.0 is not similar at all and 1.0 is exactly the same.
      Since:
      3.8.0
      See Also: