类 Misc
- java.lang.Object
-
- org.meteoinfo.ndarray.util.Misc
-
public class Misc extends Object
Miscellaneous static routines.- 作者:
- caron
-
-
字段概要
字段 修饰符和类型 字段 说明 protected static Stringalphastatic doublemaxReletiveErrorstatic intobjectSizestatic intreferenceSizeprotected static Stringslashalpha
-
构造器概要
构造器 构造器 说明 Misc()
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static booleancloseEnough(double v1, double v2)Check if numbers are equal with default tolerancestatic booleancloseEnough(double v1, double v2, double maxRelDiff)Check if numbers are equal with given reletive tolerancestatic booleancloseEnough(float v1, float v2)Check if numbers are equal with default tolerancestatic booleancloseEnough(float v1, float v2, float maxRelDiff)static booleancloseEnoughAbs(double v1, double v2, double maxAbsDiff)Check if numbers are equal with given absolute tolerancestatic booleancloseEnoughAbs(float v1, float v2, float maxAbsDiff)static booleancompare(byte[] raw1, byte[] raw2, Formatter f)static voidcompare(float[] raw1, float[] raw2, Formatter f)static intcompare(int x, int y)static intcompare(long x, long y)static ListgetList(Iterable ii)static List<String>getProtocols(String url)Return the set of leading protocols for a url; may be more than one.static intgetSize(Iterable ii)static StringgetTestdataDirPath()static doublehowClose(double d1, double d2)static voidmain(String[] args)teststatic StringshowBytes(byte[] buff)static voidshowBytes(byte[] buff, Formatter f)static StringshowInts(int[] inta)static voidshowInts(int[] inta, Formatter f)static StringshowInts(List<Integer> intList)protected static booleanvalidateprotocol(String url, int startpos, int endpos)
-
-
-
方法详细资料
-
howClose
public static double howClose(double d1, double d2)
-
closeEnough
public static boolean closeEnough(double v1, double v2, double maxRelDiff)Check if numbers are equal with given reletive tolerance- 参数:
v1- first floating point numberv2- second floating point numbermaxRelDiff- maximum reletive difference- 返回:
- true if within tolerance
-
closeEnough
public static boolean closeEnough(double v1, double v2)Check if numbers are equal with default tolerance- 参数:
v1- first floating point numberv2- second floating point number- 返回:
- true if within tolerance
-
closeEnough
public static boolean closeEnough(float v1, float v2, float maxRelDiff)
-
closeEnough
public static boolean closeEnough(float v1, float v2)Check if numbers are equal with default tolerance- 参数:
v1- first floating point numberv2- second floating point number- 返回:
- true if within tolerance
-
closeEnoughAbs
public static boolean closeEnoughAbs(double v1, double v2, double maxAbsDiff)Check if numbers are equal with given absolute tolerance- 参数:
v1- first floating point numberv2- second floating point numbermaxAbsDiff- maximum absolute difference- 返回:
- true if within tolerance
-
closeEnoughAbs
public static boolean closeEnoughAbs(float v1, float v2, float maxAbsDiff)
-
showInts
public static String showInts(int[] inta)
-
showInts
public static void showInts(int[] inta, Formatter f)
-
showBytes
public static String showBytes(byte[] buff)
-
showBytes
public static void showBytes(byte[] buff, Formatter f)
-
getSize
public static int getSize(Iterable ii)
-
getTestdataDirPath
public static String getTestdataDirPath()
-
compare
public static boolean compare(byte[] raw1, byte[] raw2, Formatter f)
-
compare
public static void compare(float[] raw1, float[] raw2, Formatter f)
-
compare
public static int compare(int x, int y)
-
compare
public static int compare(long x, long y)
-
getProtocols
public static List<String> getProtocols(String url)
Return the set of leading protocols for a url; may be more than one. Watch out for Windows paths starting with a drive letter => protocol names must all have a length > 1. Watch out for '::' Each captured protocol is saved without trailing ':' Assume: the protocols MUST be terminated by the occurrence of '/'.- 参数:
url- the url whose protocols to return- 返回:
- list of leading protocols without the trailing :
-
validateprotocol
protected static boolean validateprotocol(String url, int startpos, int endpos)
-
main
public static void main(String[] args)
test
-
-