Class JxnUtilities

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      protected void __1_fileDialog()  
      protected void __2_plot_and_curve()  
      protected void __3_formatting_to_String()  
      protected void __4_hex_formatting()
      Adds to hex formatting and parsing methods.
      protected void __5_ClassExplorer()  
      protected void __6_extensions_to_Math()
      Collection of methods adding to java.lang.Math.
      protected void __7_setField()
      Set public fields of an object or a class.
      protected void __8_array_operations()  
      protected void __9_boolean_operators()  
      protected void _10_bitwise_operators()  
      protected void _11_relational_operators()  
      protected void _12_formula_switching()  
      static double abs​(double x, double y)
      Returns sqrt( x * x + y * y ).
      static double abs​(double x, double y, double z)
      Returns sqrt( x * x + y * y + z * z ).
      static double acosD​(double a)
      Calls Math.acos(double) and converts the result from radians to degrees.
      static double acosh​(double x)
      Returns the inverse of  Math.cosh(double).
      static Object add​(byte[] array, int i, byte value)
      Adds value to array[i] with overflow, if the result does not fit into byte.
      static Object add​(double[] array, int i, double value)
      Adds value to array[i].
      static Object add​(int[] array, int i, int value)
      Adds value to array[i].
      static Object add​(long[] array, int i, long value)
      Adds value to array[i].
      static String addLeadingBlanks​(String text, int n)
      Prefixes text with blanks so that the result contains at least n characters.
      static String addLeadingChars​(String text, int n, char ch)
      Prefixes text with ch so that the result contains at least n characters.
      static String addLeadingZeros​(String text, int n)
      Prefixes text with '0' so that the result contains at least n characters.
      static String addTrailingChars​(String text, int n, char ch)
      Appends text with ch so that the result contains at least n characters.
      static boolean all​(boolean[] array)
      Returns true, if all values in array are true.
      static boolean and​(boolean x, boolean y)
      Represents the Java boolean operator.
      static int and​(int x, int y)
      Represents the Java bitwise operator (for int).
      static long and​(long x, long y)
      Represents the Java bitwise operator (for long).
      static boolean any​(boolean[] array)
      Returns true, if at least one value in array is true.
      static double asinD​(double a)
      Calls Math.asin(double) and converts the result from radians to degrees.
      static double asinh​(double x)
      Returns the inverse of  Math.sinh(double).
      static double atan2D​(double y, double x)
      Calls Math.atan2(double, double) and converts the result from radians to degrees.
      static double atanD​(double a)
      Calls Math.atan(double) and converts the result from radians to degrees.
      static double atanh​(double x)
      Returns the inverse of  Math.tanh(double).
      static Object booleanArray​(int length, boolean initial)
      Creates a new boolean array with the specified length, initialized with initial.
      static Object byteArray​(int length)
      Creates a new byte array with the specified length.
      static Object byteArray​(int length, byte initial)
      Creates a new byte array with the specified length, initialized with initial.
      static double clip​(double x, double lower, double upper)
      Returns x limitted by lower and upper.
      static Object concat​(Object... arrays)
      Returns a new array containing the elements of all arrays passed as arguments.
      static Object concat​(Object arr1, Object arr2)
      Returns a new array containing the elements of array arr1 followed by the elements of array arr2.
      static boolean contains​(String chars, char ch)
      Returns true if chars contains ch.
      static double cosD​(double a)
      Calls Math.cos(double) after converting argument a from degrees to radians.
      static double[] cumulated​(double[] array)
      Returns a new array containing the partial (cumulated) sums of the values of array.
      static int[] cumulated​(int[] array)
      Returns a new array containing the partial (cumulated) sums of the values of array.
      static long[] cumulated​(long[] array)
      Returns a new array containing the partial (cumulated) sums of the values of array.
      static JxnRealArrayCurve curve​(double[] x, double[] y, double[] z, IKmg3DProjection p3d)
      Deprecated.
      static JxnRealArrayCurve curve​(double[] x, double[] y, double[] z, IKmg3DProjection p3d, Color color)
      static JxnRealArrayCurve curve​(double[] x, double[] y, double[] z, IKmg3DProjection p3d, Color color, int lineType)
      static JxnRealArrayCurve curve​(double[] x, double[] y, Color color)
      Returns a curve representation of x and y ( xi = x[i], yi = y[i] ).
      static JxnRealArrayCurve curve​(double[] x, double[] y, Color color, int lineType)
      See curve.
      static JxnRealArrayCurve curve​(double[] y, Color color)
      Returns a curve representation of y ( xi = i, yi = y[i] ).
      static JxnRealArrayCurve curve​(double[] y, Color color, int lineType)
      See curve.
      static double[] differences​(double[] array)
      Returns a new array containing the differences of subsequent values of array.
      static int[] differences​(int[] array)
      Returns a new array containing the differences of subsequent values of array.
      static long[] differences​(long[] array)
      Returns a new array containing the differences of subsequent values of array.
      static Object doubleArray​(int length)
      Creates a new double array with the specified length.
      static Object doubleArray​(int length, double initial)
      Creates a new double array with the specified length, initialized with initial.
      static double[] doubleArray​(String csvList)
      Deprecated.
      In JXN prefer { 2., 3., 5., 7. }.
      static boolean eq​(boolean x, boolean y)
      Represents the Java relational operator.
      static boolean eq​(double x, double y)
      Represents the Java relational operator.
      static boolean eq​(long x, long y)
      Represents the Java relational operator.
      static boolean equals​(Object o1, Object o2)
      Deprecated.
      No more needed: Simply call o1.equals(o2).
      static boolean exor​(boolean x, boolean y)
      Represents the Java boolean operator.
      static int exor​(int x, int y)
      Represents the Java bitwise operator (for int).
      static long exor​(long x, long y)
      Represents the Java bitwise operator (for long).
      static String fileDialog()
      Calls fileDialog( String defaultFilename, int mode ) with defaultFilename = "*" and mode = FileDialog.LOAD.
      static String fileDialog​(String defaultFilename)
      static String fileDialog​(String defaultFilename, int mode)
      Displays java.awt.FileDialog and returns the filename selected by the user.
      static int find​(boolean[] array, boolean value)
      Search array for value.
      static int find​(boolean[] array, int fromIndex, boolean value)
      Search array for value starting from fromIndex.
      static int find​(byte[] array, byte value)
      Search array for value.
      static int find​(byte[] array, int fromIndex, byte value)
      Search array for value starting from fromIndex.
      static int find​(char[] array, char value)
      Search array for value.
      static int find​(char[] array, int fromIndex, char value)
      Search array for value starting from fromIndex.
      static int find​(int[] array, int value)
      Search array for value.
      static int find​(int[] array, int fromIndex, int value)
      Search array for value starting from fromIndex.
      static int find​(long[] array, int fromIndex, long value)
      Search array for value starting from fromIndex.
      static int find​(long[] array, long value)
      Search array for value.
      static int find​(Object[] array, int fromIndex, Object o)
      Search array for o starting from fromIndex.
      static int find​(Object[] array, Object o)
      Search array for o.
      static Object flip​(boolean[] array, int i)
      Toggles array[i].
      static String format​(double value, int nDec)
      Formats value as String with a fixed number of nDec decimals.
      static String format​(double value, int nDec, int minLength)
      Formats value as String with a fixed number of nDec decimals and minimum length minLength.
      static String format​(Object o)
      Formats o for JXN-output.
      static String format​(Object o, boolean recursive)
      Formats o for JXN-output.
      static String format​(String text)
      Formats special characters in text.
      static String[] formatClass​(Object o)
      Formats information of the class of o  (like menu: View > Class… in JxnSession window).
      static String[] formatMethods​(Object o)
      Formats information of the methods of o  (like menu: View > Methods… in JxnSession window).
      static String[] formatMethods​(Object o, String name)
      Formats information of the methods of o.
      static boolean ge​(double x, double y)
      Represents the Java relational operator.
      static boolean ge​(long x, long y)
      Represents the Java relational operator.
      static Object get​(Object ao, double x)
      Returns ao[round(x)] with array index limitted to 0 <= index < ao.length.
      static Object get​(Object ao, int i)
      In JXN prefer ao[i].
      static Class getClass​(Object ao)
      Deprecated.
      No more needed: Simply call ao.getClass().
      static String getClassName​(Object o)
      Formats the class name of o as String.
      static String getHeadTrail​(String delimString, int nHead, String separator, int nTrail, String text)
      Extracts the first nHead and the last nTrail tokens delimited by delimString from text.
      static JxnRealArrayAlgebra getZ​(KmgParallelProjection p3d, JxnRealArrayAlgebra[] rxyz)
      Returns the z-component of the projection (direction out of the projection plane towards the viewer).
      static String group​(String text, int m)
      Groups text into sections of m characters by inserting blanks.
      static String group​(String text, int m, String separator)
      Groups text into sections of m characters by inserting the String separator.
      static boolean gt​(double x, double y)
      Represents the Java relational operator.
      static boolean gt​(long x, long y)
      Represents the Java relational operator.
      static int hashCode​(Object ao)
      Deprecated.
      No more needed: Simply call ao.hashCode().
      static String hexString​(byte by)
      Formats a byte as hexString.
      static String hexString​(byte[] by)
      Formats a byte array as hexString.
      static String hexString​(char ch)
      Formats a char as hexString.
      static String hexString​(char[] ch)
      Formats a char array as hexString.
      static String hexString​(double d)
      Formats a double as hexString.
      static String hexString​(float f)
      Formats a float as hexString.
      static String hexString​(int i)
      Formats an int as hexString.
      static String hexString​(long l)
      Formats a long as hexString.
      static String hexString​(short sh)
      Formats a short as hexString.
      static String hexString​(String text)
      Formats text as hexString.
      static String hexString​(BigInteger bi)
      Formats a BigInteger as hexString.
      static double hexStringToDouble​(String hexString)
      Parses hexString to double using parseHex(String hexString) and Double.longBitsToDouble(long).
      static float hexStringToFloat​(String hexString)
      Parses hexString to float using parseHex(String hexString) and Float.intBitsToFloat(int).
      static Object intArray​(int length)
      Creates a new int array with the specified length.
      static Object intArray​(int length, int initial)
      Creates a new int array with the specified length, initialized with initial.
      static int[] intArray​(String csvList)
      Deprecated.
      In JXN prefer { 123, 456, 789 }.
      static boolean isArray​(Object o)
      Returns true if o is an array (null returns false).
      static boolean isNull​(double x)
      Allows the generic check of arbitrary variables (e.g.arguments passed to jxn files).
      static boolean isNull​(Object o)
      Returns true if o == null.
      static boolean isPrimitiveOrJavaWrapper​(double x)
      Used in jxn files to check the type of x.
      static boolean isPrimitiveOrJavaWrapper​(Object x)
      Used in jxn files to check the type of x.
      static boolean isSame​(Object x, Object y)
      Returns true if x == y (references to the same (identical) instance).
      static String join​(Object array)
      Formats array as string.
      static String join​(String separator, Object array)
      Formats array as string.
      static boolean le​(double x, double y)
      Represents the Java relational operator.
      static boolean le​(long x, long y)
      Represents the Java relational operator.
      static int left​(int x, int i)
      Represents the Java bit shift operator (for int).
      static long left​(long x, int i)
      Represents the Java bit shift operator (for long).
      static int length​(Object ao)
      Returns the length of the specified array object.
      static double limit​(double x, double xmin, double xmax)
      Keeps x within xmin and xmax.
      static int limit​(int x, int xmin, int xmax)
      Keeps x within xmin and xmax.
      static long limit​(long x, long xmin, long xmax)
      Keeps x within xmin and xmax.
      static double log​(double b, double x)
      Returns the base b logarithm of x.
      static double log2​(double x)
      Returns the base 2 logarithm of x.
      static Object longArray​(int length, long initial)
      Creates a new long array with the specified length, initialized with initial.
      static boolean lt​(double x, double y)
      Represents the Java relational operator.
      static boolean lt​(long x, long y)
      Represents the Java relational operator.
      static int modPow​(int base, int exp, int m)
      Returns  baseexp mod m.
      static double modulo​(double x, double y)
      Prefer x % y  if  x > 0 and y > 0.
      Example:
      static int modulo​(int x, int y)
      Prefer x % y  if  x > 0 and y > 0.
      static long modulo​(long x, long y)
      Prefer x % y  if  x > 0 and y > 0.
      static boolean ne​(boolean x, boolean y)
      Represents the Java relational operator.
      static boolean ne​(double x, double y)
      Represents the Java relational operator.
      static boolean ne​(long x, long y)
      Represents the Java relational operator.
      static Object newArray​(int length, Object initial)
      Creates a new array with the specified length, initialized with initial.
      static Object newArray​(Class<?> componentType, int length)
      Creates a new array with the specified component type and length.
      static Object newArray​(Class<?> componentType, int... dimensions)
      Creates a new array with the specified component type and dimensions.
      static Object newArray​(Class<?> componentType, int length, Object initial)
      Creates a new array with the specified component type and length, initialized with initial.
      static byte nop​(double sliderDependentVariable)
      Forces the repetition of a statement by inserting an artificial dependency on sliderDependentVariable.
      static byte nop​(Object sliderDependentObject)
      Deprecated.
      Not needed.
      static Object nop​(Object obj, double sliderDependentVariable)
      Forces the repetition of a statement by inserting an artificial dependency on sliderDependentVariable.
      static Object nop​(Object obj, Object sliderDependentObject)
      Deprecated.
      Not needed.
      static boolean not​(boolean x)
      Represents the Java boolean operator.
      static int not​(int x)
      Represents the Java bitwise operator (for int).
      static long not​(long x)
      Represents the Java bitwise operator (for long).
      static boolean or​(boolean x, boolean y)
      Represents the Java boolean operator.
      static int or​(int x, int y)
      Represents the Java bitwise operator (for int).
      static long or​(long x, long y)
      Represents the Java bitwise operator (for long).
      static Number parseHex​(String hexString)
      Parses hexString to appropriate Number.
      static JxnRealArrayPlotFrame plot​(double[] y)
      Creates a new JxnRealArrayPlotFrame and visualizes the values of y as a curve:
        xi = i, yi = y[i], i = 0 ... y.length - 1.
      static JxnRealArrayPlotFrame plot​(double[] x, double[] y)
      Creates a new JxnRealArrayPlotFrame and visualizes the values of x and y as a curve:
        xi = x[i], yi = y[i], i = 0 ... min( x.length, y.length ) - 1.
      static JxnRealArrayPlotFrame plot​(double[] x, double[] y, double vyx)
      See plot.
      static JxnRealArrayPlotFrame plot​(double[] x, double[] y1, double[] y2)
      plots 2 curves: y1(x): red, y2(x): blue.
      static JxnRealArrayPlotFrame plot​(double[] x, double[] y1, double[] y2, double[] y3)
      plots 3 curves: y1(x): red, y2(x): blue, y3(x): green.
      static JxnRealArrayPlotFrame plot​(double[] x, double[] y, int logScales)
      See plot.
      static JxnRealArrayPlotFrame plot​(double[] x, double[] y, Color color)
      See plot.
      static JxnRealArrayPlotFrame plot​(double[] x, double[] y, Color color, float lineWidth)
      See plot.
      static JxnRealArrayPlotFrame plot​(double[] x, double[] y, Color color, int lineType)
      See plot.
      static JxnRealArrayPlotFrame plot​(double[] x, double[] y, Color color, int lineType, double vyx)
      See plot.
      static JxnRealArrayPlotFrame plot​(double[] x, double[] y, Color color, int lineType, float lineWidth, double vyx)
      See plot.
      static JxnRealArrayPlotFrame plot​(double[] x, double[] y, Color color, int lineType, float lineWidth, int logScales)
      See plot.
      static JxnRealArrayPlotFrame plot​(double[] x, double[] y, Color color, int lineType, int logScales)
      See plot.
      static JxnRealArrayPlotFrame plot​(double[] x, double[] y, Color color, Stroke stroke, double vyx)
      See plot.
      static JxnRealArrayPlotFrame plot​(double[] x, double[] y, Color color, Stroke stroke, int logScales)
      See plot.
      static JxnRealArrayPlotFrame plot​(double[] y, Color color, int lineType)
      See plot.
      static JxnPerspectivePlotFrame plot​(IKmg3DProjection p3d)
      Creates a JxnPerspectivePlotFrame for the three-dimensional display of vectors and curves.
      static JxnPerspectivePlotFrame plot​(IKmg3DProjection p3d, double size)
      Creates a JxnPerspectivePlotFrame for the three-dimensional display of vectors and curves.
      static Frame plot​(KmgXYPainter painter)
      Deprecated.
      ...
      static double pqRoot​(double p, double q)
      Returns solution of   x^2 + p x + q = 0.
      static String[] print​(PrintStream ps, String[] lines)
      Writes lines line by line to ps.
      static String repeat​(String text, int n)
      Returns a String which contains text repeated n times.
      static int right​(int x, int i)
      Represents the Java bit shift operator (for int).
      static long right​(long x, int i)
      Represents the Java bit shift operator (for long).
      static int right0​(int x, int i)
      Represents the Java bit shift operator (for int).
      static long right0​(long x, int i)
      Represents the Java bit shift operator (for long).
      static long round_half_away_from_zero​(double x)
      Returns result of commercial rounding of x.
      static Object set​(boolean[] array, int i, boolean value)
      static Object set​(byte[] array, int i, byte value)
      Shortcut for java.lang.reflect.Array.setByte( Object array, int i, byte value ).
      static Object set​(char[] array, int i, char value)
      Shortcut for java.lang.reflect.Array.setChar( Object array, int i, char value ).
      static Object set​(double[] array, int i, double value)
      static Object set​(float[] array, int i, float value)
      static Object set​(int[] array, int i, int value)
      Shortcut for java.lang.reflect.Array.setInt( Object array, int i, int value ).
      static Object set​(long[] array, int i, long value)
      Shortcut for java.lang.reflect.Array.setLong( Object array, int i, long value ).
      static Object set​(short[] array, int i, short value)
      static Object set​(Object[] array, int i, Object value)
      Sets the value of the i-th component of array to the specified new value.
      static Object set​(Object o, String fieldName, boolean value)
      Sets a boolean field of an object or a class.
      static Object set​(Object o, String fieldName, byte value)
      Sets a byte field of an object or a class.
      static Object set​(Object o, String fieldName, char value)
      Sets a char field of an object or a class.
      static Object set​(Object o, String fieldName, double value)
      Sets a double field of an object or a class.
      static Object set​(Object o, String fieldName, float value)
      Sets a float field of an object or a class.
      static Object set​(Object o, String fieldName, int value)
      Sets a int field of an object or a class.
      static Object set​(Object o, String fieldName, long value)
      Sets a long field of an object or a class.
      static Object set​(Object o, String fieldName, short value)
      Sets a short field of an object or a class.
      static Object set​(Object o, String fieldName, Object value)
      Sets a public field specified by fieldName of an object or a class to the given value.
      static boolean setArrayReturnOldValue​(boolean returnOldValue)
      Controls if the set array methods return the old (overwriten) array value.
      static String setHexStringSeparator​(String separator)
      Sets the group separator for hexString.
      static String showClass​(Object o)
      Deprecated.
      Use #edit formatClass(o) or Menu: View > Class...
      static String showMethods​(Object o)
      Deprecated.
      Use #edit formatMethods(o) or Menu: View > Methods...
      static String showMethods​(Object o, String name)
      Deprecated.
      Use #edit formatMethods( o, name ) or Menu: View > Methods...
      static double sinD​(double a)
      Calls Math.sin(double) after converting argument a from degrees to radians.
      static String[] split​(String delimString, String text)
      Splits text into parts delimited by the delimiter string delimString.
      static String squeeze​(String text)
      Removes blanks from text.
      static String squeeze​(String text, char chRemove)
      Removes all occurrences of chRemove from text.
      static String squeeze​(String text, String removeChars)
      Removes all occurrences of the characters contained in removeChars from text.
      static String[] stringArray​(String csvList)
      Deprecated.
      In JXN prefer { "abc", "xyz" }.
      static String[] stringArray​(String csvList, String delimChars)
      Returns array of tokens from StringTokenizer.nextToken().
      static double sw​(boolean b, double yTrue, double yFalse)
      Returns yTrue, if  b is true else yFalse.
      static int sw​(boolean b, int yTrue, int yFalse)
      Returns yTrue, if  b is true else yFalse.
      static long sw​(boolean b, long yTrue, long yFalse)
      Returns yTrue, if  b is true else yFalse.
      static Object sw​(boolean b, Object oTrue, Object oFalse)
      Returns oTrue, if  b is true else oFalse.
      static double sw​(double x, double yLT, double yGE)
      Returns yLT, if  x < 0. else yGE.
      static double sw​(double x, double yLT, double yEQ, double yGT)
      Returns yLT, if  x < 0. else yGT, if  x > 0. else yEQ.
      static double sw​(double x, double eps, double yLower, double yInner, double yUpper)
      Returns yLower, if  x < -eps else yUpper, if  x > eps else yInner.
      static double sw​(double x, double xLower, double xUpper, double yLower, double yInner, double yUpper)
      Returns yLower, if  x < xLower else yUpper, if  x > xUpper else yInner.
      static Object sw​(double x, double xLower, double xUpper, Object oLower, Object oInner, Object oUpper)
      Returns oLower, if  x < xLower else oUpper, if  x > xUpper else oInner.
      static Object sw​(double x, double eps, Object oLower, Object oInner, Object oUpper)
      Returns oLower, if  x < -eps else oUpper, if  x > eps else oInner.
      static int sw​(double x, int yLT, int yGE)
      Returns yLT, if  x < 0. else yGE.
      static int sw​(double x, int yLT, int yEQ, int yGT)
      Returns yLT, if  x < 0. else yGT, if  x > 0. else yEQ.
      static long sw​(double x, long yLT, long yGE)
      Returns yLT, if  x < 0. else yGE.
      static long sw​(double x, long yLT, long yEQ, long yGT)
      Returns yLT, if  x < 0. else yGT, if  x > 0. else yEQ.
      static Object sw​(double x, Object[] oa)
      Returns oa[round(x)] with array index limitted to 0 <= index < oa.length.
      static Object sw​(double x, Object oLT, Object oGE)
      Returns oLT, if  x < 0 else oGE.
      static Object sw​(double x, Object oLT, Object oEQ, Object oGT)
      Returns oLT, if  x < 0 else oGT, if  x > 0 else oEQ.
      static int sw​(int ivar, double slider_switch)
      Returns 1 if  ivar-0.5 <= slider_switch < ivar+0.5 else 0.
      static double tanD​(double a)
      Calls Math.tan(double) after converting argument a from degrees to radians.
      static Object toArray​(Object ao)
      static Object toArray​(Object ao, int mode)
      Check, if ao is an array or try to call ao.toArray().
      static String toRawString​(Object o)
      Formats o to the string which would be returned by the toString() method, if the same had not been overwriten for the class of o.
      static String toString​(Object o)
      Formats o as String.
      static String toString​(Object o, boolean showHashCode)
      Formats o as String.
      static String toString​(Object o, int verboseLevel)
      Formats o as String.
      static String[] toStringArray​(Object o)
      Formats o as a String array.
      static String[] toTableRows​(double[][] colArrays)
      Formats a set of column arrays as a String array of the rows using '\t' to separate the array elements of a row.
      static String[] toTableRows​(Object[] colArrays)
      Formats a set of column arrays as a String array of the rows using '\t' to separate the array elements of a row.
      static String[] toTableRows​(String separator, double[][] colArrays)
      Formats a set of column arrays as a String array of the rows using separator to separate the array elements of a row.
      static String[] toTableRows​(String separator, Object[] colArrays)
      Formats a set of column arrays as a String array of the rows using separator to separate the array elements of a row.
      static int total​(boolean[] array)
      Returns the number of true values in array.
      static int total​(byte[] array)
      Returns the int sum of the values of array.
      static double total​(double[] array)
      Returns the sum of the values of array.
      static int total​(int[] array)
      Returns the sum of the values of array.
      static long total​(long[] array)
      Returns the sum of the values of array.
      static String whatIs​(Object o)
      Deprecated.
    • Method Detail

      • __1_fileDialog

        protected void __1_fileDialog()
      • fileDialog

        public static String fileDialog​(String defaultFilename,
                                        int mode)
        Displays java.awt.FileDialog and returns the filename selected by the user.
        Parameters:
        defaultFilename - narrows down the files displayed in the FileDialog
        mode - either java.awt.FileDialog.LOAD or java.awt.FileDialog.SAVE
        Returns:
        name of the file selected by the user
      • __2_plot_and_curve

        protected void __2_plot_and_curve()
      • plot

        public static JxnPerspectivePlotFrame plot​(IKmg3DProjection p3d)
        Creates a JxnPerspectivePlotFrame for the three-dimensional display of vectors and curves. Calls plot( p3d, 1. ).
        Parameters:
        p3d - to get a p3d object enter: #JXN:include/P3dInclude.jxn
        Returns:
        PlotFrame instance to be used to add vectors and curves.
      • plot

        public static JxnPerspectivePlotFrame plot​(IKmg3DProjection p3d,
                                                   double size)
        Creates a JxnPerspectivePlotFrame for the three-dimensional display of vectors and curves.
        Parameters:
        p3d - to get a p3d object enter: #JXN:include/P3dInclude.jxn
        size - of the base vectors (ex, ey, ez) shown. size = 0. hides the base vectors.
        Returns:
        PlotFrame instance to be used to add vectors and curves.
      • nop

        public static byte nop​(double sliderDependentVariable)
        Forces the repetition of a statement by inserting an artificial dependency on sliderDependentVariable.

        A slider animated PlotFrame requires the repetition of all statements which depend on the slider variables. All statements which contain a slider variable or a variable which is dependent on a slider variable are repeated automatically on the change of any of the slider dependent variables. Therefore in most cases it is not necessary to explicitly control the repetition. Only if a statement does not contain any slider dependent variable but must be repeated, the nop methods can be used to artificially create a dependency and thus force the repetition.

        Usage: Add nop(sliderVar) to an arbitrary Java primitive of the statement. As nop(double) returns 0 the result is not changed. If the statement does not contain any Java primitive use nop(java.lang.Object, double).

        Example:
            slider = @JxnSliderPanel(this)
            sliderVar = slider.add( "var", 0., -5., 5. )
            countRepaint = 0  ! statement is not slider dependent => not repeated
            countRepaint = countRepaint + 1 + nop(sliderVar)  ! nop forces repetition on change of sliderVar
            plot( @JxnComplexAlgebra( 1., sliderVar, false ) ).add( @JxnTextPainter( countRepaint, 0., 0. ) )
         
        Parameters:
        sliderDependentVariable - any of the slider variables sliderVar from: sliderVar = slider.add(...)
        Returns:
        0 (byte)   does not change the result if added to a primitive expression
        See Also:
        SliderRepeatNopDemo.html
      • nop

        public static byte nop​(Object sliderDependentObject)
        Deprecated.
        Not needed.
      • nop

        public static Object nop​(Object obj,
                                 double sliderDependentVariable)
        Forces the repetition of a statement by inserting an artificial dependency on sliderDependentVariable.
        Usage:
            nop( obj, sliderVar ).fn()    ! instead of obj.fn()
            obj = nop( fn(), sliderVar )  ! instead of obj = fn()
            fn( nop( obj, sliderVar ) )   ! instead of fn( obj )
         
        Parameters:
        sliderDependentVariable - any of the slider variables sliderVar from: sliderVar = slider.add(...)
        Returns:
        obj without change
        See Also:
        nop(double)
      • nop

        public static Object nop​(Object obj,
                                 Object sliderDependentObject)
        Deprecated.
        Not needed.
      • join

        public static String join​(Object array)
        Formats array as string. Array elements are formatted using the toString() method of the elements and separated by ", ".
        Parameters:
        array - array or object of a class which implements a toArray() method.
      • join

        public static String join​(String separator,
                                  Object array)
        Formats array as string. Array elements are formatted using the toString() method of the elements and separated by separator.
        Parameters:
        separator - zero or more characters separating the array elements.
        array - array or object of a class which implements a toArray() method.
      • split

        public static String[] split​(String delimString,
                                     String text)
        Splits text into parts delimited by the delimiter string delimString. The parts are returned as array elements. The delimiter string is not included in the result. A pair of consecutive occurrences of delimString results in an array element containing an empty string "".
        Parameters:
        delimString - sequence of one or more chars
        See Also:
        KmgStringTokenizer, String.split(java.lang.String, int)
      • toTableRows

        public static String[] toTableRows​(Object[] colArrays)
        Formats a set of column arrays as a String array of the rows using '\t' to separate the array elements of a row.
        Parameters:
        colArrays - see toTableRows(String, Object[])
      • toTableRows

        public static String[] toTableRows​(String separator,
                                           Object[] colArrays)
        Formats a set of column arrays as a String array of the rows using separator to separate the array elements of a row.
        Parameters:
        separator - zero or more characters separating the array elements of a row
        colArrays - array containing an arbitrary nummer of columns. The columns may be given as arrays of primitive, arrays of objects or single objects of a class which implements a toArray() method.
      • toTableRows

        public static String[] toTableRows​(double[][] colArrays)
        Formats a set of column arrays as a String array of the rows using '\t' to separate the array elements of a row.
        Parameters:
        colArrays - array of column arrays of double
      • toTableRows

        public static String[] toTableRows​(String separator,
                                           double[][] colArrays)
        Formats a set of column arrays as a String array of the rows using separator to separate the array elements of a row.
        Parameters:
        separator - zero or more characters separating the array elements of a row
        colArrays - array of column arrays of double
      • format

        public static String format​(Object o,
                                    boolean recursive)
        Formats o for JXN-output.
        Parameters:
        recursive - if true and o is an array it is unrolled recursively.
      • format

        public static String format​(double value,
                                    int nDec)
        Formats value as String with a fixed number of nDec decimals.
        Parameters:
        nDec - If  nDec <= 0 the sign of value is formatted as " + value" or " - value".
        See Also:
        java.text.DecimalFormat
      • repeat

        public static String repeat​(String text,
                                    int n)
        Returns a String which contains text repeated n times.
      • squeeze

        public static String squeeze​(String text)
        Removes blanks from text.
      • squeeze

        public static String squeeze​(String text,
                                     char chRemove)
        Removes all occurrences of chRemove from text.
      • squeeze

        public static String squeeze​(String text,
                                     String removeChars)
        Removes all occurrences of the characters contained in removeChars from text.
      • group

        public static String group​(String text,
                                   int m,
                                   String separator)
        Groups text into sections of m characters by inserting the String separator.
        Parameters:
        m - determines the number of characters of a section.
              if m > 0, grouping start at the left end of text:   group( "1234567890", 4, "~~" ) => 1234~~5678~~90
              if m < 0, grouping start at the right end of text: group( "1234567890", -3, "_" ) => 1_234_567_890
      • addLeadingZeros

        public static String addLeadingZeros​(String text,
                                             int n)
        Prefixes text with '0' so that the result contains at least n characters.
      • addLeadingBlanks

        public static String addLeadingBlanks​(String text,
                                              int n)
        Prefixes text with blanks so that the result contains at least n characters.
      • addLeadingChars

        public static String addLeadingChars​(String text,
                                             int n,
                                             char ch)
        Prefixes text with ch so that the result contains at least n characters.
      • addTrailingChars

        public static String addTrailingChars​(String text,
                                              int n,
                                              char ch)
        Appends text with ch so that the result contains at least n characters.
      • parseHex

        public static Number parseHex​(String hexString)
        Parses hexString to appropriate Number.
        differences compared to e.g. Integer.parseInt( hexString, 16 )
        - negative values optionally with sign '-' or sign bit
        - hexString may contain ' ' oder '_'
        - hexString may start with "0x" oder "0X"
        - ⇒ can read output from String hexString(...)
      • setHexStringSeparator

        public static String setHexStringSeparator​(String separator)
        Sets the group separator for hexString.
        Returns:
        the old separator
      • hexString

        public static String hexString​(double d)
        Formats a double as hexString.
      • hexString

        public static String hexString​(float f)
        Formats a float as hexString.
      • hexString

        public static String hexString​(BigInteger bi)
        Formats a BigInteger as hexString.
      • hexString

        public static String hexString​(long l)
        Formats a long as hexString.
      • hexString

        public static String hexString​(int i)
        Formats an int as hexString.
      • hexString

        public static String hexString​(short sh)
        Formats a short as hexString.
      • hexString

        public static String hexString​(byte by)
        Formats a byte as hexString.
      • hexString

        public static String hexString​(byte[] by)
        Formats a byte array as hexString.
      • hexString

        public static String hexString​(char ch)
        Formats a char as hexString.
      • hexString

        public static String hexString​(char[] ch)
        Formats a char array as hexString.
      • hexString

        public static String hexString​(String text)
        Formats text as hexString.
      • __5_ClassExplorer

        protected void __5_ClassExplorer()
      • formatClass

        public static String[] formatClass​(Object o)
        Formats information of the class of o  (like menu: View > Class… in JxnSession window).

        Example:  #edit formatClass j     ! shows info of class JxnComplexAlgebra
        Parameters:
        o - object, class or "class name as String"
      • formatMethods

        public static String[] formatMethods​(Object o)
        Formats information of the methods of o  (like menu: View > Methods… in JxnSession window).
        Parameters:
        o - object, class or "class name as String"
      • formatMethods

        public static String[] formatMethods​(Object o,
                                             String name)
        Formats information of the methods of o.
        Parameters:
        o - object, class or "class name as String"
        name - selects only methods starting with name
      • __6_extensions_to_Math

        protected void __6_extensions_to_Math()
        Collection of methods adding to java.lang.Math.
      • sinD

        public static double sinD​(double a)
        Calls Math.sin(double) after converting argument a from degrees to radians.
      • cosD

        public static double cosD​(double a)
        Calls Math.cos(double) after converting argument a from degrees to radians.
      • tanD

        public static double tanD​(double a)
        Calls Math.tan(double) after converting argument a from degrees to radians.
      • asinD

        public static double asinD​(double a)
        Calls Math.asin(double) and converts the result from radians to degrees.
      • acosD

        public static double acosD​(double a)
        Calls Math.acos(double) and converts the result from radians to degrees.
      • atanD

        public static double atanD​(double a)
        Calls Math.atan(double) and converts the result from radians to degrees.
      • atan2D

        public static double atan2D​(double y,
                                    double x)
        Calls Math.atan2(double, double) and converts the result from radians to degrees.
      • log2

        public static double log2​(double x)
        Returns the base 2 logarithm of x.
      • log

        public static double log​(double b,
                                 double x)
        Returns the base b logarithm of x.
      • atanh

        public static double atanh​(double x)
        Returns the inverse of  Math.tanh(double).   atanh(x) ≡  0.5 * Math.log( ( 1 + x ) / ( 1 - x ) ).
      • abs

        public static double abs​(double x,
                                 double y)
        Returns sqrt( x * x + y * y ). Calls java.lang.Math.hypot( x, y ).
      • abs

        public static double abs​(double x,
                                 double y,
                                 double z)
        Returns sqrt( x * x + y * y + z * z ).
      • pqRoot

        public static double pqRoot​(double p,
                                    double q)
        Returns solution of   x^2 + p x + q = 0.
        Returns:
        the bigger magnitude solution x1. Get the 2nd solution as   x2 = q / x1.
        Returns Double.NaN, if there are no real roots.
      • round_half_away_from_zero

        public static long round_half_away_from_zero​(double x)
        Returns result of commercial rounding of x.
        See → Wikipedia for a discussion of different rounding methods.
        See Also:
        Math.round(double), Math.rint(double)
      • modulo

        public static double modulo​(double x,
                                    double y)
        Prefer x % y  if  x > 0 and y > 0.
        Example:
            eps = 0.1  ! move curves by eps to make superimposed curves visible
            x = { -200 : 200 } / 20
            plot( x, x %  3 - eps, modulo( x,  3 ) + eps, IEEEremainder( x,  3 ) ).setXYLabels( "x", "y" )
            $.setHeadline( "red: y = x % 3  |  blue: y = modulo( x, 3 )  |  green: y = IEEEremainder( x, 3 )" )
            plot( x, x % -3 + eps, modulo( x, -3 ) - eps, IEEEremainder( x, -3 ) ).setXYLabels( "x", "y" )
            $.setHeadline( "red: y = x % -3  |  blue: y = modulo( x, -3 )  |  green: y = IEEEremainder( x, -3 )" )
        Returns:
        x % y + y  if  x < 0 exor y < 0 else x % y
        See Also:
        Math.IEEEremainder(double, double)
      • modulo

        public static long modulo​(long x,
                                  long y)
        Prefer x % y  if  x > 0 and y > 0.
        Returns:
        x % y + y  if  x < 0 exor y < 0 else x % y
      • modulo

        public static int modulo​(int x,
                                 int y)
        Prefer x % y  if  x > 0 and y > 0.
        Example:
            modulo(  7,  3 )   ! Note:  7 % 3 == 1
             = 1 (int)
            modulo( -7,  3 )   ! Note: -7 % 3 == -1
             = 2 (int)
            modulo(  7, -3 )   ! Note:  7 % -3 == 1
             = -2 (int)
            modulo( -7, -3 )   ! Note: -7 % -3 == -1
             = -1 (int)
        Returns:
        x % y + y  if  x < 0 exor y < 0 else x % y
      • __7_setField

        protected void __7_setField()
        Set public fields of an object or a class. (To be used, if the class does not provide setter methods for the fields).
      • get

        public static Object get​(Object ao,
                                 int i)
        In JXN prefer ao[i].
      • get

        public static Object get​(Object ao,
                                 double x)
        Returns ao[round(x)] with array index limitted to 0 <= index < ao.length.
      • setArrayReturnOldValue

        public static boolean setArrayReturnOldValue​(boolean returnOldValue)
        Controls if the set array methods return the old (overwriten) array value. By default the set methods return the array argument.
      • newArray

        public static Object newArray​(Class<?> componentType,
                                      int length)
        Creates a new array with the specified component type and length.
        Shortcut for java.lang.reflect.Array.newInstance( componentType, length ).
      • newArray

        public static Object newArray​(Class<?> componentType,
                                      int length,
                                      Object initial)
        Creates a new array with the specified component type and length, initialized with initial.
      • newArray

        public static Object newArray​(int length,
                                      Object initial)
        Creates a new array with the specified length, initialized with initial.
        Returns:
        newArray( initial.getClass(), length, initial )
      • newArray

        public static Object newArray​(Class<?> componentType,
                                      int... dimensions)
        Creates a new array with the specified component type and dimensions.
        Shortcut for java.lang.reflect.Array.newInstance( componentType, dimension... ).
        Example: da3x5 = newArray( Double.TYPE, { 3, 5 } )
      • find

        public static int find​(Object[] array,
                               Object o)
        Search array for o.
        Returns:
        first index i where array[i].equals(o) or -1 if not found
      • find

        public static int find​(Object[] array,
                               int fromIndex,
                               Object o)
        Search array for o starting from fromIndex.
        Returns:
        first index i where array[i].equals(o) or -1 if not found
      • doubleArray

        public static Object doubleArray​(int length)
        Creates a new double array with the specified length. In JXN use doubleArray(length) instead of new double[length].
        Shortcut for newArray( Double.TYPE, length ).
      • doubleArray

        public static Object doubleArray​(int length,
                                         double initial)
        Creates a new double array with the specified length, initialized with initial.
      • add

        public static Object add​(double[] array,
                                 int i,
                                 double value)
        Adds value to array[i].
      • total

        public static double total​(double[] array)
        Returns the sum of the values of array.
      • cumulated

        public static double[] cumulated​(double[] array)
        Returns a new array containing the partial (cumulated) sums of the values of array.
        Returns:
        result[0] = array[0]; result[i] = result[i-1] + array[i] for i = 1 ... n-1
      • differences

        public static double[] differences​(double[] array)
        Returns a new array containing the differences of subsequent values of array.
        Returns:
        result[i] = array[i+1] - array[i] for i = 0 ... n-2
      • longArray

        public static Object longArray​(int length,
                                       long initial)
        Creates a new long array with the specified length, initialized with initial.
      • add

        public static Object add​(long[] array,
                                 int i,
                                 long value)
        Adds value to array[i].
      • find

        public static int find​(long[] array,
                               long value)
        Search array for value.
        Returns:
        first index i where array[i] == value or -1 if not found
      • find

        public static int find​(long[] array,
                               int fromIndex,
                               long value)
        Search array for value starting from fromIndex.
        Returns:
        first index i where array[i] == value or -1 if not found
      • total

        public static long total​(long[] array)
        Returns the sum of the values of array.
      • cumulated

        public static long[] cumulated​(long[] array)
        Returns a new array containing the partial (cumulated) sums of the values of array.
        Returns:
        result[0] = array[0]; result[i] = result[i-1] + array[i] for i = 1 ... n-1
      • differences

        public static long[] differences​(long[] array)
        Returns a new array containing the differences of subsequent values of array.
        Returns:
        result[i] = array[i+1] - array[i] for i = 0 ... n-2
      • intArray

        public static Object intArray​(int length)
        Creates a new int array with the specified length. In JXN use intArray(length) instead of new int[length].
        Shortcut for newArray( Integer.TYPE, length ).
      • intArray

        public static Object intArray​(int length,
                                      int initial)
        Creates a new int array with the specified length, initialized with initial.
      • add

        public static Object add​(int[] array,
                                 int i,
                                 int value)
        Adds value to array[i].
      • find

        public static int find​(int[] array,
                               int value)
        Search array for value.
        Returns:
        first index i where array[i] == value or -1 if not found
      • find

        public static int find​(int[] array,
                               int fromIndex,
                               int value)
        Search array for value starting from fromIndex.
        Returns:
        first index i where array[i] == value or -1 if not found
      • total

        public static int total​(int[] array)
        Returns the sum of the values of array.
      • cumulated

        public static int[] cumulated​(int[] array)
        Returns a new array containing the partial (cumulated) sums of the values of array.
        Returns:
        result[0] = array[0]; result[i] = result[i-1] + array[i] for i = 1 ... n-1
      • differences

        public static int[] differences​(int[] array)
        Returns a new array containing the differences of subsequent values of array.
        Returns:
        result[i] = array[i+1] - array[i] for i = 0 ... n-2
      • byteArray

        public static Object byteArray​(int length)
        Creates a new byte array with the specified length. In JXN use byteArray(length) instead of new byte[length].
        Shortcut for newArray( Byte.TYPE, length ).
      • byteArray

        public static Object byteArray​(int length,
                                       byte initial)
        Creates a new byte array with the specified length, initialized with initial.
      • add

        public static Object add​(byte[] array,
                                 int i,
                                 byte value)
        Adds value to array[i] with overflow, if the result does not fit into byte.
      • find

        public static int find​(byte[] array,
                               byte value)
        Search array for value.
        Returns:
        first index i where array[i] == value or -1 if not found
      • find

        public static int find​(byte[] array,
                               int fromIndex,
                               byte value)
        Search array for value starting from fromIndex.
        Returns:
        first index i where array[i] == value or -1 if not found
      • total

        public static int total​(byte[] array)
        Returns the int sum of the values of array.
      • booleanArray

        public static Object booleanArray​(int length,
                                          boolean initial)
        Creates a new boolean array with the specified length, initialized with initial.
      • flip

        public static Object flip​(boolean[] array,
                                  int i)
        Toggles array[i].
      • find

        public static int find​(boolean[] array,
                               boolean value)
        Search array for value.
        Returns:
        first index i where array[i] == value or -1 if not found
      • find

        public static int find​(boolean[] array,
                               int fromIndex,
                               boolean value)
        Search array for value starting from fromIndex.
        Returns:
        first index i where array[i] == value or -1 if not found
      • total

        public static int total​(boolean[] array)
        Returns the number of true values in array.
      • any

        public static boolean any​(boolean[] array)
        Returns true, if at least one value in array is true.
      • all

        public static boolean all​(boolean[] array)
        Returns true, if all values in array are true.
      • find

        public static int find​(char[] array,
                               char value)
        Search array for value.
        Returns:
        first index i where array[i] == value or -1 if not found
      • find

        public static int find​(char[] array,
                               int fromIndex,
                               char value)
        Search array for value starting from fromIndex.
        Returns:
        first index i where array[i] == value or -1 if not found
      • concat

        public static Object concat​(Object arr1,
                                    Object arr2)
        Returns a new array containing the elements of array arr1 followed by the elements of array arr2.
        arr1 and arr2 may be primitive or object arrays but must be of compatible type.
        Uses java.lang.System.arraycopy.
      • concat

        public static Object concat​(Object... arrays)
        Returns a new array containing the elements of all arrays passed as arguments.
        arrays may be primitive or object arrays but must be of compatible type.
        Uses java.lang.System.arraycopy.
        Usage in jxn: concat( { arr1, arr2, arr3 } )
      • toArray

        public static Object toArray​(Object ao,
                                     int mode)
        Check, if ao is an array or try to call ao.toArray().
        In addition to KmgStaticUtilities.toArray(java.lang.Object) narrows the result type.
        Parameters:
        ao - array or instance of a class that implements a toArray() method
        mode - controlls what to do, if ao is not an array and a toArray() method is not available for ao
               -1 : throws Exception
                0 : returns null
                1 : returns array with ao as the single element
                2 : returns ao
        Returns:
        ao, if ao is an array else
        ao.toArray(), if toArray() method is available else
        see parameter mode
      • stringArray

        public static String[] stringArray​(String csvList)
        Deprecated.
        In JXN prefer { "abc", "xyz" }.
      • doubleArray

        public static double[] doubleArray​(String csvList)
        Deprecated.
        In JXN prefer { 2., 3., 5., 7. }.
      • intArray

        public static int[] intArray​(String csvList)
        Deprecated.
        In JXN prefer { 123, 456, 789 }.
      • getClass

        public static Class getClass​(Object ao)
        Deprecated.
        No more needed: Simply call ao.getClass(). To call java.lang.Object.getClass() on the array elements of  ao  use JxnObject.getClassArray(ao).
        Returns the class of an object ao (workaround for array objects in JXN). The automatic array feature of JXN calls methods on the component objects of an array rather than on the array object itself. This inhibits the call of methods of java.lang.Object especially getClass() on an array object. In JXN ao.getClass() (other than in Java) returns a java.lang.Class[] array containing the component types. As a workaround to get the class of an array object getClass(ao) is used instead of ao.getClass().
        Returns:
        ao.getClass()  (java.lang.Object)
      • __9_boolean_operators

        protected void __9_boolean_operators()
      • not

        public static boolean not​(boolean x)
        Represents the Java boolean operator. For a boolean x in JXN -x can be used instead of not(x).
        Returns:
        ! x
      • and

        public static boolean and​(boolean x,
                                  boolean y)
        Represents the Java boolean operator. For booleans x and y in JXN x*y can be used instead of and(x,y).
        Returns:
        x && y
      • or

        public static boolean or​(boolean x,
                                 boolean y)
        Represents the Java boolean operator. For booleans x and y in JXN x+y can be used instead of or(x,y).
        Returns:
        x || y
      • exor

        public static boolean exor​(boolean x,
                                   boolean y)
        Represents the Java boolean operator. For booleans x and y in JXN x^y can be used instead of exor(x,y).
        Returns:
        x ^ y (using the Java boolean exor operator !!)
      • not

        public static long not​(long x)
        Represents the Java bitwise operator (for long).
        Returns:
        ~x
      • not

        public static int not​(int x)
        Represents the Java bitwise operator (for int).
        Returns:
        ~x
      • and

        public static long and​(long x,
                               long y)
        Represents the Java bitwise operator (for long).
        Returns:
        x & y
      • and

        public static int and​(int x,
                              int y)
        Represents the Java bitwise operator (for int).
        Returns:
        x & y
      • or

        public static long or​(long x,
                              long y)
        Represents the Java bitwise operator (for long).
        Returns:
        x | y
      • or

        public static int or​(int x,
                             int y)
        Represents the Java bitwise operator (for int).
        Returns:
        x | y
      • exor

        public static long exor​(long x,
                                long y)
        Represents the Java bitwise operator (for long). Note: in jxn the ^ operator ist used to represent pow(x,y).
        Returns:
        x ^ y (using the Java bitwise exor operator !!)
      • exor

        public static int exor​(int x,
                               int y)
        Represents the Java bitwise operator (for int). Note: in jxn the ^ operator ist used to represent pow(x,y).
        Returns:
        x ^ y (using the Java bitwise exor operator !!)
      • left

        public static long left​(long x,
                                int i)
        Represents the Java bit shift operator (for long).
        Returns:
        x << i
      • left

        public static int left​(int x,
                               int i)
        Represents the Java bit shift operator (for int).
        Returns:
        x << i
      • right

        public static long right​(long x,
                                 int i)
        Represents the Java bit shift operator (for long).
        Returns:
        x >> i
      • right

        public static int right​(int x,
                                int i)
        Represents the Java bit shift operator (for int).
        Returns:
        x >> i
      • right0

        public static long right0​(long x,
                                  int i)
        Represents the Java bit shift operator (for long).
        Returns:
        x >>> i
      • right0

        public static int right0​(int x,
                                 int i)
        Represents the Java bit shift operator (for int).
        Returns:
        x >>> i
      • _11_relational_operators

        protected void _11_relational_operators()
      • eq

        public static boolean eq​(double x,
                                 double y)
        Represents the Java relational operator.
        Returns:
        x == y
      • eq

        public static boolean eq​(long x,
                                 long y)
        Represents the Java relational operator.
        Returns:
        x == y
      • eq

        public static boolean eq​(boolean x,
                                 boolean y)
        Represents the Java relational operator.
        Returns:
        x == y
      • ne

        public static boolean ne​(double x,
                                 double y)
        Represents the Java relational operator.
        Returns:
        x != y
      • ne

        public static boolean ne​(long x,
                                 long y)
        Represents the Java relational operator.
        Returns:
        x != y
      • ne

        public static boolean ne​(boolean x,
                                 boolean y)
        Represents the Java relational operator.
        Returns:
        x != y
      • lt

        public static boolean lt​(double x,
                                 double y)
        Represents the Java relational operator.
        Returns:
        x < y
      • lt

        public static boolean lt​(long x,
                                 long y)
        Represents the Java relational operator.
        Returns:
        x < y
      • le

        public static boolean le​(double x,
                                 double y)
        Represents the Java relational operator.
        Returns:
        x <= y
      • le

        public static boolean le​(long x,
                                 long y)
        Represents the Java relational operator.
        Returns:
        x <= y
      • gt

        public static boolean gt​(double x,
                                 double y)
        Represents the Java relational operator.
        Returns:
        x > y
      • gt

        public static boolean gt​(long x,
                                 long y)
        Represents the Java relational operator.
        Returns:
        x > y
      • ge

        public static boolean ge​(double x,
                                 double y)
        Represents the Java relational operator.
        Returns:
        x >= y
      • ge

        public static boolean ge​(long x,
                                 long y)
        Represents the Java relational operator.
        Returns:
        x >= y
      • isNull

        public static boolean isNull​(Object o)
        Returns true if o == null.
        Returns:
        o == null.
      • isNull

        public static boolean isNull​(double x)
        Allows the generic check of arbitrary variables (e.g.arguments passed to jxn files). A variable may be an object or a Java primitve. In case of a primitive the isNull(Object) method does not match. Instead this method is called and always returns false;
        Returns:
        always returns false
      • isPrimitiveOrJavaWrapper

        public static boolean isPrimitiveOrJavaWrapper​(Object x)
        Used in jxn files to check the type of x. Called in jxn files for isPrimitiveOrJavaWrapper(x) if x is an object reference (except Java primitive wrapper). Also consider: JxnObject.getClass(x).isPrimitive() (returns false for Java primitive wrapper).
        Returns:
        false
      • isPrimitiveOrJavaWrapper

        public static boolean isPrimitiveOrJavaWrapper​(double x)
        Used in jxn files to check the type of x. Called in jxn files for isPrimitiveOrJavaWrapper(x) if x is a primitive or Java primitive wrapper. Also consider: JxnObject.getClass(x).isPrimitive() (returns false for Java primitive wrapper).
        Returns:
        true
      • isArray

        public static boolean isArray​(Object o)
        Returns true if o is an array (null returns false).
      • contains

        public static boolean contains​(String chars,
                                       char ch)
        Returns true if chars contains ch.
      • sw

        public static int sw​(int ivar,
                             double slider_switch)
        Returns 1 if  ivar-0.5 <= slider_switch < ivar+0.5 else 0.
      • sw

        public static double sw​(boolean b,
                                double yTrue,
                                double yFalse)
        Returns yTrue, if  b is true else yFalse.
      • sw

        public static long sw​(boolean b,
                              long yTrue,
                              long yFalse)
        Returns yTrue, if  b is true else yFalse.
      • sw

        public static int sw​(boolean b,
                             int yTrue,
                             int yFalse)
        Returns yTrue, if  b is true else yFalse.
      • sw

        public static Object sw​(boolean b,
                                Object oTrue,
                                Object oFalse)
        Returns oTrue, if  b is true else oFalse.
      • sw

        public static double sw​(double x,
                                double yLT,
                                double yGE)
        Returns yLT, if  x < 0. else yGE.
      • sw

        public static long sw​(double x,
                              long yLT,
                              long yGE)
        Returns yLT, if  x < 0. else yGE.
      • sw

        public static int sw​(double x,
                             int yLT,
                             int yGE)
        Returns yLT, if  x < 0. else yGE.
      • sw

        public static Object sw​(double x,
                                Object oLT,
                                Object oGE)
        Returns oLT, if  x < 0 else oGE.
      • sw

        public static double sw​(double x,
                                double yLT,
                                double yEQ,
                                double yGT)
        Returns yLT, if  x < 0. else yGT, if  x > 0. else yEQ.
      • sw

        public static long sw​(double x,
                              long yLT,
                              long yEQ,
                              long yGT)
        Returns yLT, if  x < 0. else yGT, if  x > 0. else yEQ.
      • sw

        public static int sw​(double x,
                             int yLT,
                             int yEQ,
                             int yGT)
        Returns yLT, if  x < 0. else yGT, if  x > 0. else yEQ.
      • sw

        public static Object sw​(double x,
                                Object oLT,
                                Object oEQ,
                                Object oGT)
        Returns oLT, if  x < 0 else oGT, if  x > 0 else oEQ.
      • sw

        public static double sw​(double x,
                                double eps,
                                double yLower,
                                double yInner,
                                double yUpper)
        Returns yLower, if  x < -eps else yUpper, if  x > eps else yInner.
      • sw

        public static Object sw​(double x,
                                double eps,
                                Object oLower,
                                Object oInner,
                                Object oUpper)
        Returns oLower, if  x < -eps else oUpper, if  x > eps else oInner.
      • sw

        public static double sw​(double x,
                                double xLower,
                                double xUpper,
                                double yLower,
                                double yInner,
                                double yUpper)
        Returns yLower, if  x < xLower else yUpper, if  x > xUpper else yInner.
      • sw

        public static Object sw​(double x,
                                double xLower,
                                double xUpper,
                                Object oLower,
                                Object oInner,
                                Object oUpper)
        Returns oLower, if  x < xLower else oUpper, if  x > xUpper else oInner.
      • sw

        public static Object sw​(double x,
                                Object[] oa)
        Returns oa[round(x)] with array index limitted to 0 <= index < oa.length.
      • limit

        public static double limit​(double x,
                                   double xmin,
                                   double xmax)
        Keeps x within xmin and xmax.
        Returns:
        xmin, if  x < xmin else xmax, if  x > xmax else x.
      • limit

        public static long limit​(long x,
                                 long xmin,
                                 long xmax)
        Keeps x within xmin and xmax.
        Returns:
        xmin, if  x < xmin else xmax, if  x > xmax else x.
      • limit

        public static int limit​(int x,
                                int xmin,
                                int xmax)
        Keeps x within xmin and xmax.
        Returns:
        xmin, if  x < xmin else xmax, if  x > xmax else x.
      • clip

        public static double clip​(double x,
                                  double lower,
                                  double upper)
        Returns x limitted by lower and upper. Clipped values are replaced by Double.NaN.
        Returns:
            if( lower < upper )
               x if lower <= x <= upper
               Double.NaN else
        
            else if( lower > upper )
               Double.NaN if upper < x < lower
               x else
        
            else // lower == upper
               Double.NaN if lower == x == upper
               x else
         
        See Also:
        JxnRealArrayAlgebra.clip(JxnRealArrayAlgebra, double, double)