Package org.eclipse.swt.internal
Class Compatibility
java.lang.Object
org.eclipse.swt.internal.Compatibility
This class is a placeholder for utility methods commonly
used on J2SE platforms but not supported on some J2ME
profiles.
It is part of our effort to provide support for both J2SE and J2ME platforms.
IMPORTANT: some of the methods have been modified from their J2SE parents. Refer to the description of each method for specific changes.
 Exceptions thrown may differ since J2ME's set of exceptions is a subset of J2SE's one.
 The range of the mathematic functions is subject to change.

Constructor Summary

Method Summary
Modifier and TypeMethodDescriptionstatic int
ceil
(int p, int q) Answers the most negative (i.e. closest to negative infinity) integer value which is greater than or equal to the number obtained by dividing the first argument p by the second argument q.static void
Execute prog[0] in a separate platform process if the underlying platform supports this.static String
getMessage
(String key) Returns the NLS'ed message for the given argument.static String
getMessage
(String key, Object[] args) static int
pow2
(int n) Returns 2 raised to the power of the argument.static int
round
(int p, int q) Answers the result of rounding to the closest integer the number obtained by dividing the first argument p by the second argument q.

Constructor Details

Compatibility
public Compatibility()


Method Details

ceil
public static int ceil(int p, int q) Answers the most negative (i.e. closest to negative infinity) integer value which is greater than or equal to the number obtained by dividing the first argument p by the second argument q. Parameters:
p
 numeratorq
 denominator (must be different from zero) Returns:
 the ceiling of the rational number p / q.

round
public static int round(int p, int q) Answers the result of rounding to the closest integer the number obtained by dividing the first argument p by the second argument q.IMPORTANT: the j2me version has an additional restriction on the arguments. p must be within the range 0  32767 (inclusive). q must be within the range 1  32767 (inclusive).
 Parameters:
p
 numeratorq
 denominator (must be different from zero) Returns:
 the closest integer to the rational number p / q

pow2
public static int pow2(int n) Returns 2 raised to the power of the argument. Parameters:
n
 an int value between 0 and 30 (inclusive) Returns:
 2 raised to the power of the argument
 Throws:
IllegalArgumentException
 ERROR_INVALID_RANGE  if the argument is not between 0 and 30 (inclusive)

exec
Execute prog[0] in a separate platform process if the underlying platform supports this.The new process inherits the environment of the caller.
 Parameters:
prog
 array containing the program to execute and its argumentsenvp
 array of strings, each element of which has environment variable settings in the format name=valueworkingDir
 the working directory of the new process, or null if the new process should inherit the working directory of the caller Throws:
IOException
 if the program cannot be executedSecurityException
 if the current SecurityManager disallows program execution Since:
 3.6

getMessage
Returns the NLS'ed message for the given argument. This is only being called from SWT. Parameters:
key
 the key to look up Returns:
 the message for the given key
 See Also:

getMessage
