com.bolour.sample.eclipse.service.multiplication
Class Multiplication
java.lang.Object
|
+--com.bolour.sample.eclipse.service.multiplication.Multiplication
- All Implemented Interfaces:
- org.eclipse.core.runtime.IExecutableExtension, IFunction
- public class Multiplication
- extends java.lang.Object
- implements IFunction, org.eclipse.core.runtime.IExecutableExtension
Callback class for the multiplication function.
This class provides a generic multiplication function.
A particular instance of this class is parameterized by
a specific factor to be used in multiplications.
The factor is provided to this instance via a custom XML attribute called
constant in its extension specification.
Because this class implements 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 factor
for later multiplications.
- Author:
- Azad
Method Summary |
long |
compute(long x)
Implementation of the multiplication function. |
void |
setInitializationData(org.eclipse.core.runtime.IConfigurationElement member,
java.lang.String propertyName,
java.lang.Object data)
Initialization method for instances of MultiplicationService. |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Multiplication
public Multiplication()
compute
public long compute(long x)
- Implementation of the multiplication function.
- 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 MultiplicationService.
The multiplication factor for this particular listener is a custom XML attribute of its extension element.
Extract the power and remember it for use in this operation.
- 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)