org.jzy3d.maths
Class Utils
- java.lang.Object
-
- org.jzy3d.maths.Utils
-
public class Utils extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor and Description Utils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static double[]abs(double[] values)Computes the absolute values of an array of doubles.static java.lang.Stringblanks(int length)static longdat2num(java.util.Date date)static java.lang.Stringdat2str(java.util.Date date)Convert a date to the format "dd/MM/yyyy HH:mm:ss".static java.lang.Stringdat2str(java.util.Date date, java.lang.String format)Some example format dd.MM.yy 09.04.98 yyyy.MM.dd G 'at' hh:mm:ss z 1998.04.09 AD at 06:15:55 PDT EEE, MMM d, ''yy Thu, Apr 9, '98 h:mm a 6:15 PM H:mm 18:15 H:mm:ss:SSS 18:15:55:624 K:mm a,z 6:15 PM,PDT yyyy.MMMMM.dd GGG hh:mm aaa 1998.April.09 AD 06:15 PMstatic java.util.Datemax(java.util.Date[] dates)Return the maximal date of an arraystatic java.util.Datemin(java.util.Date[] dates)Return the minimal date of an arraystatic java.util.Datenum2dat(long value)static java.lang.Stringnum2str(char parseMode, double num)Same asnum2str(char parseMode, double num, int precision)but does not query precision.static java.lang.Stringnum2str(char parseMode, double num, int precision)Convert a number into a string, withprecisionnumber of meaningfull digits.static java.lang.Stringnum2str(double num)Convert a number into a string.static java.lang.Stringnum2str(double num, int precision)static java.util.Datestr2date(java.lang.String string)static doublesum(double[] values)Computes the sum of an array of doubles.static intsum(int[] values)Computes the sum of an array of doubles.static java.lang.Stringtime2str(long milli)static double[]vector(double min, double max)Generate a vector containing regular increasing values from min to max, with an offset 1.static double[]vector(double min, double max, int nstep)Generate a vector containing regular increasing values from min to max, with an offset of nstep.static int[]vector(int min, int max)Generate a vector containing regular increasing values from min to max, with an offset 1.static int[]vector(int min, int max, int nstep)Generate a vector containing regular increasing values from min to max, with an offset of nstep.
-
-
-
Method Detail
-
num2str
public static java.lang.String num2str(char parseMode, double num, int precision)Convert a number into a string, withprecisionnumber of meaningfull digits. 'd' integral The result is formatted as a decimal integer 'o' integral The result is formatted as an octal integer 'x', 'X' integral The result is formatted as a hexadecimal integer 'e', 'E' floating point The result is formatted as a decimal number in computerized scientific notation 'f' floating point The result is formatted as a decimal number 'g', 'G' floating point The result is formatted using computerized scientific notation or decimal format, depending on the precision and the value after rounding.- See Also:
://java.sun.com/j2se/1.5.0/docs/api/java/util/Formatter.html#syntax,String.format
-
num2str
public static java.lang.String num2str(char parseMode, double num)Same asnum2str(char parseMode, double num, int precision)but does not query precision.
-
num2str
public static java.lang.String num2str(double num, int precision)
-
num2str
public static java.lang.String num2str(double num)
Convert a number into a string.
-
dat2str
public static java.lang.String dat2str(java.util.Date date)
Convert a date to the format "dd/MM/yyyy HH:mm:ss".
-
dat2str
public static java.lang.String dat2str(java.util.Date date, java.lang.String format)Some example format dd.MM.yy 09.04.98 yyyy.MM.dd G 'at' hh:mm:ss z 1998.04.09 AD at 06:15:55 PDT EEE, MMM d, ''yy Thu, Apr 9, '98 h:mm a 6:15 PM H:mm 18:15 H:mm:ss:SSS 18:15:55:624 K:mm a,z 6:15 PM,PDT yyyy.MMMMM.dd GGG hh:mm aaa 1998.April.09 AD 06:15 PM- Parameters:
date-format-- Returns:
- See Also:
://java.sun.com/docs/books/tutorial/i18n/format/simpleDateFormat. html
-
dat2num
public static long dat2num(java.util.Date date)
-
num2dat
public static java.util.Date num2dat(long value)
-
time2str
public static java.lang.String time2str(long milli)
-
blanks
public static java.lang.String blanks(int length)
-
abs
public static double[] abs(double[] values)
Computes the absolute values of an array of doubles.- Parameters:
values-- Returns:
- the sum of input values
-
sum
public static double sum(double[] values)
Computes the sum of an array of doubles. NaN values are ignored during the computation.- Parameters:
values-- Returns:
- the sum of input values
-
sum
public static int sum(int[] values)
Computes the sum of an array of doubles. NaN values are ignored during the computation.- Parameters:
values-- Returns:
- the sum of input values
-
vector
public static double[] vector(double min, double max, int nstep)Generate a vector containing regular increasing values from min to max, with an offset of nstep.- Parameters:
min-max-nstep-- Returns:
-
vector
public static double[] vector(double min, double max)Generate a vector containing regular increasing values from min to max, with an offset 1.- Parameters:
min-max-- Returns:
-
vector
public static int[] vector(int min, int max, int nstep)Generate a vector containing regular increasing values from min to max, with an offset of nstep.- Parameters:
min-max-nstep-- Returns:
-
vector
public static int[] vector(int min, int max)Generate a vector containing regular increasing values from min to max, with an offset 1.- Parameters:
min-max-- Returns:
-
min
public static java.util.Date min(java.util.Date[] dates)
Return the minimal date of an array- Parameters:
dates-- Returns:
-
max
public static java.util.Date max(java.util.Date[] dates)
Return the maximal date of an array- Parameters:
dates-- Returns:
-
str2date
public static java.util.Date str2date(java.lang.String string) throws java.text.ParseException- Throws:
java.text.ParseException
-
-
DMelt 3.0 © DataMelt by jWork.ORG