Package ucar.unidata.util
Class Utils
java.lang.Object
ucar.unidata.util.Utils
A collection of utilities
- Author:
- Jeff McWhirter
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic double
_more_static int
Returns the Julian day number that begins at noon of this day, Positive year signifies A.D., negative year B.C. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Appendable
append
(Appendable sb, String s) _more_static double
decodeLatLon
(String latlon) This method is taken from Unidatas ucar.unidata.util.Misc method.static Date
_more_static String
extractPatternNames
(String filePatternString, List<String> patternNames) _more_static Constructor
findConstructor
(Class c, Class[] paramTypes) _more_static Date
_more_static String[]
findPatterns
(String s, String regexp) _more_static int[]
fromJulian
(double injulian) Converts a Julian day to a calendar date ref : Numerical Recipes in C, 2nd ed., Cambridge University Press 1992static int[]
fromJulian
(double injulian, int[] src) _more_static String
getArticle
(String s) _more_static boolean
getAttributeOrTag
(Element node, String attrOrTag, boolean dflt) _more_static double
getAttributeOrTag
(Element node, String attrOrTag, double dflt) _more_static int
getAttributeOrTag
(Element node, String attrOrTag, int dflt) _more_static String
getAttributeOrTag
(Element node, String attrOrTag, String dflt) _more_static int
_more_static Hashtable
_more_static int
_more_static String
_more_static boolean
_more_static void
_more_static SimpleDateFormat
makeDateFormat
(String format) _more__more_static String
makeProperties
(Hashtable properties) _more_static double
modifiedJulianToJulian
(double modifiedJulian) _more_static Image
_more_static String
_more_static Object
_more_static File[]
sortFilesOnSize
(File[] files, boolean ascending) _more_static boolean
_more_static void
testJulian
(String[] args) _more_static double
toJulian
(int[] ymd) _more_static boolean
typesMatch
(Class[] formals, Class[] actuals) _more_
-
Field Details
-
JGREG
public static int JGREGReturns the Julian day number that begins at noon of this day, Positive year signifies A.D., negative year B.C. Remember that the year after 1 B.C. was 1 A.D. ref : Numerical Recipes in C, 2nd ed., Cambridge University Press 1992 -
HALFSECOND
public static double HALFSECOND_more_
-
-
Constructor Details
-
Utils
public Utils()
-
-
Method Details
-
append
_more_- Parameters:
sb
- _more_s
- _more_- Returns:
- _more_
-
stringDefined
_more_- Parameters:
s
- _more_- Returns:
- _more_
-
modifiedJulianToJulian
public static double modifiedJulianToJulian(double modifiedJulian) _more_- Parameters:
modifiedJulian
- _more_- Returns:
- _more_
-
toJulian
public static double toJulian(int[] ymd) _more_- Parameters:
ymd
- _more_- Returns:
- _more_
-
fromJulian
public static int[] fromJulian(double injulian) Converts a Julian day to a calendar date ref : Numerical Recipes in C, 2nd ed., Cambridge University Press 1992- Parameters:
injulian
- _more_- Returns:
- _more_
-
fromJulian
public static int[] fromJulian(double injulian, int[] src) _more_- Parameters:
injulian
- _more_src
- _more_- Returns:
- _more_
-
testJulian
_more_- Parameters:
args
- _more_
-
getArticle
_more_- Parameters:
s
- _more_- Returns:
- _more_
-
extractDate
_more_- Parameters:
s
- _more_- Returns:
- _more_
-
findConstructor
_more_- Parameters:
c
- _more_paramTypes
- _more_- Returns:
- _more_
-
typesMatch
_more_- Parameters:
formals
- _more_actuals
- _more_- Returns:
- _more_
-
main
_more_- Parameters:
args
- _more_
-
findPatterns
_more_- Parameters:
s
- _more_regexp
- _more_- Returns:
- _more_
- Throws:
Exception
- _more_
-
findDate
public static Date findDate(String source, String[] datePatterns, String[] dateFormats) throws Exception _more_- Parameters:
source
- _more_datePatterns
- _more_dateFormats
- _more_- Returns:
- _more_
- Throws:
Exception
- _more_
-
makeDateFormat
_more_- Parameters:
format
- _more_- Returns:
- _more_
-
getYear
_more_- Parameters:
date
- _more_- Returns:
- _more_
-
getMonth
_more_- Parameters:
date
- _more_- Returns:
- _more_
-
removeNonAscii
_more_- Parameters:
s
- _more_- Returns:
- _more_
-
getAttributeOrTag
public static String getAttributeOrTag(Element node, String attrOrTag, String dflt) throws Exception _more_- Parameters:
node
- _more_attrOrTag
- _more_dflt
- _more_- Returns:
- _more_
- Throws:
Exception
- _more_
-
getAttributeOrTag
public static boolean getAttributeOrTag(Element node, String attrOrTag, boolean dflt) throws Exception _more_- Parameters:
node
- _more_attrOrTag
- _more_dflt
- _more_- Returns:
- _more_
- Throws:
Exception
- _more_
-
getAttributeOrTag
_more_- Parameters:
node
- _more_attrOrTag
- _more_dflt
- _more_- Returns:
- _more_
- Throws:
Exception
- _more_
-
getAttributeOrTag
public static double getAttributeOrTag(Element node, String attrOrTag, double dflt) throws Exception _more_- Parameters:
node
- _more_attrOrTag
- _more_dflt
- _more_- Returns:
- _more_
- Throws:
Exception
- _more_
-
makeProperties
_more_- Parameters:
properties
- _more_- Returns:
- _more_
-
makeMap
_more_- Parameters:
args
- _more_- Returns:
- _more_
-
getProperties
_more_- Parameters:
s
- _more_- Returns:
- _more_
-
hexEncode
_more_- Parameters:
s
- _more_- Returns:
- _more_
-
isImage
_more_- Parameters:
path
- _more_- Returns:
- _more_
-
sortFilesOnSize
_more_- Parameters:
files
- _more_ascending
- _more_- Returns:
- _more_
-
extractPatternNames
_more_- Parameters:
filePatternString
- _more_patternNames
- _more_- Returns:
- _more_
-
readImage
_more_- Parameters:
file
- _more_- Returns:
- _more_
-
decodeLatLon
This method is taken from Unidatas ucar.unidata.util.Misc method. I moved it here to not have it use the parseNumber because that would use a DecimalFormat which was picking up the Locale Decodes a string representation of a latitude or longitude and returns a double version (in degrees). Acceptible formats are:+/- ddd:mm, ddd:mm:, ddd:mm:ss, ddd::ss, ddd.fffff ===> [+/-] ddd.fffff +/- ddd, ddd:, ddd:: ===> [+/-] ddd +/- :mm, :mm:, :mm:ss, ::ss, .fffff ===> [+/-] .fffff +/- :, :: ===> 0.0 Any of the above with N,S,E,W appended
- Parameters:
latlon
- string representation of lat or lon- Returns:
- the decoded value in degrees
-
safeGet
_more_- Parameters:
list
- _more_index
- _more_- Returns:
- _more_
-