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 intReturns 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 Appendableappend(Appendable sb, String s) _more_static doubledecodeLatLon(String latlon) This method is taken from Unidatas ucar.unidata.util.Misc method.static Date_more_static StringextractPatternNames(String filePatternString, List<String> patternNames) _more_static ConstructorfindConstructor(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 StringgetArticle(String s) _more_static booleangetAttributeOrTag(Element node, String attrOrTag, boolean dflt) _more_static doublegetAttributeOrTag(Element node, String attrOrTag, double dflt) _more_static intgetAttributeOrTag(Element node, String attrOrTag, int dflt) _more_static StringgetAttributeOrTag(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 SimpleDateFormatmakeDateFormat(String format) _more__more_static StringmakeProperties(Hashtable properties) _more_static doublemodifiedJulianToJulian(double modifiedJulian) _more_static Image_more_static String_more_static Object_more_static File[]sortFilesOnSize(File[] files, boolean ascending) _more_static boolean_more_static voidtestJulian(String[] args) _more_static doubletoJulian(int[] ymd) _more_static booleantypesMatch(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_
-