Package jme
Class JMEUtil
java.lang.Object
jme.JMEUtil
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDo nothing , support for JSME code splitting.static classstatic interfaceA callback meant to be used bystatic interface -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intReturn the JME atoming number associated to the given symbolstatic intcompareAngles(double sina, double cosa, double sinb, double cosb) static booleancontains(int[] array, int v) static double[]copyArray(double[] array) static int[]copyArray(int[] array) static int[]copyArray(int[] array, int n) static String[]static <T> T[]copyOf(T[] original, int newLength) Copies the specified array, truncating or padding with nulls (if necessary) so the copy has the specified length.static <T,U> T[] Copies the specified array, truncating or padding with nulls (if necessary) so the copy has the specified length.static int[]createArray(int size) static int[][]createArray(int size1, int size2) static boolean[]createBArray(int size) static double[]createDArray(int size) static long[]createLArray(int size) static String[]createSArray(int size) static doubledotProduct(double x1, double y1, double x2, double y2) static booleanequals(int[] a1, int[] a2) static Stringfformat(double number, int len, int dec) Truncate to dec digits after the decimal place and left-pad to length len.static StringfindLineSeparator(String molFile) static long[]generatePrimes(int n) static StringgetSDFDateLine(String version) See CTFile -- this line is NOT optional.static double[]growArray(double[] array, int newSize) static int[][]growArray(int[][] array, int newSize) static int[]growArray(int[] array, int newSize) static String[]static <T> T[]growArray(T[] array, int newSize) static Stringiformat(int number, int len) right-justify using spacesstatic int[]intersection(int[] array1, int[] array2) static booleanCheck if the applet is showing in highDPI or not.static StringnextData(StringTokenizer st, String separator) static StringrightJustify(String s1, String s2) static voidrunAsync(JMEUtil.RunAsyncCallback runAsyncCallback) static doublesquareEuclideanDist(double x1, double y1, double x2, double y2) static voidstereoTransformation(int[] t, int[] ref) static doubleProvide the ideal height of a string consisting of usual upper case characters.static <T> voidswap(T[] array, int i, int j) static doubletriangleHeight(double a, double b, double c) Compute the height of a triangle knowing the length of each side.
-
Field Details
-
ALIGN_LEFT
public static final int ALIGN_LEFT- See Also:
-
ALIGN_CENTER
public static final int ALIGN_CENTER- See Also:
-
ALIGN_RIGHT
public static final int ALIGN_RIGHT- See Also:
-
-
Constructor Details
-
JMEUtil
public JMEUtil()
-
-
Method Details
-
growArray
public static int[] growArray(int[] array, int newSize) -
copyArray
public static int[] copyArray(int[] array) -
growArray
public static <T> T[] growArray(T[] array, int newSize) -
copyOf
public static <T> T[] copyOf(T[] original, int newLength) Copies the specified array, truncating or padding with nulls (if necessary) so the copy has the specified length. For all indices that are valid in both the original array and the copy, the two arrays will contain identical values. For any indices that are valid in the copy but not the original, the copy will contain null. Such indices will exist if and only if the specified length is greater than that of the original array. The resulting array is of exactly the same class as the original array.- Type Parameters:
T- the class of the objects in the array- Parameters:
original- the array to be copiednewLength- the length of the copy to be returned- Returns:
- a copy of the original array, truncated or padded with nulls to obtain the specified length
- Throws:
NegativeArraySizeException- if newLength is negativeNullPointerException- if original is null- Since:
- 1.6
-
copyOf
Copies the specified array, truncating or padding with nulls (if necessary) so the copy has the specified length. For all indices that are valid in both the original array and the copy, the two arrays will contain identical values. For any indices that are valid in the copy but not the original, the copy will contain null. Such indices will exist if and only if the specified length is greater than that of the original array. The resulting array is of the class newType.- Type Parameters:
T- the class of the objects in the returned arrayU- the class of the objects in the original array- Parameters:
original- the array to be copiednewLength- the length of the copy to be returnednewType- the class of the copy to be returned- Returns:
- a copy of the original array, truncated or padded with nulls to obtain the specified length
- Throws:
NegativeArraySizeException- if newLength is negativeNullPointerException- if original is nullArrayStoreException- if an element copied from original is not of a runtime type that can be stored in an array of class newType- Since:
- 1.6
-
growArray
-
growArray
public static double[] growArray(double[] array, int newSize) -
growArray
public static int[][] growArray(int[][] array, int newSize) -
equals
public static boolean equals(int[] a1, int[] a2) -
intersection
public static int[] intersection(int[] array1, int[] array2) -
contains
public static boolean contains(int[] array, int v) -
swap
public static <T> void swap(T[] array, int i, int j) -
copyArray
public static int[] copyArray(int[] array, int n) -
copyArray
-
copyArray
public static double[] copyArray(double[] array) -
createArray
public static int[] createArray(int size) -
createSArray
-
createDArray
public static double[] createDArray(int size) -
createLArray
public static long[] createLArray(int size) -
createBArray
public static boolean[] createBArray(int size) -
createArray
public static int[][] createArray(int size1, int size2) -
isHighDPI
public static boolean isHighDPI()Check if the applet is showing in highDPI or not. In a web browser, this can change with the zoom factor, thus this function should be called before each drawing- Returns:
-
runAsync
-
generatePrimes
public static long[] generatePrimes(int n) -
nextData
-
findLineSeparator
-
squareEuclideanDist
public static double squareEuclideanDist(double x1, double y1, double x2, double y2) -
dotProduct
public static double dotProduct(double x1, double y1, double x2, double y2) -
triangleHeight
public static double triangleHeight(double a, double b, double c) Compute the height of a triangle knowing the length of each side. Use Heron's formula.- Parameters:
a-b- -base of the trianglec-- Returns:
- height
-
compareAngles
public static int compareAngles(double sina, double cosa, double sinb, double cosb) -
stereoTransformation
public static void stereoTransformation(int[] t, int[] ref) -
checkAtomicSymbol
Return the JME atoming number associated to the given symbol- Parameters:
s-- Returns:
- zLabel index for this symbol
-
getSDFDateLine
See CTFile -- this line is NOT optional. It is critical in showing whether we have a 2D or 3D MOL file.- Parameters:
version-- Returns:
- SDF header line 2 with no \n
-
iformat
right-justify using spaces- Parameters:
number- with no more than len digitslen- max 8- Returns:
- right-justified number or ?
-
rightJustify
-
fformat
Truncate to dec digits after the decimal place and left-pad to length len.- Parameters:
number-len- guaranteed length of string to returndec- the number of decimal places or 0 for integer rounding down- Returns:
- the formatted number or right-justified "?"
-
stringHeight
Provide the ideal height of a string consisting of usual upper case characters. Purpose: centering of String in the center of a box. Does not work for $ , y ; and others- Parameters:
fm-- Returns:
-