Back to project page asecrypto-goes-mobile-app.
The source code is released under:
GNU General Public License
If you think the Android project asecrypto-goes-mobile-app listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package at.fhj.gaar.asecrypto.mobile.ui.apptasks.bezout; /*from ww w . j a v a 2 s . co m*/ import android.os.AsyncTask; import at.fhj.gaar.asecrypto.mobile.crypto.AseInteger; import at.fhj.gaar.asecrypto.mobile.ui.TaskFinishedCallable; import at.fhj.gaar.asecrypto.mobile.util.StopWatch; public class BezoutIterativeTask extends AsyncTask<AseInteger, Void, BezoutResult> { private final TaskFinishedCallable<BezoutResult> callable; public BezoutIterativeTask(TaskFinishedCallable<BezoutResult> callable) { this.callable = callable; } @Override protected BezoutResult doInBackground(AseInteger... numbers) { if (numbers.length != 2) { throw new RuntimeException("supply exact two AseIntegers to calculate the Bezout"); } AseInteger firstNumber = numbers[0]; AseInteger secondNumber = numbers[1]; AseInteger[] result; StopWatch watch = new StopWatch(); watch.start(); result = firstNumber.getBezout(secondNumber); watch.stop(); return new BezoutResult(watch.getElapsedTime(), result[0], result[1], result[2]); } @Override protected void onPostExecute(BezoutResult bezoutResult) { super.onPostExecute(bezoutResult); this.callable.onAsyncTaskFinished(this, bezoutResult); } }