public class HeavyCalculations
extends java.lang.Object
| Constructor and Description | 
|---|
HeavyCalculations(int numberOfThreads)
Constructor for HeavyCalculations 
 | 
| Modifier and Type | Method and Description | 
|---|---|
java.util.concurrent.Future<ICalculations> | 
addCalculation(java.lang.Class calculationClass,
              java.lang.String methodToCalculate,
              java.lang.Object... params)
Adds a calculation to the queues by wrapping a class to implement  
ICalculations, used for static methods
 when the class can't be instantiated
 This method is discouraged! It is meant for objects where it isn't possible to implement ICalculations | 
<T> java.util.concurrent.Future<T> | 
addCalculation(T calculation)
Adds a calculation to the queues 
 | 
<T> java.util.concurrent.Future<T> | 
addCalculation(T calculation,
              java.lang.String methodToCalculate,
              java.lang.Object... params)
Adds a calculation to the queues by wrapping an object to implement  
ICalculations
 This method is discouraged! It is meant for objects where it isn't possible to implement ICalculations | 
boolean | 
isDead()
Use this to check if you could add calculations 
 | 
void | 
kill()
Stops further calculations from occurring
 You can no longer add calculations after this! 
 | 
public HeavyCalculations(int numberOfThreads)
numberOfThreads - The number of threads to delegate calculations topublic <T> java.util.concurrent.Future<T> addCalculation(T calculation)
calculation - The calculation it MUST implement ICalculationsFuture.get() returns the object passed, 
 although after the calculations finishedpublic <T> java.util.concurrent.Future<T> addCalculation(T calculation,
                                                java.lang.String methodToCalculate,
                                                java.lang.Object... params)
ICalculations
 This method is discouraged! It is meant for objects where it isn't possible to implement ICalculationscalculation - The object representing the calculationsmethodToCalculate - The method to call for calculationsparams - The parameters for the methodFuture.get() returns the object passed, 
 although after the calculations finishedpublic java.util.concurrent.Future<ICalculations> addCalculation(java.lang.Class calculationClass, java.lang.String methodToCalculate, java.lang.Object... params)
ICalculations, used for static methods
 when the class can't be instantiated
 This method is discouraged! It is meant for objects where it isn't possible to implement ICalculationscalculationClass - The class representing the calculationsmethodToCalculate - The method to call for calculationsparams - The parameters for the methodFuture.get() returns nullpublic void kill()
public boolean isDead()