Class JxnUtilities
- java.lang.Object
-
- JxnUtilities
-
public class JxnUtilities extends Object
Collection of methods in the following sections:
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
__1_fileDialog()
void
__2_plot_and_curve()
void
__3_formatting_to_String()
void
__4_hex_formatting()
Adds to hex formatting and parsing methods.void
__5_ClassExplorer()
void
__6_extensions_to_Math()
Collection of methods adding tojava.lang.Math
.void
__7_setField()
Set public fields of an object or a class.void
__8_array_operations()
void
__9_boolean_operators()
void
_10_bitwise_operators()
void
_11_relational_operators()
void
_12_formula_switching()
static double
abs(double x, double y)
Returnssqrt( x * x + y * y )
.static double
abs(double x, double y, double z)
Returnssqrt( x * x + y * y + z * z )
.static double
acosD(double a)
CallsMath.acos(double)
and converts the result from radians to degrees.static double
acosh(double x)
Returns the inverse ofMath.cosh(double)
.static String
addLeadingBlanks(String text, int n)
Prefixestext
with blanks so that the result contains at leastn
characters.static String
addLeadingChars(String text, int n, char ch)
Prefixestext
withch
so that the result contains at leastn
characters.static String
addLeadingZeros(String text, int n)
Prefixestext
with'0'
so that the result contains at leastn
characters.static String
addTrailingChars(String text, int n, char ch)
Appendstext
withch
so that the result contains at leastn
characters.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 double
asinD(double a)
CallsMath.asin(double)
and converts the result from radians to degrees.static double
asinh(double x)
Returns the inverse ofMath.sinh(double)
.static double
atan2D(double y, double x)
CallsMath.atan2(double, double)
and converts the result from radians to degrees.static double
atanD(double a)
CallsMath.atan(double)
and converts the result from radians to degrees.static double
atanh(double x)
Returns the inverse ofMath.tanh(double)
.static Object
byteArray(int length)
Creates a new byte array with the specified length.static double
clip(double x, double lower, double upper)
Returnsx
limitted bylower
andupper
.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 arrayarr1
followed by the elements of arrayarr2
.static double
cosD(double a)
CallsMath.cos(double)
after converting argumenta
from degrees to radians.static JxnRealArrayCurve
curve(double[] x, double[] y, double[] z, IKmg3DProjection p3d)
Deprecated.Useplot(p3d)
.add( x, y, z )
.static JxnRealArrayCurve
curve(double[] x, double[] y, double[] z, IKmg3DProjection p3d, Color color)
Deprecated.static JxnRealArrayCurve
curve(double[] x, double[] y, double[] z, IKmg3DProjection p3d, Color color, int lineType)
Deprecated.static JxnRealArrayCurve
curve(double[] x, double[] y, Color color)
Returns a curve representation ofx
andy
( xi = x[i], yi = y[i] ).static JxnRealArrayCurve
curve(double[] x, double[] y, Color color, int lineType)
Seecurve
.static JxnRealArrayCurve
curve(double[] y, Color color)
Returns a curve representation ofy
( xi = i, yi = y[i] ).static JxnRealArrayCurve
curve(double[] y, Color color, int lineType)
Seecurve
.static Object
doubleArray(int length)
Creates a new double array with the specified length.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 callo1.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()
CallsfileDialog( String defaultFilename, int mode )
withdefaultFilename = "*"
andmode =
FileDialog.LOAD
.static String
fileDialog(String defaultFilename)
static String
fileDialog(String defaultFilename, int mode)
Displaysjava.awt.
FileDialog
and returns the filename selected by the user.static int
find(Object[] array, Object o)
Searcharray
foro
.static String
format(double value, int nDec)
Formatsvalue
as String withnDec
decimals.static String
format(Object o)
Formatso
for JXN-output.static String
format(Object o, boolean recursive)
Formatso
for JXN-output.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 array, int i)
In JXN preferarray[i]
.static Class
getClass(Object ao)
Deprecated.No more needed: Simply callao.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 firstnHead
and the lastnTrail
tokens delimited bydelimString
fromtext
.static JxnRealArrayAlgebra
getZ(KmgParallelProjection p3d, JxnRealArrayAlgebra[] rxyz)
Returns the z-component of the projection.static String
group(String text, int m)
Groupstext
into sections ofm
characters by inserting blanks.static String
group(String text, int m, String separator)
Groupstext
into sections ofm
characters by inserting the Stringseparator
.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 callao.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)
Formatstext
as hexString.static String
hexString(BigInteger bi)
Formats a BigInteger as hexString.static double
hexStringToDouble(String hexString)
Parses hexString to double usingparseHex(String hexString)
andDouble.longBitsToDouble(long)
.static float
hexStringToFloat(String hexString)
Parses hexString to float usingparseHex(String hexString)
andFloat.intBitsToFloat(int)
.static Object
intArray(int length)
Creates a new int array with the specified length.static int[]
intArray(String csvList)
Deprecated.In JXN prefer{ 123, 456, 789 }
.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 ofx
.static boolean
isPrimitiveOrJavaWrapper(Object x)
Used in jxn files to check the type ofx
.static boolean
isSame(Object x, Object y)
Returns true if x == y.static String
join(Object array)
Formatsarray
as string.static String
join(String separator, Object array)
Formatsarray
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 array)
Returns the length of an array.static double
limit(double x, double xmin, double xmax)
Keepsx
withinxmin
andxmax
.static int
limit(int x, int xmin, int xmax)
Keepsx
withinxmin
andxmax
.static long
limit(long x, long xmin, long xmax)
Keepsx
withinxmin
andxmax
.static double
log(double b, double x)
Returns the baseb
logarithm ofx
.static double
log2(double x)
Returns the base 2 logarithm ofx
.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 double
modulo(double x, double y)
Preferx % y
ifx > 0
andy > 0
.
Example:static int
modulo(int x, int y)
Preferx % y
ifx > 0
andy > 0
.static long
modulo(long x, long y)
Preferx % y
ifx > 0
andy > 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(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 byte
nop(double sliderDependentVariable)
Forces the repetition of a statement by inserting an artificial dependency onsliderDependentVariable
.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 onsliderDependentVariable
.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)
ParseshexString
to appropriateNumber
.static JxnRealArrayPlotFrame
plot(double[] y)
Creates a newJxnRealArrayPlotFrame
and visualizes the values ofy
as a curve:
xi = i, yi = y[i], i = 0 ... y.length - 1.static JxnRealArrayPlotFrame
plot(double[] x, double[] y)
Creates a newJxnRealArrayPlotFrame
and visualizes the values ofx
andy
as a curve:
xi = x[i], yi = y[i], i = 0 ... min( x.length, y.length ) - 1.static JxnRealArrayPlotFrame
plot(double[] x, double[] y1, double[] y2)
static JxnRealArrayPlotFrame
plot(double[] x, double[] y1, double[] y2, double[] y3)
static JxnRealArrayPlotFrame
plot(double[] x, double[] y, Color color)
Seeplot
.static JxnRealArrayPlotFrame
plot(double[] x, double[] y, Color color, int lineType)
Seeplot
.static JxnRealArrayPlotFrame
plot(double[] x, double[] y, Color color, int lineType, double vyx)
Seeplot
.static JxnRealArrayPlotFrame
plot(double[] x, double[] y, Color color, int lineType, float lineWidth, double vyx)
Seeplot
.static JxnRealArrayPlotFrame
plot(double[] x, double[] y, Color color, Stroke stroke, double vyx)
Seeplot
.static JxnPerspectivePlotFrame
plot(IKmg3DProjection p3d)
Creates aJxnPerspectivePlotFrame
for the three-dimensional display of vectors and curves.static JxnPerspectivePlotFrame
plot(IKmg3DProjection p3d, double size)
Creates aJxnPerspectivePlotFrame
for the three-dimensional display of vectors and curves.static Frame
plot(KmgXYPainter painter)
Deprecated....static double
pqRoot(double p, double q)
Returns solution ofx^2 + p x + q = 0
.static String[]
print(PrintStream ps, String[] lines)
Writeslines
line by line tops
.static String
repeat(String text, int n)
Returns a String which containstext
repeatedn
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 ofx
.static Object
set(boolean[] array, int i, boolean value)
Shortcut forjava.lang.reflect.
Array.setBoolean( Object array, int i, boolean value )
.static Object
set(byte[] array, int i, byte value)
Shortcut forjava.lang.reflect.
Array.setByte( Object array, int i, byte value )
.static Object
set(char[] array, int i, char value)
Shortcut forjava.lang.reflect.
Array.setChar( Object array, int i, char value )
.static Object
set(double[] array, int i, double value)
Shortcut forjava.lang.reflect.
Array.setDouble( Object array, int i, double value )
.static Object
set(float[] array, int i, float value)
Shortcut forjava.lang.reflect.
Array.setFloat( Object array, int i, float value )
.static Object
set(int[] array, int i, int value)
Shortcut forjava.lang.reflect.
Array.setInt( Object array, int i, int value )
.static Object
set(long[] array, int i, long value)
Shortcut forjava.lang.reflect.
Array.setLong( Object array, int i, long value )
.static Object
set(short[] array, int i, short value)
Shortcut forjava.lang.reflect.
Array.setShort( Object array, int i, short value )
.static Object
set(Object[] array, int i, Object value)
Sets the value of thei
-th component ofarray
to the specified newvalue
.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 byfieldName
of an object or a class to the givenvalue
.static boolean
setArrayReturnOldValue(boolean returnOldValue)
Controls if the set array methods return the old (overwriten) array value.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)
CallsMath.sin(double)
after converting argumenta
from degrees to radians.static String[]
split(String delimString, String text)
Splitstext
into parts delimited by the delimiter stringdelimString
.static String
squeeze(String text)
Removes blanks fromtext
.static String
squeeze(String text, char chRemove)
Removes all occurrences ofchRemove
fromtext
.static String
squeeze(String text, String removeChars)
Removes all occurrences of the characters contained inremoveChars
fromtext
.static String[]
stringArray(String csvList)
Deprecated.In JXN prefer{ "abc", "xyz" }
.static String[]
stringArray(String csvList, String delimChars)
Returns array of tokens fromStringTokenizer.nextToken()
.static double
sw(boolean b, double yTrue, double yFalse)
Returns ...static int
sw(boolean b, int yTrue, int yFalse)
Returns ...static long
sw(boolean b, long yTrue, long yFalse)
Returns ...static Object
sw(boolean b, Object oTrue, Object oFalse)
Returns ...static double
sw(double x, double yLT, double yGE)
Returns ...static double
sw(double x, double yLT, double yEQ, double yGT)
Returns ...static double
sw(double x, double xLower, double xUpper, double yLower, double yInner, double yUpper)
Returns ...static Object
sw(double x, double xLower, double xUpper, Object oLower, Object oInner, Object oUpper)
Returns ...static int
sw(double x, int yLT, int yGE)
Returns ...static int
sw(double x, int yLT, int yEQ, int yGT)
Returns ...static long
sw(double x, long yLT, long yGE)
Returns ...static long
sw(double x, long yLT, long yEQ, long yGT)
Returns ...static Object
sw(double x, Object[] oa)
static Object
sw(double x, Object oLT, Object oGE)
Returns ...static Object
sw(double x, Object oLT, Object oEQ, Object oGT)
Returns ...static int
sw(int ivar, double slider_switch)
Returns ...static double
tanD(double a)
CallsMath.tan(double)
after converting argumenta
from degrees to radians.static String
toRawString(Object o)
Formatso
to the string which would be returned by thetoString()
method, if the same had not been overwriten for the class ofo
.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(Collection c)
Formatsc
as aString
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 usingseparator
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 usingseparator
to separate the array elements of a row.static String
whatIs(Object o)
Deprecated.replaced byJxnParameterCheck.whatIs(Object)
.
-
-
-
Method Detail
-
__1_fileDialog
public void __1_fileDialog()
-
fileDialog
public static String fileDialog(String defaultFilename, int mode)
Displaysjava.awt.
FileDialog
and returns the filename selected by the user.- Parameters:
defaultFilename
- narrows down the files displayed in the FileDialogmode
- eitherjava.awt.
FileDialog.LOAD
orjava.awt.
FileDialog.SAVE
- Returns:
- name of the file selected by the user
-
fileDialog
public static String fileDialog(String defaultFilename)
- Returns:
- name of the file selected by the user
-
fileDialog
public static String fileDialog()
CallsfileDialog( String defaultFilename, int mode )
withdefaultFilename = "*"
andmode =
FileDialog.LOAD
.- Returns:
- name of the file selected by the user
-
__2_plot_and_curve
public void __2_plot_and_curve()
-
plot
public static Frame plot(KmgXYPainter painter)
Deprecated....
-
plot
public static JxnPerspectivePlotFrame plot(IKmg3DProjection p3d)
Creates aJxnPerspectivePlotFrame
for the three-dimensional display of vectors and curves. Callsplot
( p3d, 1. )
.
-
plot
public static JxnPerspectivePlotFrame plot(IKmg3DProjection p3d, double size)
Creates aJxnPerspectivePlotFrame
for the three-dimensional display of vectors and curves.
-
getZ
public static JxnRealArrayAlgebra getZ(KmgParallelProjection p3d, JxnRealArrayAlgebra[] rxyz)
Returns the z-component of the projection.
-
plot
public static JxnRealArrayPlotFrame plot(double[] y)
Creates a newJxnRealArrayPlotFrame
and visualizes the values ofy
as a curve:
xi = i, yi = y[i], i = 0 ... y.length - 1.- Returns:
PlotFrame
instance can be used to add furthercurves
andphasors
.- See Also:
JxnRealArrayAlgebra.plot(JxnRealArrayAlgebra ry)
-
plot
public static JxnRealArrayPlotFrame plot(double[] x, double[] y)
Creates a newJxnRealArrayPlotFrame
and visualizes the values ofx
andy
as a curve:
xi = x[i], yi = y[i], i = 0 ... min( x.length, y.length ) - 1.- Returns:
PlotFrame
instance can be used to add furthercurves
andphasors
.- See Also:
JxnRealArrayAlgebra.plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry)
-
plot
public static JxnRealArrayPlotFrame plot(double[] x, double[] y1, double[] y2)
-
plot
public static JxnRealArrayPlotFrame plot(double[] x, double[] y1, double[] y2, double[] y3)
-
plot
public static JxnRealArrayPlotFrame plot(double[] x, double[] y, Color color)
Seeplot
.
-
plot
public static JxnRealArrayPlotFrame plot(double[] x, double[] y, Color color, int lineType)
Seeplot
.- Parameters:
lineType
- seeJxnRealArrayCurve
- See Also:
JxnRealArrayAlgebra.plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, Color color, int lineType)
-
plot
public static JxnRealArrayPlotFrame plot(double[] x, double[] y, Color color, int lineType, double vyx)
Seeplot
.- Parameters:
vyx
- fixed ratio of the scaling: 1.0 for equally scaled x- and y-axis.- See Also:
JxnRealArrayAlgebra.plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, Color color, int lineType, double vyx)
-
plot
public static JxnRealArrayPlotFrame plot(double[] x, double[] y, Color color, int lineType, float lineWidth, double vyx)
Seeplot
.- Parameters:
lineWidth
- seejava.awt.BasicStroke
- See Also:
JxnRealArrayAlgebra.plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, Color color, int lineType, float lineWidth, double vyx)
-
plot
public static JxnRealArrayPlotFrame plot(double[] x, double[] y, Color color, Stroke stroke, double vyx)
Seeplot
.- Parameters:
stroke
- seejava.awt.BasicStroke
- See Also:
JxnRealArrayAlgebra.plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, Color color, Stroke stroke, double vyx)
-
curve
public static JxnRealArrayCurve curve(double[] x, double[] y, Color color)
Returns a curve representation ofx
andy
( xi = x[i], yi = y[i] ). Call theadd
method on aPlotFrame
instance to display the curve in the PlotFrame. Allows e.g. to show a curve in aJxnComplexPlotFrame
.
Example for given arraysx
andy
:pf = plot( 3 + j 4 ).add( curve( x, y, Color.BLUE ) )
-
curve
public static JxnRealArrayCurve curve(double[] x, double[] y, Color color, int lineType)
Seecurve
.- Parameters:
lineType
- seeJxnRealArrayCurve
- See Also:
JxnRealArrayAlgebra.curve(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, Color color, int lineType)
-
curve
public static JxnRealArrayCurve curve(double[] y, Color color)
-
curve
public static JxnRealArrayCurve curve(double[] y, Color color, int lineType)
Seecurve
.- Parameters:
lineType
- seeJxnRealArrayCurve
- See Also:
JxnRealArrayAlgebra.curve(JxnRealArrayAlgebra ry, Color color, int lineType)
-
curve
public static JxnRealArrayCurve curve(double[] x, double[] y, double[] z, IKmg3DProjection p3d)
Deprecated.Useplot(p3d)
.add( x, y, z )
.
-
curve
public static JxnRealArrayCurve curve(double[] x, double[] y, double[] z, IKmg3DProjection p3d, Color color)
Deprecated.
-
curve
public static JxnRealArrayCurve curve(double[] x, double[] y, double[] z, IKmg3DProjection p3d, Color color, int lineType)
Deprecated.
-
nop
public static byte nop(double sliderDependentVariable)
Forces the repetition of a statement by inserting an artificial dependency onsliderDependentVariable
.
A slider animatedPlotFrame
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, thenop
methods can be used to artificially create a dependency and thus force the repetition.
Usage: Addnop(sliderVar)
to an arbitrary Java primitive of the statement. Asnop(double)
returns 0 the result is not changed. If the statement does not contain any Java primitive usenop(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 variablessliderVar
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 onsliderDependentVariable
.
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 variablessliderVar
from:sliderVar
=
slider
.
add
(...)
- Returns:
obj
without change- See Also:
nop(double)
-
__3_formatting_to_String
public void __3_formatting_to_String()
-
join
public static String join(Object array)
Formatsarray
as string. Array elements are formatted using thetoString()
method of the elements and separated by ", ".- Parameters:
array
- array or object of a class which implements atoArray()
method.
-
join
public static String join(String separator, Object array)
Formatsarray
as string. Array elements are formatted using thetoString()
method of the elements and separated byseparator
.- Parameters:
separator
- zero or more characters separating the array elements.array
- array or object of a class which implements atoArray()
method.
-
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
- seetoTableRows(String, Object[])
-
toTableRows
public static String[] toTableRows(String separator, Object[] colArrays)
Formats a set of column arrays as a String array of the rows usingseparator
to separate the array elements of a row.- Parameters:
separator
- zero or more characters separating the array elements of a rowcolArrays
- 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 atoArray()
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 usingseparator
to separate the array elements of a row.- Parameters:
separator
- zero or more characters separating the array elements of a rowcolArrays
- array of column arrays of double
-
split
public static String[] split(String delimString, String text)
Splitstext
into parts delimited by the delimiter stringdelimString
. The parts are returned as array elements. The delimiter string is not included in the result. A pair of consecutive occurrences ofdelimString
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)
-
format
public static String format(Object o)
Formatso
for JXN-output. Ifo
is an array it is unrolled recursively.
-
format
public static String format(Object o, boolean recursive)
Formatso
for JXN-output.- Parameters:
recursive
- iftrue
ando
is an array it is unrolled recursively.
-
format
public static String format(double value, int nDec)
Formatsvalue
as String withnDec
decimals.
IfnDec <= 0
the sign ofvalue
is formatted as "+ value
" or "- value
".
-
whatIs
public static String whatIs(Object o)
Deprecated.replaced byJxnParameterCheck.whatIs(Object)
. Returns description of o as String.
-
toRawString
public static String toRawString(Object o)
Formatso
to the string which would be returned by thetoString()
method, if the same had not been overwriten for the class ofo
.- Returns:
KmgStaticUtilities.toRawString(java.lang.Object)
- See Also:
Object.toString()
-
toStringArray
public static String[] toStringArray(Collection c)
Formatsc
as aString
array.
-
print
public static String[] print(PrintStream ps, String[] lines)
Writeslines
line by line tops
.- Returns:
lines
(the argument passed to the method)
-
repeat
public static String repeat(String text, int n)
Returns a String which containstext
repeatedn
times.
-
squeeze
public static String squeeze(String text, char chRemove)
Removes all occurrences ofchRemove
fromtext
.
-
squeeze
public static String squeeze(String text, String removeChars)
Removes all occurrences of the characters contained inremoveChars
fromtext
.
-
group
public static String group(String text, int m)
Groupstext
into sections ofm
characters by inserting blanks.- Parameters:
m
- seegroup(java.lang.String, int, java.lang.String)
-
group
public static String group(String text, int m, String separator)
Groupstext
into sections ofm
characters by inserting the Stringseparator
.- 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)
Prefixestext
with'0'
so that the result contains at leastn
characters.
-
addLeadingBlanks
public static String addLeadingBlanks(String text, int n)
Prefixestext
with blanks so that the result contains at leastn
characters.
-
addLeadingChars
public static String addLeadingChars(String text, int n, char ch)
Prefixestext
withch
so that the result contains at leastn
characters.
-
addTrailingChars
public static String addTrailingChars(String text, int n, char ch)
Appendstext
withch
so that the result contains at leastn
characters.
-
getHeadTrail
public static String getHeadTrail(String delimString, int nHead, String separator, int nTrail, String text)
Extracts the firstnHead
and the lastnTrail
tokens delimited bydelimString
fromtext
. The removed tokens are replaced byseparator
. The delimiters are included in the result.
Example:getHeadTrail( "/", 3, "...", 2, "C:/Users/Default/AppData/Roaming/Microsoft/Windows/SendTo" )
returns:C:/Users/Default/.../Windows/SendTo
-
__4_hex_formatting
public void __4_hex_formatting()
Adds to hex formatting and parsing methods.- See Also:
Double.longBitsToDouble(long)
,Double.doubleToRawLongBits(double)
,Double.toHexString(double)
,Float.intBitsToFloat(int)
,Float.floatToRawIntBits(float)
,Float.toHexString(float)
,Long.parseUnsignedLong( String s, int radix )
,Long.toUnsignedString( long value, int radix )
,Long.toHexString(long)
,Integer.parseUnsignedInt( String s, int radix )
,Integer.toUnsignedString( int value, int radix )
,Integer.toHexString(int)
,java.math.BigInteger( String s, int radix )
-
hexStringToDouble
public static double hexStringToDouble(String hexString)
Parses hexString to double usingparseHex(String hexString)
andDouble.longBitsToDouble(long)
.- See Also:
Double.valueOf(java.lang.String)
-
hexStringToFloat
public static float hexStringToFloat(String hexString)
Parses hexString to float usingparseHex(String hexString)
andFloat.intBitsToFloat(int)
.- See Also:
Float.valueOf(java.lang.String)
-
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.
-
__5_ClassExplorer
public 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 withname
-
showClass
public static String showClass(Object o)
Deprecated.Use#edit
formatClass(o)
or Menu: View > Class...
-
showMethods
public static String showMethods(Object o)
Deprecated.Use#edit
formatMethods(o)
or Menu: View > Methods...
-
showMethods
public static String showMethods(Object o, String name)
Deprecated.Use#edit
formatMethods( o, name )
or Menu: View > Methods...
-
__6_extensions_to_Math
public void __6_extensions_to_Math()
Collection of methods adding tojava.lang.Math
.
-
sinD
public static double sinD(double a)
CallsMath.sin(double)
after converting argumenta
from degrees to radians.
-
cosD
public static double cosD(double a)
CallsMath.cos(double)
after converting argumenta
from degrees to radians.
-
tanD
public static double tanD(double a)
CallsMath.tan(double)
after converting argumenta
from degrees to radians.
-
asinD
public static double asinD(double a)
CallsMath.asin(double)
and converts the result from radians to degrees.
-
acosD
public static double acosD(double a)
CallsMath.acos(double)
and converts the result from radians to degrees.
-
atanD
public static double atanD(double a)
CallsMath.atan(double)
and converts the result from radians to degrees.
-
atan2D
public static double atan2D(double y, double x)
CallsMath.atan2(double, double)
and converts the result from radians to degrees.
-
asinh
public static double asinh(double x)
-
acosh
public static double acosh(double x)
-
atanh
public static double atanh(double x)
-
abs
public static double abs(double x, double y)
-
abs
public static double abs(double x, double y, double z)
Returnssqrt( x * x + y * y + z * z )
.
-
pqRoot
public static double pqRoot(double p, double q)
Returns solution ofx^2 + p x + q = 0
.- Returns:
- the bigger magnitude solution
x1
. Get the 2nd solution asx2 = q / x1
.
ReturnsDouble.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 ofx
.
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)
Preferx % y
ifx > 0
andy > 0
.
Example:x = { -200 : 200 } / 20 plot( x, x % 3, modulo( x, 3 ), 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, modulo( x, -3 ), 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
ifx < 0 exor y < 0
elsex % y
- See Also:
Math.IEEEremainder(double, double)
-
modulo
public static long modulo(long x, long y)
Preferx % y
ifx > 0
andy > 0
.- Returns:
x % y + y
ifx < 0 exor y < 0
elsex % y
-
modulo
public static int modulo(int x, int y)
Preferx % y
ifx > 0
andy > 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
ifx < 0 exor y < 0
elsex % y
-
log2
public static double log2(double x)
Returns the base 2 logarithm ofx
.
-
log
public static double log(double b, double x)
Returns the baseb
logarithm ofx
.
-
__7_setField
public 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).
-
set
public static Object set(Object o, String fieldName, Object value) throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException
Sets a public field specified byfieldName
of an object or a class to the givenvalue
.
set( o, "fieldName", value )
is used in JXN instead ofo.fieldName = value.
set( "ClassName", "fieldName", value )
is used instead ofClassName.fieldName = value
(static field).- Parameters:
o
- object for which the field is to be changed or in case of a static field the class object or the classname as StringfieldName
- name of the field to be changedvalue
- new value of the field- Returns:
- old value of the field
- Throws:
ClassNotFoundException
NoSuchFieldException
IllegalAccessException
-
set
public static Object set(Object o, String fieldName, double value) throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException
Sets a double field of an object or a class.
-
set
public static Object set(Object o, String fieldName, float value) throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException
Sets a float field of an object or a class.
-
set
public static Object set(Object o, String fieldName, long value) throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException
Sets a long field of an object or a class.
-
set
public static Object set(Object o, String fieldName, int value) throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException
Sets a int field of an object or a class.
-
set
public static Object set(Object o, String fieldName, short value) throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException
Sets a short field of an object or a class.
-
set
public static Object set(Object o, String fieldName, byte value) throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException
Sets a byte field of an object or a class.
-
set
public static Object set(Object o, String fieldName, boolean value) throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException
Sets a boolean field of an object or a class.
-
set
public static Object set(Object o, String fieldName, char value) throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException
Sets a char field of an object or a class.
-
__8_array_operations
public void __8_array_operations()
-
length
public static int length(Object array)
Returns the length of an array. Shortcut forjava.lang.reflect.
Array.getLength(java.lang.Object)
-
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.
-
set
public static Object set(Object[] array, int i, Object value)
Sets the value of thei
-th component ofarray
to the specified newvalue
.
In JXNset( array, i, value )
is used instead ofarray[i] = value
.
-
set
public static Object set(double[] array, int i, double value)
Shortcut forjava.lang.reflect.
Array.setDouble( Object array, int i, double value )
.
-
set
public static Object set(float[] array, int i, float value)
Shortcut forjava.lang.reflect.
Array.setFloat( Object array, int i, float value )
.
-
set
public static Object set(long[] array, int i, long value)
Shortcut forjava.lang.reflect.
Array.setLong( Object array, int i, long value )
.
-
set
public static Object set(int[] array, int i, int value)
Shortcut forjava.lang.reflect.
Array.setInt( Object array, int i, int value )
.
-
set
public static Object set(short[] array, int i, short value)
Shortcut forjava.lang.reflect.
Array.setShort( Object array, int i, short value )
.
-
set
public static Object set(byte[] array, int i, byte value)
Shortcut forjava.lang.reflect.
Array.setByte( Object array, int i, byte value )
.
-
set
public static Object set(boolean[] array, int i, boolean value)
Shortcut forjava.lang.reflect.
Array.setBoolean( Object array, int i, boolean value )
.
-
set
public static Object set(char[] array, int i, char value)
Shortcut forjava.lang.reflect.
Array.setChar( Object array, int i, char value )
.
-
find
public static int find(Object[] array, Object o)
Searcharray
foro
.- Returns:
- first index
i
wherearray[i].equals(o)
-
concat
public static Object concat(Object arr1, Object arr2)
Returns a new array containing the elements of arrayarr1
followed by the elements of arrayarr2
.
arr1
andarr2
may be primitive or object arrays but must be of compatible type.
Usesjava.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.
Usesjava.lang.System.
arraycopy
.
-
newArray
public static Object newArray(Class<?> componentType, int length)
Creates a new array with the specified component type and length.
Shortcut forjava.lang.reflect.Array.
newInstance
( componentType, length )
.
-
newArray
public static Object newArray(Class<?> componentType, int... dimensions)
Creates a new array with the specified component type and dimensions.
Shortcut forjava.lang.reflect.Array.
newInstance
( componentType, dimension... )
.
-
doubleArray
public static Object doubleArray(int length)
Creates a new double array with the specified length. In JXN usedoubleArray(length)
instead ofnew double[length]
.
Shortcut fornewArray
( Double.TYPE, length )
.
-
intArray
public static Object intArray(int length)
Creates a new int array with the specified length. In JXN useintArray(length)
instead ofnew int[length]
.
Shortcut fornewArray
( Integer.TYPE, length )
.
-
byteArray
public static Object byteArray(int length)
Creates a new byte array with the specified length. In JXN usebyteArray(length)
instead ofnew byte[length]
.
Shortcut fornewArray
( Byte.TYPE, length )
.
-
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 }
.
-
stringArray
public static String[] stringArray(String csvList)
Deprecated.In JXN prefer{ "abc", "xyz" }
.
-
stringArray
public static String[] stringArray(String csvList, String delimChars)
Returns array of tokens fromStringTokenizer.nextToken()
.- Parameters:
delimChars
- passed to ajava.util.
StringTokenizer
( csvList, delimChars )
- See Also:
split(java.lang.String, java.lang.String)
,KmgStringTokenizer
-
getClass
public static Class getClass(Object ao)
Deprecated.No more needed: Simply callao.getClass()
. To calljava.lang.Object.getClass()
on the array elements ofao
useJxnObject.getClassArray(ao)
.Returns the class of an objectao
(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 ofjava.lang.Object
especiallygetClass()
on an array object. In JXNao.getClass()
(other than in Java) returns ajava.lang.Class
[]
array containing the component types. As a workaround to get the class of an array objectgetClass(ao)
is used instead ofao.getClass()
.- Returns:
ao.getClass()
(java.lang.Object
)
-
hashCode
public static int hashCode(Object ao)
Deprecated.No more needed: Simply callao.hashCode()
. To calljava.lang.Object.hashCode()
on the array elements ofao
useJxnObject.hashCode( @JxnUnroll ao )
.Returns the hash code value ofao
(workaround for array objects in JXN). As described for thegetClass
method forao.hashCode()
in JXN in case of an arrayao
thehashCode
method is called on the array components ofao
rather than on the array object itself. As a workaroundhashCode(ao)
is used instead ofao.hashCode()
.- Returns:
ao.hashCode()
(java.lang.Object
)
-
equals
public static boolean equals(Object o1, Object o2)
Deprecated.No more needed: Simply callo1.equals(o2)
. To calljava.lang.Object.equals(Object)
on the array elements ofarr1
with argument arrayarr2
useJxnObject.equals( @JxnUnroll arr1, @JxnUnroll arr2 )
.Checks if two objects are equal(workaround for array objects in JXN). As described for the.getClass
method foro1.equals(o2)
in JXN in case of an arrayo1
theequals
method is called on the array components ofo1
rather than on the array object itself. As a workaroundequals(o1,o2)
is used instead ofo1.equals(o2)
to compare an array objecto1
to another objecto2
(for array objectsequals(o1,o2)
is true, ifo1 == o2
(both variableso1
ando2
refering to the same object))
-
__9_boolean_operators
public void __9_boolean_operators()
-
not
public static boolean not(boolean x)
Represents the Java boolean operator. For a booleanx
in JXN-x
can be used instead ofnot(x)
.- Returns:
- ! x
-
and
public static boolean and(boolean x, boolean y)
Represents the Java boolean operator. For booleansx
andy
in JXNx*y
can be used instead ofand(x,y)
.- Returns:
- x
&&
y
-
or
public static boolean or(boolean x, boolean y)
Represents the Java boolean operator. For booleansx
andy
in JXNx+y
can be used instead ofor(x,y)
.- Returns:
- x
||
y
-
exor
public static boolean exor(boolean x, boolean y)
Represents the Java boolean operator. For booleansx
andy
in JXNx^y
can be used instead ofexor(x,y)
.- Returns:
- x ^ y (using the Java boolean exor operator !!)
-
_10_bitwise_operators
public void _10_bitwise_operators()
-
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 representpow(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 representpow(x,y)
.- Returns:
- x ^ y (using the Java bitwise exor operator !!)
-
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
-
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
-
_11_relational_operators
public 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 theisNull(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 ofx
. Called in jxn files forisPrimitiveOrJavaWrapper(x)
ifx
is an object reference (except Java primitive wrapper). Also consider:JxnObject
.getClass(x).isPrimitive()
(returnsfalse
for Java primitive wrapper).- Returns:
- false
-
isPrimitiveOrJavaWrapper
public static boolean isPrimitiveOrJavaWrapper(double x)
Used in jxn files to check the type ofx
. Called in jxn files forisPrimitiveOrJavaWrapper(x)
ifx
is a primitive or Java primitive wrapper. Also consider:JxnObject
.getClass(x).isPrimitive()
(returnsfalse
for Java primitive wrapper).- Returns:
- true
-
_12_formula_switching
public void _12_formula_switching()
-
sw
public static int sw(int ivar, double slider_switch)
Returns ...- Returns:
- 1 if
ivar - 0.5 <= slider_switch < ivar + 0.5
0 else
-
sw
public static double sw(boolean b, double yTrue, double yFalse)
Returns ...- Returns:
yTrue
, ifb
is true
yFalse
else
-
sw
public static long sw(boolean b, long yTrue, long yFalse)
Returns ...- Returns:
yTrue
, ifb
is true
yFalse
else
-
sw
public static int sw(boolean b, int yTrue, int yFalse)
Returns ...- Returns:
yTrue
, ifb
is true
yFalse
else
-
sw
public static Object sw(boolean b, Object oTrue, Object oFalse)
Returns ...- Returns:
oTrue
, ifb
is true
oFalse
else
-
sw
public static double sw(double x, double yLT, double yGE)
Returns ...- Returns:
yLT
, ifx < 0.
yGE
else
-
sw
public static long sw(double x, long yLT, long yGE)
Returns ...- Returns:
yLT
, ifx < 0.
yGE
else
-
sw
public static int sw(double x, int yLT, int yGE)
Returns ...- Returns:
yLT
, ifx < 0.
yGE
else
-
sw
public static Object sw(double x, Object oLT, Object oGE)
Returns ...- Returns:
oLT
, ifx < 0
oGE
else
-
sw
public static double sw(double x, double yLT, double yEQ, double yGT)
Returns ...- Returns:
yLT
, ifx < 0.
yGT
, ifx > 0.
yEQ
else
-
sw
public static long sw(double x, long yLT, long yEQ, long yGT)
Returns ...- Returns:
yLT
, ifx < 0.
yGT
, ifx > 0.
yEQ
else
-
sw
public static int sw(double x, int yLT, int yEQ, int yGT)
Returns ...- Returns:
yLT
, ifx < 0.
yGT
, ifx > 0.
yEQ
else
-
sw
public static Object sw(double x, Object oLT, Object oEQ, Object oGT)
Returns ...- Returns:
oLT
, ifx < 0
oGT
, ifx > 0
oEQ
else
-
sw
public static double sw(double x, double xLower, double xUpper, double yLower, double yInner, double yUpper)
Returns ...- Returns:
yLower
, ifx < xLower
yUpper
, ifx > xUpper
yInner
else
-
sw
public static Object sw(double x, double xLower, double xUpper, Object oLower, Object oInner, Object oUpper)
Returns ...- Returns:
oLower
, ifx < xLower
oUpper
, ifx > xUpper
oInner
else
-
limit
public static double limit(double x, double xmin, double xmax)
Keepsx
withinxmin
andxmax
.- Returns:
xmin
, ifx < xmin
xmax
, ifx > xmax
x
else
-
limit
public static long limit(long x, long xmin, long xmax)
Keepsx
withinxmin
andxmax
.- Returns:
xmin
, ifx < xmin
xmax
, ifx > xmax
x
else
-
limit
public static int limit(int x, int xmin, int xmax)
Keepsx
withinxmin
andxmax
.- Returns:
xmin
, ifx < xmin
xmax
, ifx > xmax
x
else
-
clip
public static double clip(double x, double lower, double upper)
- 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)
-
-