类 Misc


  • public class Misc
    extends java.lang.Object
    Miscellaneous static routines.
    作者:
    caron
    • 构造器概要

      构造器 
      构造器 说明
      Misc()  
    • 方法概要

      所有方法 静态方法 具体方法 
      修饰符和类型 方法 说明
      static boolean closeEnough​(double v1, double v2)
      Check if numbers are equal with default tolerance
      static boolean closeEnough​(double v1, double v2, double maxRelDiff)
      Check if numbers are equal with given reletive tolerance
      static boolean closeEnough​(float v1, float v2)
      Check if numbers are equal with default tolerance
      static boolean closeEnough​(float v1, float v2, float maxRelDiff)  
      static boolean closeEnoughAbs​(double v1, double v2, double maxAbsDiff)
      Check if numbers are equal with given absolute tolerance
      static boolean closeEnoughAbs​(float v1, float v2, float maxAbsDiff)  
      static boolean compare​(byte[] raw1, byte[] raw2, java.util.Formatter f)  
      static void compare​(float[] raw1, float[] raw2, java.util.Formatter f)  
      static int compare​(int x, int y)  
      static int compare​(long x, long y)  
      static java.util.List getList​(java.lang.Iterable ii)  
      static java.util.List<java.lang.String> getProtocols​(java.lang.String url)
      Return the set of leading protocols for a url; may be more than one.
      static int getSize​(java.lang.Iterable ii)  
      static java.lang.String getTestdataDirPath()  
      static double howClose​(double d1, double d2)  
      static void main​(java.lang.String[] args)
      test
      static java.lang.String showBytes​(byte[] buff)  
      static void showBytes​(byte[] buff, java.util.Formatter f)  
      static java.lang.String showInts​(int[] inta)  
      static void showInts​(int[] inta, java.util.Formatter f)  
      static java.lang.String showInts​(java.util.List<java.lang.Integer> intList)  
      protected static boolean validateprotocol​(java.lang.String url, int startpos, int endpos)  
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 字段详细资料

      • alpha

        protected static final java.lang.String alpha
        另请参阅:
        常量字段值
      • slashalpha

        protected static final java.lang.String slashalpha
        另请参阅:
        常量字段值
      • referenceSize

        public static final int referenceSize
        另请参阅:
        常量字段值
      • objectSize

        public static final int objectSize
        另请参阅:
        常量字段值
      • maxReletiveError

        public static final double maxReletiveError
        另请参阅:
        常量字段值
    • 构造器详细资料

      • Misc

        public Misc()
    • 方法详细资料

      • 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 number
        v2 - second floating point number
        maxRelDiff - 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 number
        v2 - 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 number
        v2 - 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 number
        v2 - second floating point number
        maxAbsDiff - maximum absolute difference
        返回:
        true if within tolerance
      • closeEnoughAbs

        public static boolean closeEnoughAbs​(float v1,
                                             float v2,
                                             float maxAbsDiff)
      • showInts

        public static java.lang.String showInts​(int[] inta)
      • showInts

        public static java.lang.String showInts​(java.util.List<java.lang.Integer> intList)
      • showInts

        public static void showInts​(int[] inta,
                                    java.util.Formatter f)
      • showBytes

        public static java.lang.String showBytes​(byte[] buff)
      • showBytes

        public static void showBytes​(byte[] buff,
                                     java.util.Formatter f)
      • getSize

        public static int getSize​(java.lang.Iterable ii)
      • getList

        public static java.util.List getList​(java.lang.Iterable ii)
      • getTestdataDirPath

        public static java.lang.String getTestdataDirPath()
      • compare

        public static boolean compare​(byte[] raw1,
                                      byte[] raw2,
                                      java.util.Formatter f)
      • compare

        public static void compare​(float[] raw1,
                                   float[] raw2,
                                   java.util.Formatter f)
      • compare

        public static int compare​(int x,
                                  int y)
      • compare

        public static int compare​(long x,
                                  long y)
      • getProtocols

        public static java.util.List<java.lang.String> getProtocols​(java.lang.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​(java.lang.String url,
                                                  int startpos,
                                                  int endpos)
      • main

        public static void main​(java.lang.String[] args)
        test