Top Description Fields Constructors Methods
org.eclipse.swt.internal

public final Class Compatibility

extends Object
Class Inheritance
Imports
java.io.*, java.text.*, java.util.*, org.eclipse.swt.*

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 Note

some of the methods have been modified from their J2SE parents. Refer to the description of each method for specific changes.

Field Summary

Modifier and TypeField and Description
private static ResourceBundle

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static int

Returns:

the ceiling of the rational number p / q.
ceil
(int
numerator
p
,
int
denominator (must be different from zero)
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.

public static void
exec(String[]
array containing the program to execute and its arguments
prog
,
String[]
array of strings, each element of which has environment variable settings in the format name=value
envp
,
String
the working directory of the new process, or null if the new process should inherit the working directory of the caller
workingDir
)

Execute prog[0] in a separate platform process if the underlying platform supports this.

public static String

Returns:

the message for the given key
getMessage
(String
the key to look up
key
)

Returns the NLS'ed message for the given argument.

public static String
getMessage(String key, Object[] args)

public static int

Returns:

2 raised to the power of the argument
pow2
(int
an int value between 0 and 30 (inclusive)
n
)

Returns 2 raised to the power of the argument.

public static int

Returns:

the closest integer to the rational number p / q
round
(int
numerator
p
,
int
denominator (must be different from zero)
q
)

Answers the result of rounding to the closest integer the number obtained by dividing the first argument p by the second argument q.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

msgsback to summary
private static ResourceBundle msgs

Constructor Detail

Compatibilityback to summary
public Compatibility()

Method Detail

ceilback to summary
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:int

numerator

q:int

denominator (must be different from zero)

Returns:int

the ceiling of the rational number p / q.

execback to summary
public static void exec(String[] prog, String[] envp, String workingDir) throws IOException

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:String[]

array containing the program to execute and its arguments

envp:String[]

array of strings, each element of which has environment variable settings in the format name=value

workingDir:String

the working directory of the new process, or null if the new process should inherit the working directory of the caller

Exceptions
IOException:
if the program cannot be executed
SecurityException:
if the current SecurityManager disallows program execution
Since
3.6
getMessageback to summary
public static String getMessage(String key)

Returns the NLS'ed message for the given argument. This is only being called from SWT.

Parameters
key:String

the key to look up

Returns:String

the message for the given key

See Also
SWT#getMessage(String)
getMessageback to summary
public static String getMessage(String key, Object[] args)
pow2back to summary
public static int pow2(int n)

Returns 2 raised to the power of the argument.

Parameters
n:int

an int value between 0 and 30 (inclusive)

Returns:int

2 raised to the power of the argument

Exceptions
IllegalArgumentException:
  • ERROR_INVALID_RANGE - if the argument is not between 0 and 30 (inclusive)
roundback to summary
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 Note

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:int

numerator

q:int

denominator (must be different from zero)

Returns:int

the closest integer to the rational number p / q