com.bolour.sample.eclipse.service.exponentiation
Class Exponentiation
java.lang.Object
|
+--com.bolour.sample.eclipse.service.exponentiation.Exponentiation
- All Implemented Interfaces:
- org.eclipse.core.runtime.IExecutableExtension, IFunction
- public class Exponentiation
- extends java.lang.Object
- implements IFunction, org.eclipse.core.runtime.IExecutableExtension
Callback class for exponentiation functions.
This class provides a generic exponentiation function.
A particular instance of this class is parameterized by
a specific exponent to be used by that instance in
exponentiation. The exponent is provided to this instance
via an XML attribute called constant
in its extension
specification.
Because this class implementes the IExecutableExtension
interface, the standard callback creation method of Eclipse,
namely IConfigurationElement.createExecutableExtension
knows to initialize a created instance of the class by calling
the IExecutableExtension
method setInitializationData
.
This method extracts the value of the constant attribute
and initializes the instance with its integer value as the
exponent for later computations.
- Author:
- Azad
Method Summary |
long |
compute(long x)
Implementation of the exponentiation operation. |
void |
setInitializationData(org.eclipse.core.runtime.IConfigurationElement member,
java.lang.String propertyName,
java.lang.Object data)
Initialization method for instances of Exponentiation. |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Exponentiation
public Exponentiation()
compute
public long compute(long x)
- Implementation of the exponentiation operation.
- Specified by:
compute
in interface IFunction
- Following copied from interface:
com.bolour.sample.eclipse.service.ui.IFunction
- Parameters:
x
- A long integer input argument.- Returns:
- The result of the callback function.
- Throws:
java.lang.ArithmeticException
- In case of an error.
setInitializationData
public void setInitializationData(org.eclipse.core.runtime.IConfigurationElement member,
java.lang.String propertyName,
java.lang.Object data)
throws org.eclipse.core.runtime.CoreException
- Initialization method for instances of Exponentiation.
The exponent for this particular listener is provided in the
constant
XML attribute of its extension element.
Extract the exponent and remember it for use in later computations.
- Specified by:
setInitializationData
in interface org.eclipse.core.runtime.IExecutableExtension
- See Also:
IExecutableExtension.setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)