From 4658f42a8ae958af5e8efe6af032a3e204f0782f Mon Sep 17 00:00:00 2001 From: Sergey Solovyev Date: Sat, 15 Jun 2013 23:10:45 +0400 Subject: [PATCH] fixes + @NotNull -> @Nonnull --- android-app-core/AndroidManifest.xml | 8 +- .../AndroidCalculatorDisplayView.java | 22 +- .../AndroidCalculatorEditorView.java | 84 +++--- .../android/calculator/CalculatorButton.java | 20 +- .../android/calculator/CalculatorButtons.java | 72 ++--- .../calculator/CalculatorDisplayMenuItem.java | 32 +-- .../CalculatorDisplayOnClickListener.java | 6 +- .../calculator/CalculatorPreferences.java | 24 +- .../calculator/ConversionMenuItem.java | 10 +- .../calculator/DigitButtonDragProcessor.java | 8 +- .../android/calculator/FixableMessage.java | 26 +- .../calculator/FixableMessagesDialog.java | 42 +-- .../ParcelableCalculatorDisplayViewState.java | 20 +- .../ParcelableCalculatorEditorViewState.java | 16 +- .../calculator/ParcelableDialogData.java | 24 +- .../AndroidExternalListenersContainer.java | 30 +- ...efaultExternalCalculatorIntentHandler.java | 22 +- .../ExternalCalculatorIntentHandler.java | 4 +- .../ExternalCalculatorStateUpdater.java | 8 +- .../model/AndroidCalculatorEngine.java | 56 ++-- .../model/AndroidMathEntityDao.java | 14 +- .../plot/AndroidCalculatorPlotter.java | 58 ++-- .../calculator/plot/AndroidPlotLineStyle.java | 20 +- .../calculator/view/AngleUnitsButton.java | 10 +- .../view/NumeralBaseConverterDialog.java | 8 +- .../calculator/view/NumeralBasesButton.java | 10 +- .../calculator/view/TextHighlighter.java | 18 +- .../view/UnitConverterViewBuilder.java | 52 ++-- android-app-onscreen/AndroidManifest.xml | 8 +- .../CalculatorOnscreenBroadcastReceiver.java | 6 +- .../onscreen/CalculatorOnscreenService.java | 26 +- .../CalculatorOnscreenStartActivity.java | 4 +- .../onscreen/CalculatorOnscreenView.java | 48 ++-- .../onscreen/CalculatorOnscreenViewState.java | 22 +- android-app-widget/AndroidManifest.xml | 8 +- .../AbstractCalculatorWidgetProvider.java | 39 +-- .../widget/CalculatorWidgetIntentHandler.java | 6 +- android-app/AndroidManifest.xml | 263 ++++++------------ android-app/pom.xml | 7 +- .../calculator/AbstractCalculatorHelper.java | 42 +-- .../android/calculator/AndroidCalculator.java | 70 ++--- .../AndroidCalculatorClipboard.java | 10 +- .../calculator/AndroidCalculatorKeyboard.java | 12 +- .../calculator/AndroidCalculatorLogger.java | 14 +- .../calculator/AndroidCalculatorNotifier.java | 22 +- .../AndroidCalculatorPreferenceService.java | 12 +- .../calculator/AndroidFunctionCategory.java | 6 +- .../calculator/AndroidNumeralBase.java | 30 +- .../calculator/AndroidOperatorCategory.java | 6 +- .../calculator/AndroidVarCategory.java | 6 +- .../calculator/CalculatorActivity.java | 48 ++-- .../calculator/CalculatorActivityHelper.java | 50 ++-- .../CalculatorActivityHelperImpl.java | 56 ++-- .../CalculatorActivityLauncher.java | 46 +-- .../calculator/CalculatorActivityMobile.java | 2 +- .../calculator/CalculatorApplication.java | 26 +- .../calculator/CalculatorDialogActivity.java | 12 +- .../calculator/CalculatorDisplayFragment.java | 4 +- .../calculator/CalculatorEditorFragment.java | 6 +- .../calculator/CalculatorFragment.java | 8 +- .../CalculatorFragmentActivity.java | 6 +- .../calculator/CalculatorFragmentHelper.java | 22 +- .../CalculatorFragmentHelperImpl.java | 22 +- .../calculator/CalculatorFragmentType.java | 14 +- .../CalculatorKeyboardFragment.java | 14 +- .../calculator/CalculatorListFragment.java | 8 +- .../android/calculator/CalculatorMenu.java | 20 +- .../calculator/CalculatorSecurity.java | 4 +- .../calculator/CharacterAtPositionFinder.java | 8 +- .../calculator/CursorDragProcessor.java | 4 +- .../calculator/EqualsDragProcessor.java | 4 +- .../calculator/NumeralBaseButtons.java | 6 +- .../about/CalculatorAboutActivity.java | 2 +- .../about/CalculatorReleaseNotesFragment.java | 10 +- .../android/calculator/about/TextHelper.java | 12 +- .../function/FunctionEditDialogFragment.java | 42 +-- .../function/FunctionEditorSaver.java | 26 +- .../function/FunctionParamsView.java | 28 +- .../help/CalculatorHelpActivity.java | 2 +- .../AbstractCalculatorHistoryFragment.java | 38 +-- .../history/AndroidCalculatorHistory.java | 30 +- .../history/CalculatorHistoryActivity.java | 8 +- .../history/CalculatorHistoryFragment.java | 4 +- .../CalculatorSavedHistoryFragment.java | 4 +- .../history/HistoryArrayAdapter.java | 4 +- .../history/HistoryItemMenuData.java | 12 +- .../history/HistoryItemMenuItem.java | 20 +- .../history/TextViewEditorAdapter.java | 8 +- .../edit/AbstractMathEntityListFragment.java | 64 ++--- .../edit/CalculatorFunctionsActivity.java | 8 +- .../edit/CalculatorFunctionsFragment.java | 34 +-- .../edit/CalculatorOperatorsActivity.java | 8 +- .../edit/CalculatorOperatorsFragment.java | 22 +- .../math/edit/CalculatorVarsActivity.java | 8 +- .../math/edit/CalculatorVarsFragment.java | 40 +-- .../math/edit/MathEntityRemover.java | 36 +-- .../math/edit/VarEditDialogFragment.java | 24 +- .../calculator/math/edit/VarEditorSaver.java | 20 +- .../matrix/CalculatorMatrixEditFragment.java | 22 +- .../android/calculator/matrix/MatrixView.java | 18 +- .../plot/AbstractCalculatorPlotFragment.java | 61 ++-- .../plot/AbstractGraphCalculator.java | 22 +- .../plot/CalculatorGraph2dView.java | 46 +-- .../plot/CalculatorGraph3dView.java | 16 +- .../plot/CalculatorPlotActivity.java | 6 +- .../plot/CalculatorPlotFragment.java | 10 +- ...alculatorPlotFunctionSettingsActivity.java | 8 +- .../plot/CalculatorPlotFunctionsActivity.java | 2 +- .../plot/CalculatorPlotRangeActivity.java | 6 +- .../android/calculator/plot/GLView.java | 16 +- .../calculator/plot/Graph2dDimensions.java | 12 +- .../android/calculator/plot/Graph3d.java | 6 +- .../calculator/plot/GraphCalculator.java | 10 +- .../calculator/plot/GraphCalculatorImpl.java | 8 +- .../android/calculator/plot/GraphData.java | 6 +- .../android/calculator/plot/GraphView.java | 10 +- .../calculator/plot/GraphViewHelper.java | 22 +- .../android/calculator/plot/GraphsData.java | 12 +- .../calculator/plot/PlotFunctionListItem.java | 24 +- .../android/calculator/plot/PlotViewDef.java | 6 +- .../android/calculator/plot/TouchHandler.java | 10 +- .../CalculatorPreferencesActivity.java | 14 +- .../CalculatorPurchaseDialogActivity.java | 6 +- .../view/CalculatorAdditionalTitle.java | 6 +- .../view/OnDragListenerVibrator.java | 12 +- .../android/fragments/FragmentUtils.java | 28 +- .../android/AndroidNumeralBaseTest.java | 8 +- .../calculator/CalculatorTestUtils.java | 9 +- .../calculator/CalculatorppTestRunner.java | 15 +- core/pom.xml | 4 +- .../solovyev/acraanalyzer/AcraAnalyzer.java | 22 +- .../AbstractCalculatorMathRegistry.java | 44 +-- .../calculator/AbstractFixableError.java | 2 +- .../calculator/AbstractNumberBuilder.java | 20 +- .../android/calculator/Calculator.java | 42 +-- .../calculator/CalculatorClipboard.java | 8 +- .../CalculatorConversionEventData.java | 10 +- .../CalculatorConversionEventDataImpl.java | 40 +-- .../android/calculator/CalculatorDisplay.java | 10 +- .../CalculatorDisplayChangeEventDataImpl.java | 12 +- .../calculator/CalculatorDisplayImpl.java | 42 +-- .../calculator/CalculatorDisplayView.java | 6 +- .../CalculatorDisplayViewState.java | 8 +- .../CalculatorDisplayViewStateImpl.java | 24 +- .../android/calculator/CalculatorEditor.java | 42 +-- .../CalculatorEditorChangeEventDataImpl.java | 14 +- .../calculator/CalculatorEditorImpl.java | 68 ++--- .../calculator/CalculatorEditorView.java | 4 +- .../calculator/CalculatorEditorViewState.java | 4 +- .../CalculatorEditorViewStateImpl.java | 18 +- .../android/calculator/CalculatorEngine.java | 36 +-- .../calculator/CalculatorEngineImpl.java | 92 +++--- .../calculator/CalculatorEvalException.java | 22 +- .../CalculatorEvaluationEventData.java | 6 +- .../CalculatorEvaluationEventDataImpl.java | 26 +- .../calculator/CalculatorEventContainer.java | 24 +- .../calculator/CalculatorEventData.java | 12 +- .../calculator/CalculatorEventDataImpl.java | 24 +- .../calculator/CalculatorEventHolder.java | 22 +- .../calculator/CalculatorEventListener.java | 6 +- .../calculator/CalculatorEventType.java | 40 +-- .../android/calculator/CalculatorFailure.java | 6 +- .../calculator/CalculatorFailureImpl.java | 8 +- .../calculator/CalculatorFixableError.java | 8 +- .../CalculatorFunctionsMathRegistry.java | 32 +-- .../android/calculator/CalculatorImpl.java | 132 ++++----- .../android/calculator/CalculatorInput.java | 6 +- .../calculator/CalculatorInputImpl.java | 12 +- .../calculator/CalculatorKeyboard.java | 2 +- .../calculator/CalculatorKeyboardImpl.java | 10 +- .../android/calculator/CalculatorLocator.java | 46 +-- .../android/calculator/CalculatorLogger.java | 10 +- .../calculator/CalculatorMathEngine.java | 26 +- .../calculator/CalculatorMathRegistry.java | 8 +- .../android/calculator/CalculatorMessage.java | 22 +- .../calculator/CalculatorMessages.java | 21 +- .../calculator/CalculatorNotifier.java | 12 +- .../CalculatorOperatorsMathRegistry.java | 22 +- .../android/calculator/CalculatorOutput.java | 8 +- .../calculator/CalculatorOutputImpl.java | 28 +- .../calculator/CalculatorParseException.java | 32 +-- .../CalculatorPostfixFunctionsRegistry.java | 22 +- .../CalculatorPreferenceService.java | 6 +- .../calculator/CalculatorSpecialButton.java | 54 ++-- .../android/calculator/CalculatorUtils.java | 8 +- .../calculator/CalculatorVarsRegistry.java | 36 +-- .../solovyev/android/calculator/Change.java | 6 +- .../android/calculator/ChangeImpl.java | 14 +- .../android/calculator/ConversionFailure.java | 4 +- .../calculator/ConversionFailureImpl.java | 8 +- .../android/calculator/DialogData.java | 8 +- .../calculator/DummyCalculatorClipboard.java | 6 +- .../calculator/DummyCalculatorNotifier.java | 12 +- .../solovyev/android/calculator/Editor.java | 2 +- .../android/calculator/FixableError.java | 2 +- .../android/calculator/FunctionCategory.java | 16 +- .../ListCalculatorEventContainer.java | 16 +- .../android/calculator/LiteNumberBuilder.java | 6 +- .../solovyev/android/calculator/Locator.java | 75 ++--- .../android/calculator/MathEntityDao.java | 8 +- .../calculator/MathPersistenceEntity.java | 4 +- .../android/calculator/MessageDialogData.java | 16 +- .../android/calculator/NumberBuilder.java | 26 +- .../android/calculator/OperatorCategory.java | 14 +- .../calculator/PreparedExpression.java | 12 +- .../android/calculator/StringDialogData.java | 18 +- .../calculator/SystemOutCalculatorLogger.java | 12 +- .../calculator/ToJsclTextProcessor.java | 22 +- .../android/calculator/VarCategory.java | 10 +- .../CalculatorExternalListenersContainer.java | 6 +- .../function/FunctionBuilderAdapter.java | 18 +- .../history/AbstractHistoryState.java | 2 +- .../CalculatorDisplayHistoryState.java | 18 +- .../calculator/history/CalculatorHistory.java | 16 +- .../history/CalculatorHistoryImpl.java | 38 +-- .../history/CalculatorHistoryState.java | 32 +-- .../history/EditorHistoryState.java | 14 +- .../calculator/history/HistoryUtils.java | 10 +- .../jscl/FromJsclNumericTextProcessor.java | 6 +- .../calculator/jscl/JsclOperation.java | 12 +- .../android/calculator/math/MathType.java | 102 +++---- .../android/calculator/model/AFunction.java | 78 +++--- .../calculator/model/MathEntityBuilder.java | 12 +- .../android/calculator/model/Var.java | 40 +-- .../calculator/plot/CalculatorPlotter.java | 52 ++-- .../plot/CalculatorPlotterImpl.java | 70 ++--- .../plot/MapPlotResourceManager.java | 16 +- .../calculator/plot/PlotBoundaries.java | 8 +- .../android/calculator/plot/PlotData.java | 14 +- .../android/calculator/plot/PlotFunction.java | 46 +-- .../calculator/plot/PlotLineColor.java | 4 +- .../android/calculator/plot/PlotLineDef.java | 48 ++-- .../calculator/plot/PlotResourceManager.java | 8 +- .../android/calculator/plot/PlotUtils.java | 20 +- .../android/calculator/plot/XyFunction.java | 28 +- .../calculator/text/DummyTextProcessor.java | 6 +- .../text/FromJsclSimplifyTextProcessor.java | 12 +- .../calculator/text/TextProcessor.java | 6 +- .../units/CalculatorNumeralBase.java | 28 +- .../calculator/CalculatorEditorImplTest.java | 4 +- .../calculator/CalculatorTestUtils.java | 22 +- .../history/CalculatorHistoryImplTest.java | 4 +- .../calculator/model/FunctionsTest.java | 12 +- .../calculator/model/NumeralBaseTest.java | 20 +- pom.xml | 12 +- 245 files changed, 2592 insertions(+), 2652 deletions(-) diff --git a/android-app-core/AndroidManifest.xml b/android-app-core/AndroidManifest.xml index cfe0783d..a86dbd76 100644 --- a/android-app-core/AndroidManifest.xml +++ b/android-app-core/AndroidManifest.xml @@ -2,4 +2,10 @@ \ No newline at end of file + android:versionName="1.0" > + + + + \ No newline at end of file diff --git a/android-app-core/src/main/java/org/solovyev/android/calculator/AndroidCalculatorDisplayView.java b/android-app-core/src/main/java/org/solovyev/android/calculator/AndroidCalculatorDisplayView.java index 3ef2c083..e2b34a16 100644 --- a/android-app-core/src/main/java/org/solovyev/android/calculator/AndroidCalculatorDisplayView.java +++ b/android-app-core/src/main/java/org/solovyev/android/calculator/AndroidCalculatorDisplayView.java @@ -14,13 +14,13 @@ import android.support.v4.app.FragmentActivity; import android.text.Html; import android.util.AttributeSet; import android.util.TypedValue; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import org.solovyev.android.calculator.core.R; import org.solovyev.android.calculator.text.TextProcessor; import org.solovyev.android.calculator.view.TextHighlighter; import org.solovyev.android.view.AutoResizeTextView; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -39,7 +39,7 @@ public class AndroidCalculatorDisplayView extends AutoResizeTextView implements ********************************************************************** */ - @NotNull + @Nonnull private final static TextProcessor textHighlighter = new TextHighlighter(Color.WHITE, false); /* @@ -50,18 +50,18 @@ public class AndroidCalculatorDisplayView extends AutoResizeTextView implements ********************************************************************** */ - @NotNull + @Nonnull private volatile CalculatorDisplayViewState state = CalculatorDisplayViewStateImpl.newDefaultInstance(); private volatile boolean viewStateChange = false; - @NotNull + @Nonnull private final Object lock = new Object(); - @NotNull + @Nonnull private final Handler uiHandler = new Handler(); - @NotNull + @Nonnull private final ExecutorService bgExecutor = Executors.newSingleThreadExecutor(); private volatile boolean initialized = false; @@ -97,7 +97,7 @@ public class AndroidCalculatorDisplayView extends AutoResizeTextView implements @Override - public void setState(@NotNull final CalculatorDisplayViewState state) { + public void setState(@Nonnull final CalculatorDisplayViewState state) { uiHandler.post(new Runnable() { @Override @@ -133,7 +133,7 @@ public class AndroidCalculatorDisplayView extends AutoResizeTextView implements }); } - @NotNull + @Nonnull @Override public CalculatorDisplayViewState getState() { synchronized (lock) { @@ -170,11 +170,11 @@ public class AndroidCalculatorDisplayView extends AutoResizeTextView implements resizeText(); } - public synchronized void init(@NotNull Context context) { + public synchronized void init(@Nonnull Context context) { this.init(context, true); } - public synchronized void init(@NotNull Context context, boolean fromApp) { + public synchronized void init(@Nonnull Context context, boolean fromApp) { if (!initialized) { if (fromApp) { final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); diff --git a/android-app-core/src/main/java/org/solovyev/android/calculator/AndroidCalculatorEditorView.java b/android-app-core/src/main/java/org/solovyev/android/calculator/AndroidCalculatorEditorView.java index a8a5fb47..9ddec3e8 100644 --- a/android-app-core/src/main/java/org/solovyev/android/calculator/AndroidCalculatorEditorView.java +++ b/android-app-core/src/main/java/org/solovyev/android/calculator/AndroidCalculatorEditorView.java @@ -18,13 +18,14 @@ import android.util.AttributeSet; import android.util.Log; import android.view.ContextMenu; import android.widget.EditText; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import org.solovyev.android.calculator.text.TextProcessor; import org.solovyev.android.calculator.view.TextHighlighter; import org.solovyev.android.prefs.BooleanPreference; import org.solovyev.common.collections.Collections; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + /** * User: serso * Date: 9/17/11 @@ -32,25 +33,26 @@ import org.solovyev.common.collections.Collections; */ public class AndroidCalculatorEditorView extends EditText implements SharedPreferences.OnSharedPreferenceChangeListener, CalculatorEditorView { - @NotNull + @Nonnull private static final BooleanPreference colorDisplay = BooleanPreference.of("org.solovyev.android.calculator.CalculatorModel_color_display", true); private volatile boolean initialized = false; private boolean highlightText = true; - @NotNull + @Nonnull private final static TextProcessor textHighlighter = new TextHighlighter(Color.WHITE, false); - @NotNull + @SuppressWarnings("UnusedDeclaration") + @Nonnull private volatile CalculatorEditorViewState viewState = CalculatorEditorViewStateImpl.newDefaultInstance(); private volatile boolean viewStateChange = false; - @Nullable + @Nonnull private final Object viewLock = new Object(); - @NotNull + @Nonnull private final Handler uiHandler = new Handler(); public AndroidCalculatorEditorView(Context context) { @@ -97,7 +99,7 @@ public class AndroidCalculatorEditorView extends EditText implements SharedPrefe } @Nullable - private CharSequence prepareText(@NotNull String text, boolean highlightText) { + private CharSequence prepareText(@Nonnull String text, boolean highlightText) { CharSequence result; if (highlightText) { @@ -137,7 +139,7 @@ public class AndroidCalculatorEditorView extends EditText implements SharedPrefe } } - public synchronized void init(@NotNull Context context) { + public synchronized void init(@Nonnull Context context) { if (!initialized) { final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); @@ -152,57 +154,51 @@ public class AndroidCalculatorEditorView extends EditText implements SharedPrefe } @Override - public void setState(@NotNull final CalculatorEditorViewState viewState) { - if (viewLock != null) { - synchronized (viewLock) { + public void setState(@Nonnull final CalculatorEditorViewState viewState) { + synchronized (viewLock) { - final CharSequence text = prepareText(viewState.getText(), highlightText); + final CharSequence text = prepareText(viewState.getText(), highlightText); - uiHandler.post(new Runnable() { - @Override - public void run() { - final AndroidCalculatorEditorView editorView = AndroidCalculatorEditorView.this; - synchronized (viewLock) { - try { - editorView.viewStateChange = true; - editorView.viewState = viewState; - editorView.setText(text, BufferType.EDITABLE); - final int selection = CalculatorEditorImpl.correctSelection(viewState.getSelection(), editorView.getText()); - editorView.setSelection(selection); - } finally { - editorView.viewStateChange = false; - } + uiHandler.post(new Runnable() { + @Override + public void run() { + final AndroidCalculatorEditorView editorView = AndroidCalculatorEditorView.this; + synchronized (viewLock) { + try { + editorView.viewStateChange = true; + editorView.viewState = viewState; + editorView.setText(text, BufferType.EDITABLE); + final int selection = CalculatorEditorImpl.correctSelection(viewState.getSelection(), editorView.getText()); + editorView.setSelection(selection); + } finally { + editorView.viewStateChange = false; } } - }); - } + } + }); } } @Override protected void onSelectionChanged(int selStart, int selEnd) { - if (viewLock != null) { - synchronized (viewLock) { - if (!viewStateChange) { - // external text change => need to notify editor - super.onSelectionChanged(selStart, selEnd); + synchronized (viewLock) { + if (!viewStateChange) { + // external text change => need to notify editor + super.onSelectionChanged(selStart, selEnd); - if (selStart == selEnd) { - // only if cursor moving, if selection do nothing - Locator.getInstance().getEditor().setSelection(selStart); - } + if (selStart == selEnd) { + // only if cursor moving, if selection do nothing + Locator.getInstance().getEditor().setSelection(selStart); } } } } public void handleTextChange(Editable s) { - if (viewLock != null) { - synchronized (viewLock) { - if (!viewStateChange) { - // external text change => need to notify editor - Locator.getInstance().getEditor().setText(String.valueOf(s)); - } + synchronized (viewLock) { + if (!viewStateChange) { + // external text change => need to notify editor + Locator.getInstance().getEditor().setText(String.valueOf(s)); } } } diff --git a/android-app-core/src/main/java/org/solovyev/android/calculator/CalculatorButton.java b/android-app-core/src/main/java/org/solovyev/android/calculator/CalculatorButton.java index 3e1c2a31..ef5ce63c 100644 --- a/android-app-core/src/main/java/org/solovyev/android/calculator/CalculatorButton.java +++ b/android-app-core/src/main/java/org/solovyev/android/calculator/CalculatorButton.java @@ -1,8 +1,8 @@ package org.solovyev.android.calculator; import android.content.Context; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.core.R; import java.util.HashMap; @@ -61,42 +61,42 @@ public enum CalculatorButton { private final int buttonId; - @NotNull + @Nonnull private final String onClickText; @Nullable private final String onLongClickText; - @NotNull + @Nonnull private static Map buttonsByIds = new HashMap(); - CalculatorButton(int buttonId, @NotNull CalculatorSpecialButton onClickButton, @Nullable CalculatorSpecialButton onLongClickButton) { + CalculatorButton(int buttonId, @Nonnull CalculatorSpecialButton onClickButton, @Nullable CalculatorSpecialButton onLongClickButton) { this(buttonId, onClickButton.getActionCode(), onLongClickButton == null ? null : onLongClickButton.getActionCode()); } - CalculatorButton(int buttonId, @NotNull CalculatorSpecialButton onClickButton) { + CalculatorButton(int buttonId, @Nonnull CalculatorSpecialButton onClickButton) { this(buttonId, onClickButton, null); } - CalculatorButton(int buttonId, @NotNull String onClickText, @Nullable String onLongClickText) { + CalculatorButton(int buttonId, @Nonnull String onClickText, @Nullable String onLongClickText) { this.buttonId = buttonId; this.onClickText = onClickText; this.onLongClickText = onLongClickText; } - CalculatorButton(int buttonId, @NotNull String onClickText) { + CalculatorButton(int buttonId, @Nonnull String onClickText) { this(buttonId, onClickText, null); } - public void onLongClick(@NotNull Context context) { + public void onLongClick(@Nonnull Context context) { Locator.getInstance().getNotifier().showDebugMessage("Calculator++ Widget", "Button pressed: " + onLongClickText); if (onLongClickText != null) { Locator.getInstance().getKeyboard().buttonPressed(onLongClickText); } } - public void onClick(@NotNull Context context) { + public void onClick(@Nonnull Context context) { Locator.getInstance().getNotifier().showDebugMessage("Calculator++ Widget", "Button pressed: " + onClickText); Locator.getInstance().getKeyboard().buttonPressed(onClickText); } diff --git a/android-app-core/src/main/java/org/solovyev/android/calculator/CalculatorButtons.java b/android-app-core/src/main/java/org/solovyev/android/calculator/CalculatorButtons.java index 3f28043d..fd58e8b7 100644 --- a/android-app-core/src/main/java/org/solovyev/android/calculator/CalculatorButtons.java +++ b/android-app-core/src/main/java/org/solovyev/android/calculator/CalculatorButtons.java @@ -13,8 +13,8 @@ import android.widget.Button; import android.widget.RemoteViews; import jscl.AngleUnit; import jscl.NumeralBase; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.Views; import org.solovyev.android.calculator.core.R; import org.solovyev.android.calculator.model.AndroidCalculatorEngine; @@ -36,36 +36,36 @@ public final class CalculatorButtons { } - public static void processButtons(@NotNull CalculatorPreferences.Gui.Theme theme, - @NotNull CalculatorPreferences.Gui.Layout layout, - @NotNull View root) { + public static void processButtons(@Nonnull CalculatorPreferences.Gui.Theme theme, + @Nonnull CalculatorPreferences.Gui.Layout layout, + @Nonnull View root) { if (layout == CalculatorPreferences.Gui.Layout.main_calculator_mobile) { final float textSize = root.getContext().getResources().getDimension(R.dimen.cpp_keyboard_button_text_size_mobile); Views.processViewsOfType(root, DragButton.class, new Views.ViewProcessor() { @Override - public void process(@NotNull DragButton button) { + public void process(@Nonnull DragButton button) { button.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize); } }); } } - static void initMultiplicationButton(@NotNull View root) { + static void initMultiplicationButton(@Nonnull View root) { final View multiplicationButton = root.findViewById(R.id.cpp_button_multiplication); if (multiplicationButton instanceof Button) { ((Button) multiplicationButton).setText(Locator.getInstance().getEngine().getMultiplicationSign()); } } - public static void initMultiplicationButton(@NotNull RemoteViews views) { + public static void initMultiplicationButton(@Nonnull RemoteViews views) { views.setTextViewText(R.id.cpp_button_multiplication, Locator.getInstance().getEngine().getMultiplicationSign()); } public static void toggleEqualsButton(@Nullable SharedPreferences preferences, - @NotNull Activity activity) { + @Nonnull Activity activity) { preferences = preferences == null ? PreferenceManager.getDefaultSharedPreferences(activity) : preferences; final boolean large = Views.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE, activity.getResources().getConfiguration()) && @@ -97,7 +97,7 @@ public final class CalculatorButtons { static class RoundBracketsDragProcessor implements SimpleOnDragListener.DragProcessor { @Override - public boolean processDragEvent(@NotNull DragDirection dragDirection, @NotNull DragButton dragButton, @NotNull Point2d startPoint2d, @NotNull MotionEvent motionEvent) { + public boolean processDragEvent(@Nonnull DragDirection dragDirection, @Nonnull DragButton dragButton, @Nonnull Point2d startPoint2d, @Nonnull MotionEvent motionEvent) { final boolean result; if (dragDirection == DragDirection.left) { @@ -111,25 +111,25 @@ public final class CalculatorButtons { } } - @NotNull + @Nonnull private static CalculatorKeyboard getKeyboard() { return Locator.getInstance().getKeyboard(); } static class VarsDragProcessor implements SimpleOnDragListener.DragProcessor { - @NotNull + @Nonnull private Context context; - VarsDragProcessor(@NotNull Context context) { + VarsDragProcessor(@Nonnull Context context) { this.context = context; } @Override - public boolean processDragEvent(@NotNull DragDirection dragDirection, - @NotNull DragButton dragButton, - @NotNull Point2d startPoint2d, - @NotNull MotionEvent motionEvent) { + public boolean processDragEvent(@Nonnull DragDirection dragDirection, + @Nonnull DragButton dragButton, + @Nonnull Point2d startPoint2d, + @Nonnull MotionEvent motionEvent) { boolean result = false; if (dragDirection == DragDirection.up) { @@ -146,22 +146,22 @@ public final class CalculatorButtons { static class AngleUnitsChanger implements SimpleOnDragListener.DragProcessor { - @NotNull + @Nonnull private final DigitButtonDragProcessor processor; - @NotNull + @Nonnull private final Context context; - AngleUnitsChanger(@NotNull Context context) { + AngleUnitsChanger(@Nonnull Context context) { this.context = context; this.processor = new DigitButtonDragProcessor(Locator.getInstance().getKeyboard()); } @Override - public boolean processDragEvent(@NotNull DragDirection dragDirection, - @NotNull DragButton dragButton, - @NotNull Point2d startPoint2d, - @NotNull MotionEvent motionEvent) { + public boolean processDragEvent(@Nonnull DragDirection dragDirection, + @Nonnull DragButton dragButton, + @Nonnull Point2d startPoint2d, + @Nonnull MotionEvent motionEvent) { boolean result = false; if (dragButton instanceof AngleUnitsButton) { @@ -195,18 +195,18 @@ public final class CalculatorButtons { static class NumeralBasesChanger implements SimpleOnDragListener.DragProcessor { - @NotNull + @Nonnull private final Context context; - NumeralBasesChanger(@NotNull Context context) { + NumeralBasesChanger(@Nonnull Context context) { this.context = context; } @Override - public boolean processDragEvent(@NotNull DragDirection dragDirection, - @NotNull DragButton dragButton, - @NotNull Point2d startPoint2d, - @NotNull MotionEvent motionEvent) { + public boolean processDragEvent(@Nonnull DragDirection dragDirection, + @Nonnull DragButton dragButton, + @Nonnull Point2d startPoint2d, + @Nonnull MotionEvent motionEvent) { boolean result = false; if (dragButton instanceof NumeralBasesButton) { @@ -236,18 +236,18 @@ public final class CalculatorButtons { static class FunctionsDragProcessor implements SimpleOnDragListener.DragProcessor { - @NotNull + @Nonnull private Context context; - FunctionsDragProcessor(@NotNull Context context) { + FunctionsDragProcessor(@Nonnull Context context) { this.context = context; } @Override - public boolean processDragEvent(@NotNull DragDirection dragDirection, - @NotNull DragButton dragButton, - @NotNull Point2d startPoint2d, - @NotNull MotionEvent motionEvent) { + public boolean processDragEvent(@Nonnull DragDirection dragDirection, + @Nonnull DragButton dragButton, + @Nonnull Point2d startPoint2d, + @Nonnull MotionEvent motionEvent) { boolean result = false; if (dragDirection == DragDirection.up) { diff --git a/android-app-core/src/main/java/org/solovyev/android/calculator/CalculatorDisplayMenuItem.java b/android-app-core/src/main/java/org/solovyev/android/calculator/CalculatorDisplayMenuItem.java index e6edaef4..4b7ad8ea 100644 --- a/android-app-core/src/main/java/org/solovyev/android/calculator/CalculatorDisplayMenuItem.java +++ b/android-app-core/src/main/java/org/solovyev/android/calculator/CalculatorDisplayMenuItem.java @@ -2,7 +2,7 @@ package org.solovyev.android.calculator; import android.content.Context; import jscl.math.Generic; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.calculator.core.R; import org.solovyev.android.calculator.jscl.JsclOperation; import org.solovyev.android.calculator.plot.CalculatorPlotter; @@ -18,50 +18,50 @@ public enum CalculatorDisplayMenuItem implements LabeledMenuItem autoOrientation = BooleanPreference.of("autoOrientation", true); public static final Preference hideNumeralBaseDigits = BooleanPreference.of("hideNumeralBaseDigits", true); - @NotNull - public static Theme getTheme(@NotNull SharedPreferences preferences) { + @Nonnull + public static Theme getTheme(@Nonnull SharedPreferences preferences) { return theme.getPreferenceNoError(preferences); } - @NotNull - public static Layout getLayout(@NotNull SharedPreferences preferences) { + @Nonnull + public static Layout getLayout(@Nonnull SharedPreferences preferences) { return layout.getPreferenceNoError(preferences); } @@ -78,23 +78,23 @@ public final class CalculatorPreferences { metro_purple_theme(ThemeType.metro, R.style.cpp_metro_purple_theme), metro_green_theme(ThemeType.metro, R.style.cpp_metro_green_theme); - @NotNull + @Nonnull private final ThemeType themeType; - @NotNull + @Nonnull private final Integer themeId; - Theme(@NotNull ThemeType themeType, @NotNull Integer themeId) { + Theme(@Nonnull ThemeType themeType, @Nonnull Integer themeId) { this.themeType = themeType; this.themeId = themeId; } - @NotNull + @Nonnull public ThemeType getThemeType() { return themeType; } - @NotNull + @Nonnull public Integer getThemeId() { return themeId; } @@ -136,7 +136,7 @@ public final class CalculatorPreferences { } - static void setDefaultValues(@NotNull SharedPreferences preferences) { + static void setDefaultValues(@Nonnull SharedPreferences preferences) { if (!AndroidCalculatorEngine.Preferences.groupingSeparator.isSet(preferences)) { final Locale locale = Locale.getDefault(); @@ -206,7 +206,7 @@ public final class CalculatorPreferences { } - private static void applyDefaultPreference(@NotNull SharedPreferences preferences, @NotNull Preference preference) { + private static void applyDefaultPreference(@Nonnull SharedPreferences preferences, @Nonnull Preference preference) { preference.tryPutDefault(preferences); } diff --git a/android-app-core/src/main/java/org/solovyev/android/calculator/ConversionMenuItem.java b/android-app-core/src/main/java/org/solovyev/android/calculator/ConversionMenuItem.java index 8a543d07..8a034247 100644 --- a/android-app-core/src/main/java/org/solovyev/android/calculator/ConversionMenuItem.java +++ b/android-app-core/src/main/java/org/solovyev/android/calculator/ConversionMenuItem.java @@ -3,7 +3,7 @@ package org.solovyev.android.calculator; import android.content.Context; import jscl.NumeralBase; import jscl.math.Generic; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.calculator.jscl.JsclOperation; import org.solovyev.android.menu.AMenuItem; @@ -18,14 +18,14 @@ enum ConversionMenuItem implements AMenuItem { convert_to_dec(NumeralBase.dec), convert_to_hex(NumeralBase.hex); - @NotNull + @Nonnull private final NumeralBase toNumeralBase; - ConversionMenuItem(@NotNull NumeralBase toNumeralBase) { + ConversionMenuItem(@Nonnull NumeralBase toNumeralBase) { this.toNumeralBase = toNumeralBase; } - protected boolean isItemVisibleFor(@NotNull Generic generic, @NotNull JsclOperation operation) { + protected boolean isItemVisibleFor(@Nonnull Generic generic, @Nonnull JsclOperation operation) { boolean result = false; if (operation == JsclOperation.numeric) { @@ -42,7 +42,7 @@ enum ConversionMenuItem implements AMenuItem { } @Override - public void onClick(@NotNull CalculatorDisplayViewState data, @NotNull Context context) { + public void onClick(@Nonnull CalculatorDisplayViewState data, @Nonnull Context context) { final Generic result = data.getResult(); if (result != null) { diff --git a/android-app-core/src/main/java/org/solovyev/android/calculator/DigitButtonDragProcessor.java b/android-app-core/src/main/java/org/solovyev/android/calculator/DigitButtonDragProcessor.java index 625af371..003f60ed 100644 --- a/android-app-core/src/main/java/org/solovyev/android/calculator/DigitButtonDragProcessor.java +++ b/android-app-core/src/main/java/org/solovyev/android/calculator/DigitButtonDragProcessor.java @@ -6,7 +6,7 @@ package org.solovyev.android.calculator; import android.view.MotionEvent; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.view.drag.DirectionDragButton; import org.solovyev.android.view.drag.DragButton; import org.solovyev.android.view.drag.DragDirection; @@ -20,15 +20,15 @@ import org.solovyev.common.math.Point2d; */ public class DigitButtonDragProcessor implements SimpleOnDragListener.DragProcessor { - @NotNull + @Nonnull private CalculatorKeyboard calculatorKeyboard; - public DigitButtonDragProcessor(@NotNull CalculatorKeyboard calculatorKeyboard) { + public DigitButtonDragProcessor(@Nonnull CalculatorKeyboard calculatorKeyboard) { this.calculatorKeyboard = calculatorKeyboard; } @Override - public boolean processDragEvent(@NotNull DragDirection dragDirection, @NotNull DragButton dragButton, @NotNull Point2d startPoint2d, @NotNull MotionEvent motionEvent) { + public boolean processDragEvent(@Nonnull DragDirection dragDirection, @Nonnull DragButton dragButton, @Nonnull Point2d startPoint2d, @Nonnull MotionEvent motionEvent) { assert dragButton instanceof DirectionDragButton; calculatorKeyboard.buttonPressed(((DirectionDragButton) dragButton).getText(dragDirection)); return true; diff --git a/android-app-core/src/main/java/org/solovyev/android/calculator/FixableMessage.java b/android-app-core/src/main/java/org/solovyev/android/calculator/FixableMessage.java index 3b692e10..d701208c 100644 --- a/android-app-core/src/main/java/org/solovyev/android/calculator/FixableMessage.java +++ b/android-app-core/src/main/java/org/solovyev/android/calculator/FixableMessage.java @@ -2,8 +2,8 @@ package org.solovyev.android.calculator; import android.os.Parcel; import android.os.Parcelable; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.common.msg.Message; import org.solovyev.common.msg.MessageType; @@ -16,7 +16,7 @@ public class FixableMessage implements Parcelable { public static final Creator CREATOR = new Creator() { @Override - public FixableMessage createFromParcel(@NotNull Parcel in) { + public FixableMessage createFromParcel(@Nonnull Parcel in) { return FixableMessage.fromParcel(in); } @@ -26,8 +26,8 @@ public class FixableMessage implements Parcelable { } }; - @NotNull - private static FixableMessage fromParcel(@NotNull Parcel in) { + @Nonnull + private static FixableMessage fromParcel(@Nonnull Parcel in) { final String message = in.readString(); final MessageType messageType = (MessageType) in.readSerializable(); final FixableError fixableError = (FixableError) in.readSerializable(); @@ -35,16 +35,16 @@ public class FixableMessage implements Parcelable { return new FixableMessage(message, messageType, fixableError); } - @NotNull + @Nonnull private final String message; - @NotNull + @Nonnull private final MessageType messageType; @Nullable private final FixableError fixableError; - public FixableMessage(@NotNull Message message) { + public FixableMessage(@Nonnull Message message) { this.message = message.getLocalizedMessage(); int messageLevel = message.getMessageLevel().getMessageLevel(); if (messageLevel < MessageType.info.getMessageLevel()) { @@ -57,8 +57,8 @@ public class FixableMessage implements Parcelable { this.fixableError = CalculatorFixableError.getErrorByMessageCode(message.getMessageCode()); } - public FixableMessage(@NotNull String message, - @NotNull MessageType messageType, + public FixableMessage(@Nonnull String message, + @Nonnull MessageType messageType, @Nullable FixableError fixableError) { this.message = message; this.messageType = messageType; @@ -71,18 +71,18 @@ public class FixableMessage implements Parcelable { } @Override - public void writeToParcel(@NotNull Parcel out, int flags) { + public void writeToParcel(@Nonnull Parcel out, int flags) { out.writeString(message); out.writeSerializable(messageType); out.writeSerializable(fixableError); } - @NotNull + @Nonnull public String getMessage() { return message; } - @NotNull + @Nonnull public MessageType getMessageType() { return messageType; } diff --git a/android-app-core/src/main/java/org/solovyev/android/calculator/FixableMessagesDialog.java b/android-app-core/src/main/java/org/solovyev/android/calculator/FixableMessagesDialog.java index 76f219e4..63f36d1a 100644 --- a/android-app-core/src/main/java/org/solovyev/android/calculator/FixableMessagesDialog.java +++ b/android-app-core/src/main/java/org/solovyev/android/calculator/FixableMessagesDialog.java @@ -14,7 +14,7 @@ import android.widget.Button; import android.widget.CheckBox; import android.widget.TextView; import com.actionbarsherlock.app.SherlockActivity; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.calculator.core.R; import org.solovyev.common.msg.Message; import org.solovyev.common.text.Strings; @@ -32,7 +32,7 @@ public class FixableMessagesDialog extends SherlockActivity { private static final String INPUT = "input"; - @NotNull + @Nonnull private Input input = new Input(Collections.emptyList(), false); public FixableMessagesDialog() { @@ -70,7 +70,7 @@ public class FixableMessagesDialog extends SherlockActivity { }); } - private void parseIntent(@NotNull Intent intent) { + private void parseIntent(@Nonnull Intent intent) { final Input input = intent.getParcelableExtra(INPUT); if (input != null) { this.input = input; @@ -113,7 +113,7 @@ public class FixableMessagesDialog extends SherlockActivity { } @Override - protected void onNewIntent(@NotNull Intent intent) { + protected void onNewIntent(@Nonnull Intent intent) { super.onNewIntent(intent); parseIntent(intent); } @@ -126,8 +126,8 @@ public class FixableMessagesDialog extends SherlockActivity { ********************************************************************** */ - public static void showDialogForMessages(@NotNull List messages, - @NotNull Context context, + public static void showDialogForMessages(@Nonnull List messages, + @Nonnull Context context, boolean showCheckbox) { if (!messages.isEmpty()) { final Intent intent = new Intent(context, FixableMessagesDialog.class); @@ -139,8 +139,8 @@ public class FixableMessagesDialog extends SherlockActivity { } } - public static void showDialog(@NotNull List messages, - @NotNull Context context, + public static void showDialog(@Nonnull List messages, + @Nonnull Context context, boolean showCheckbox) { if (!messages.isEmpty()) { final Intent intent = new Intent(context, FixableMessagesDialog.class); @@ -156,7 +156,7 @@ public class FixableMessagesDialog extends SherlockActivity { public static final Creator CREATOR = new Creator() { @Override - public Input createFromParcel(@NotNull Parcel in) { + public Input createFromParcel(@Nonnull Parcel in) { return Input.fromParcel(in); } @@ -166,8 +166,8 @@ public class FixableMessagesDialog extends SherlockActivity { } }; - @NotNull - private static Input fromParcel(@NotNull Parcel in) { + @Nonnull + private static Input fromParcel(@Nonnull Parcel in) { final List messages = new ArrayList(); boolean showCheckbox = in.readInt() == 1; in.readTypedList(messages, FixableMessage.CREATOR); @@ -175,17 +175,17 @@ public class FixableMessagesDialog extends SherlockActivity { } - @NotNull + @Nonnull private List messages = new ArrayList(); private boolean showCheckbox; - private Input(@NotNull List messages, boolean showCheckbox) { + private Input(@Nonnull List messages, boolean showCheckbox) { this.messages = messages; this.showCheckbox = showCheckbox; } - @NotNull + @Nonnull public List getMessages() { return messages; } @@ -196,13 +196,13 @@ public class FixableMessagesDialog extends SherlockActivity { } @Override - public void writeToParcel(@NotNull Parcel out, int flags) { + public void writeToParcel(@Nonnull Parcel out, int flags) { out.writeInt(showCheckbox ? 1 : 0); out.writeTypedList(messages); } - @NotNull - public static Input fromMessages(@NotNull List messages, boolean showCheckbox) { + @Nonnull + public static Input fromMessages(@Nonnull List messages, boolean showCheckbox) { final List stringMessages = new ArrayList(messages.size()); for (Message message : messages) { stringMessages.add(new FixableMessage(message)); @@ -218,14 +218,14 @@ public class FixableMessagesDialog extends SherlockActivity { private class FixErrorOnClickListener implements View.OnClickListener { - @NotNull + @Nonnull private final List messages; - @NotNull + @Nonnull private final FixableMessage currentMessage; - public FixErrorOnClickListener(@NotNull List messages, - @NotNull FixableMessage message) { + public FixErrorOnClickListener(@Nonnull List messages, + @Nonnull FixableMessage message) { this.messages = messages; this.currentMessage = message; } diff --git a/android-app-core/src/main/java/org/solovyev/android/calculator/ParcelableCalculatorDisplayViewState.java b/android-app-core/src/main/java/org/solovyev/android/calculator/ParcelableCalculatorDisplayViewState.java index 30d14045..2357000d 100644 --- a/android-app-core/src/main/java/org/solovyev/android/calculator/ParcelableCalculatorDisplayViewState.java +++ b/android-app-core/src/main/java/org/solovyev/android/calculator/ParcelableCalculatorDisplayViewState.java @@ -3,8 +3,8 @@ package org.solovyev.android.calculator; import android.os.Parcel; import android.os.Parcelable; import jscl.math.Generic; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.jscl.JsclOperation; /** @@ -16,7 +16,7 @@ public final class ParcelableCalculatorDisplayViewState implements CalculatorDis public static final Creator CREATOR = new Creator() { @Override - public ParcelableCalculatorDisplayViewState createFromParcel(@NotNull Parcel in) { + public ParcelableCalculatorDisplayViewState createFromParcel(@Nonnull Parcel in) { return ParcelableCalculatorDisplayViewState.fromParcel(in); } @@ -26,8 +26,8 @@ public final class ParcelableCalculatorDisplayViewState implements CalculatorDis } }; - @NotNull - private static ParcelableCalculatorDisplayViewState fromParcel(@NotNull Parcel in) { + @Nonnull + private static ParcelableCalculatorDisplayViewState fromParcel(@Nonnull Parcel in) { final int selection = in.readInt(); final boolean valid = in.readInt() == 1; final String stringResult = in.readString(); @@ -44,15 +44,15 @@ public final class ParcelableCalculatorDisplayViewState implements CalculatorDis return new ParcelableCalculatorDisplayViewState(calculatorDisplayViewState); } - @NotNull + @Nonnull private CalculatorDisplayViewState viewState; - public ParcelableCalculatorDisplayViewState(@NotNull CalculatorDisplayViewState viewState) { + public ParcelableCalculatorDisplayViewState(@Nonnull CalculatorDisplayViewState viewState) { this.viewState = viewState; } @Override - @NotNull + @Nonnull public String getText() { return viewState.getText(); } @@ -80,7 +80,7 @@ public final class ParcelableCalculatorDisplayViewState implements CalculatorDis } @Override - @NotNull + @Nonnull public JsclOperation getOperation() { return viewState.getOperation(); } @@ -97,7 +97,7 @@ public final class ParcelableCalculatorDisplayViewState implements CalculatorDis } @Override - public void writeToParcel(@NotNull Parcel out, int flags) { + public void writeToParcel(@Nonnull Parcel out, int flags) { out.writeInt(viewState.getSelection()); out.writeInt(viewState.isValid() ? 1 : 0); out.writeString(viewState.getStringResult()); diff --git a/android-app-core/src/main/java/org/solovyev/android/calculator/ParcelableCalculatorEditorViewState.java b/android-app-core/src/main/java/org/solovyev/android/calculator/ParcelableCalculatorEditorViewState.java index 9d7fc79f..defa7555 100644 --- a/android-app-core/src/main/java/org/solovyev/android/calculator/ParcelableCalculatorEditorViewState.java +++ b/android-app-core/src/main/java/org/solovyev/android/calculator/ParcelableCalculatorEditorViewState.java @@ -2,7 +2,7 @@ package org.solovyev.android.calculator; import android.os.Parcel; import android.os.Parcelable; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; /** * User: serso @@ -13,7 +13,7 @@ public final class ParcelableCalculatorEditorViewState implements CalculatorEdit public static final Creator CREATOR = new Creator() { @Override - public ParcelableCalculatorEditorViewState createFromParcel(@NotNull Parcel in) { + public ParcelableCalculatorEditorViewState createFromParcel(@Nonnull Parcel in) { return ParcelableCalculatorEditorViewState.fromParcel(in); } @@ -23,22 +23,22 @@ public final class ParcelableCalculatorEditorViewState implements CalculatorEdit } }; - @NotNull + @Nonnull private CalculatorEditorViewState viewState; - public ParcelableCalculatorEditorViewState(@NotNull CalculatorEditorViewState viewState) { + public ParcelableCalculatorEditorViewState(@Nonnull CalculatorEditorViewState viewState) { this.viewState = viewState; } - @NotNull - private static ParcelableCalculatorEditorViewState fromParcel(@NotNull Parcel in) { + @Nonnull + private static ParcelableCalculatorEditorViewState fromParcel(@Nonnull Parcel in) { final String text = in.readString(); final int selection = in.readInt(); return new ParcelableCalculatorEditorViewState(CalculatorEditorViewStateImpl.newInstance(text, selection)); } @Override - @NotNull + @Nonnull public String getText() { return viewState.getText(); } @@ -54,7 +54,7 @@ public final class ParcelableCalculatorEditorViewState implements CalculatorEdit } @Override - public void writeToParcel(@NotNull Parcel out, int flags) { + public void writeToParcel(@Nonnull Parcel out, int flags) { out.writeString(viewState.getText()); out.writeInt(viewState.getSelection()); } diff --git a/android-app-core/src/main/java/org/solovyev/android/calculator/ParcelableDialogData.java b/android-app-core/src/main/java/org/solovyev/android/calculator/ParcelableDialogData.java index 3318e63d..87ce397e 100644 --- a/android-app-core/src/main/java/org/solovyev/android/calculator/ParcelableDialogData.java +++ b/android-app-core/src/main/java/org/solovyev/android/calculator/ParcelableDialogData.java @@ -2,8 +2,8 @@ package org.solovyev.android.calculator; import android.os.Parcel; import android.os.Parcelable; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.common.msg.MessageLevel; import org.solovyev.common.msg.MessageType; @@ -24,7 +24,7 @@ public final class ParcelableDialogData implements DialogData, Parcelable { public final static Creator CREATOR = new Creator() { @Override - public ParcelableDialogData createFromParcel(@NotNull Parcel in) { + public ParcelableDialogData createFromParcel(@Nonnull Parcel in) { return fromParcel(in); } @@ -42,7 +42,7 @@ public final class ParcelableDialogData implements DialogData, Parcelable { ********************************************************************** */ - @NotNull + @Nonnull private DialogData nestedData; /* @@ -53,12 +53,12 @@ public final class ParcelableDialogData implements DialogData, Parcelable { ********************************************************************** */ - public ParcelableDialogData(@NotNull DialogData nestedData) { + public ParcelableDialogData(@Nonnull DialogData nestedData) { this.nestedData = nestedData; } - @NotNull - public static ParcelableDialogData wrap(@NotNull DialogData nestedData) { + @Nonnull + public static ParcelableDialogData wrap(@Nonnull DialogData nestedData) { if (nestedData instanceof ParcelableDialogData) { return ((ParcelableDialogData) nestedData); } else { @@ -66,21 +66,21 @@ public final class ParcelableDialogData implements DialogData, Parcelable { } } - @NotNull - public static ParcelableDialogData fromParcel(@NotNull Parcel in) { + @Nonnull + public static ParcelableDialogData fromParcel(@Nonnull Parcel in) { final String message = in.readString(); final MessageType messageType = MessageType.values()[in.readInt()]; final String title = in.readString(); return wrap(StringDialogData.newInstance(message, messageType, title)); } - @NotNull + @Nonnull @Override public String getMessage() { return nestedData.getMessage(); } - @NotNull + @Nonnull @Override public MessageLevel getMessageLevel() { return nestedData.getMessageLevel(); @@ -98,7 +98,7 @@ public final class ParcelableDialogData implements DialogData, Parcelable { } @Override - public void writeToParcel(@NotNull Parcel out, int flags) { + public void writeToParcel(@Nonnull Parcel out, int flags) { out.writeString(this.getMessage()); out.writeInt(this.getMessageLevel().getMessageLevel()); out.writeString(this.getTitle()); diff --git a/android-app-core/src/main/java/org/solovyev/android/calculator/external/AndroidExternalListenersContainer.java b/android-app-core/src/main/java/org/solovyev/android/calculator/external/AndroidExternalListenersContainer.java index e0c03976..adabf4c9 100644 --- a/android-app-core/src/main/java/org/solovyev/android/calculator/external/AndroidExternalListenersContainer.java +++ b/android-app-core/src/main/java/org/solovyev/android/calculator/external/AndroidExternalListenersContainer.java @@ -3,11 +3,11 @@ package org.solovyev.android.calculator.external; import android.content.Context; import android.content.Intent; import android.os.Parcelable; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import org.solovyev.android.App; import org.solovyev.android.calculator.*; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.HashSet; import java.util.Set; @@ -39,19 +39,19 @@ public class AndroidExternalListenersContainer implements CalculatorExternalList private static final String TAG = "Calculator++ External Listener Helper"; - @NotNull + @Nonnull private final Set> externalListeners = new HashSet>(); - @NotNull + @Nonnull private final CalculatorEventHolder lastEvent = new CalculatorEventHolder(CalculatorUtils.createFirstEventDataId()); - public AndroidExternalListenersContainer(@NotNull Calculator calculator) { + public AndroidExternalListenersContainer(@Nonnull Calculator calculator) { calculator.addCalculatorEventListener(this); } - public void onEditorStateChanged(@NotNull Context context, - @NotNull CalculatorEventData calculatorEventData, - @NotNull CalculatorEditorViewState editorViewState) { + public void onEditorStateChanged(@Nonnull Context context, + @Nonnull CalculatorEventData calculatorEventData, + @Nonnull CalculatorEditorViewState editorViewState) { for (Class externalListener : getExternalListenersSync()) { final Intent intent = new Intent(EDITOR_STATE_CHANGED_ACTION); @@ -63,9 +63,9 @@ public class AndroidExternalListenersContainer implements CalculatorExternalList } } - private void onDisplayStateChanged(@NotNull Context context, - @NotNull CalculatorEventData calculatorEventData, - @NotNull CalculatorDisplayViewState displayViewState) { + private void onDisplayStateChanged(@Nonnull Context context, + @Nonnull CalculatorEventData calculatorEventData, + @Nonnull CalculatorDisplayViewState displayViewState) { for (Class externalListener : getExternalListenersSync()) { final Intent intent = new Intent(DISPLAY_STATE_CHANGED_ACTION); intent.setClass(context, externalListener); @@ -76,7 +76,7 @@ public class AndroidExternalListenersContainer implements CalculatorExternalList } } - @NotNull + @Nonnull private Set> getExternalListenersSync() { synchronized (externalListeners) { return new HashSet>(externalListeners); @@ -84,21 +84,21 @@ public class AndroidExternalListenersContainer implements CalculatorExternalList } @Override - public void addExternalListener(@NotNull Class externalCalculatorClass) { + public void addExternalListener(@Nonnull Class externalCalculatorClass) { synchronized (externalListeners) { externalListeners.add(externalCalculatorClass); } } @Override - public boolean removeExternalListener(@NotNull Class externalCalculatorClass) { + public boolean removeExternalListener(@Nonnull Class externalCalculatorClass) { synchronized (externalListeners) { return externalListeners.remove(externalCalculatorClass); } } @Override - public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) { + public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) { final CalculatorEventHolder.Result result = lastEvent.apply(calculatorEventData); if (result.isNewAfter()) { switch (calculatorEventType) { diff --git a/android-app-core/src/main/java/org/solovyev/android/calculator/external/DefaultExternalCalculatorIntentHandler.java b/android-app-core/src/main/java/org/solovyev/android/calculator/external/DefaultExternalCalculatorIntentHandler.java index 4e61fc78..28ede99d 100644 --- a/android-app-core/src/main/java/org/solovyev/android/calculator/external/DefaultExternalCalculatorIntentHandler.java +++ b/android-app-core/src/main/java/org/solovyev/android/calculator/external/DefaultExternalCalculatorIntentHandler.java @@ -3,7 +3,7 @@ package org.solovyev.android.calculator.external; import android.content.Context; import android.content.Intent; import android.os.Parcelable; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.calculator.CalculatorDisplayViewState; import org.solovyev.android.calculator.CalculatorEditorViewState; import org.solovyev.android.calculator.Locator; @@ -18,21 +18,21 @@ public class DefaultExternalCalculatorIntentHandler implements ExternalCalculato private static final String TAG = ExternalCalculatorIntentHandler.class.getSimpleName(); - @NotNull + @Nonnull private final MutableObject lastDisplayEventId = new MutableObject(0L); - @NotNull + @Nonnull private final MutableObject lastEditorEventId = new MutableObject(0L); - @NotNull + @Nonnull private final ExternalCalculatorStateUpdater stateUpdater; - public DefaultExternalCalculatorIntentHandler(@NotNull ExternalCalculatorStateUpdater stateUpdater) { + public DefaultExternalCalculatorIntentHandler(@Nonnull ExternalCalculatorStateUpdater stateUpdater) { this.stateUpdater = stateUpdater; } @Override - public void onIntent(@NotNull Context context, @NotNull Intent intent) { + public void onIntent(@Nonnull Context context, @Nonnull Intent intent) { if (AndroidExternalListenersContainer.EDITOR_STATE_CHANGED_ACTION.equals(intent.getAction())) { Locator.getInstance().getNotifier().showDebugMessage(TAG, "Editor state changed broadcast received!"); @@ -76,17 +76,17 @@ public class DefaultExternalCalculatorIntentHandler implements ExternalCalculato } } - protected void updateState(@NotNull Context context, - @NotNull CalculatorEditorViewState editorViewState, - @NotNull CalculatorDisplayViewState displayViewState) { + protected void updateState(@Nonnull Context context, + @Nonnull CalculatorEditorViewState editorViewState, + @Nonnull CalculatorDisplayViewState displayViewState) { stateUpdater.updateState(context, editorViewState, displayViewState); } - protected void onDisplayStateChanged(@NotNull Context context, @NotNull CalculatorDisplayViewState displayViewState) { + protected void onDisplayStateChanged(@Nonnull Context context, @Nonnull CalculatorDisplayViewState displayViewState) { updateState(context, Locator.getInstance().getEditor().getViewState(), displayViewState); } - protected void onEditorStateChanged(@NotNull Context context, @NotNull CalculatorEditorViewState editorViewState) { + protected void onEditorStateChanged(@Nonnull Context context, @Nonnull CalculatorEditorViewState editorViewState) { updateState(context, editorViewState, Locator.getInstance().getDisplay().getViewState()); } } diff --git a/android-app-core/src/main/java/org/solovyev/android/calculator/external/ExternalCalculatorIntentHandler.java b/android-app-core/src/main/java/org/solovyev/android/calculator/external/ExternalCalculatorIntentHandler.java index fa3768e5..e8e752c5 100644 --- a/android-app-core/src/main/java/org/solovyev/android/calculator/external/ExternalCalculatorIntentHandler.java +++ b/android-app-core/src/main/java/org/solovyev/android/calculator/external/ExternalCalculatorIntentHandler.java @@ -2,7 +2,7 @@ package org.solovyev.android.calculator.external; import android.content.Context; import android.content.Intent; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; /** * User: serso @@ -11,5 +11,5 @@ import org.jetbrains.annotations.NotNull; */ public interface ExternalCalculatorIntentHandler { - void onIntent(@NotNull Context context, @NotNull Intent intent); + void onIntent(@Nonnull Context context, @Nonnull Intent intent); } diff --git a/android-app-core/src/main/java/org/solovyev/android/calculator/external/ExternalCalculatorStateUpdater.java b/android-app-core/src/main/java/org/solovyev/android/calculator/external/ExternalCalculatorStateUpdater.java index 83c5c402..b827754e 100644 --- a/android-app-core/src/main/java/org/solovyev/android/calculator/external/ExternalCalculatorStateUpdater.java +++ b/android-app-core/src/main/java/org/solovyev/android/calculator/external/ExternalCalculatorStateUpdater.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator.external; import android.content.Context; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.calculator.CalculatorDisplayViewState; import org.solovyev.android.calculator.CalculatorEditorViewState; @@ -12,7 +12,7 @@ import org.solovyev.android.calculator.CalculatorEditorViewState; */ public interface ExternalCalculatorStateUpdater { - void updateState(@NotNull Context context, - @NotNull CalculatorEditorViewState editorState, - @NotNull CalculatorDisplayViewState displayState); + void updateState(@Nonnull Context context, + @Nonnull CalculatorEditorViewState editorState, + @Nonnull CalculatorDisplayViewState displayState); } diff --git a/android-app-core/src/main/java/org/solovyev/android/calculator/model/AndroidCalculatorEngine.java b/android-app-core/src/main/java/org/solovyev/android/calculator/model/AndroidCalculatorEngine.java index dcc3232a..5067d563 100644 --- a/android-app-core/src/main/java/org/solovyev/android/calculator/model/AndroidCalculatorEngine.java +++ b/android-app-core/src/main/java/org/solovyev/android/calculator/model/AndroidCalculatorEngine.java @@ -16,7 +16,7 @@ import jscl.NumeralBase; import jscl.math.function.Function; import jscl.math.function.IConstant; import jscl.math.operator.Operator; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.calculator.*; import org.solovyev.android.calculator.core.R; import org.solovyev.android.prefs.BooleanPreference; @@ -85,22 +85,22 @@ public class AndroidCalculatorEngine implements CalculatorEngine, SharedPreferen preferenceKeys.add(maxCalculationTime.getKey()); } - @NotNull + @Nonnull public static List getPreferenceKeys() { return Collections.unmodifiableList(preferenceKeys); } } - @NotNull + @Nonnull private final Context context; - @NotNull + @Nonnull private final CalculatorEngine calculatorEngine; - @NotNull + @Nonnull private final Object lock; - public AndroidCalculatorEngine(@NotNull Application application) { + public AndroidCalculatorEngine(@Nonnull Application application) { this.context = application; PreferenceManager.getDefaultSharedPreferences(application).registerOnSharedPreferenceChangeListener(this); @@ -117,42 +117,42 @@ public class AndroidCalculatorEngine implements CalculatorEngine, SharedPreferen } @Override - @NotNull + @Nonnull public CalculatorMathRegistry getVarsRegistry() { return calculatorEngine.getVarsRegistry(); } @Override - @NotNull + @Nonnull public CalculatorMathRegistry getFunctionsRegistry() { return calculatorEngine.getFunctionsRegistry(); } @Override - @NotNull + @Nonnull public CalculatorMathRegistry getOperatorsRegistry() { return calculatorEngine.getOperatorsRegistry(); } @Override - @NotNull + @Nonnull public CalculatorMathRegistry getPostfixFunctionsRegistry() { return calculatorEngine.getPostfixFunctionsRegistry(); } @Override - @NotNull + @Nonnull public CalculatorMathEngine getMathEngine() { return calculatorEngine.getMathEngine(); } - @NotNull + @Nonnull @Override public MathEngine getMathEngine0() { return calculatorEngine.getMathEngine0(); } - @NotNull + @Nonnull @Override public NumeralBase getNumeralBase() { return calculatorEngine.getNumeralBase(); @@ -196,47 +196,47 @@ public class AndroidCalculatorEngine implements CalculatorEngine, SharedPreferen } @Override - public void setPrecision(@NotNull Integer precision) { + public void setPrecision(@Nonnull Integer precision) { calculatorEngine.setPrecision(precision); } @Override - public void setRoundResult(@NotNull Boolean round) { + public void setRoundResult(@Nonnull Boolean round) { calculatorEngine.setRoundResult(round); } - @NotNull + @Nonnull @Override public AngleUnit getAngleUnits() { return calculatorEngine.getAngleUnits(); } @Override - public void setAngleUnits(@NotNull AngleUnit angleUnits) { + public void setAngleUnits(@Nonnull AngleUnit angleUnits) { calculatorEngine.setAngleUnits(angleUnits); } @Override - public void setNumeralBase(@NotNull NumeralBase numeralBase) { + public void setNumeralBase(@Nonnull NumeralBase numeralBase) { calculatorEngine.setNumeralBase(numeralBase); } @Override - public void setMultiplicationSign(@NotNull String multiplicationSign) { + public void setMultiplicationSign(@Nonnull String multiplicationSign) { calculatorEngine.setMultiplicationSign(multiplicationSign); } @Override - public void setScienceNotation(@NotNull Boolean scienceNotation) { + public void setScienceNotation(@Nonnull Boolean scienceNotation) { calculatorEngine.setScienceNotation(scienceNotation); } @Override - public void setTimeout(@NotNull Integer timeout) { + public void setTimeout(@Nonnull Integer timeout) { calculatorEngine.setTimeout(timeout); } - private void softReset(@NotNull SharedPreferences preferences) { + private void softReset(@Nonnull SharedPreferences preferences) { this.setPrecision(Preferences.precision.getPreference(preferences)); this.setRoundResult(Preferences.roundResult.getPreference(preferences)); this.setAngleUnits(getAngleUnitsFromPrefs(preferences)); @@ -254,23 +254,23 @@ public class AndroidCalculatorEngine implements CalculatorEngine, SharedPreferen } } - @NotNull - public NumeralBase getNumeralBaseFromPrefs(@NotNull SharedPreferences preferences) { + @Nonnull + public NumeralBase getNumeralBaseFromPrefs(@Nonnull SharedPreferences preferences) { return Preferences.numeralBase.getPreference(preferences); } - @NotNull - public AngleUnit getAngleUnitsFromPrefs(@NotNull SharedPreferences preferences) { + @Nonnull + public AngleUnit getAngleUnitsFromPrefs(@Nonnull SharedPreferences preferences) { return Preferences.angleUnit.getPreference(preferences); } //for tests only - public void setDecimalGroupSymbols(@NotNull DecimalFormatSymbols decimalGroupSymbols) { + public void setDecimalGroupSymbols(@Nonnull DecimalFormatSymbols decimalGroupSymbols) { this.calculatorEngine.setDecimalGroupSymbols(decimalGroupSymbols); } @Override - @NotNull + @Nonnull public String getMultiplicationSign() { return calculatorEngine.getMultiplicationSign(); } diff --git a/android-app-core/src/main/java/org/solovyev/android/calculator/model/AndroidMathEntityDao.java b/android-app-core/src/main/java/org/solovyev/android/calculator/model/AndroidMathEntityDao.java index 56c6b096..5a49e4cb 100644 --- a/android-app-core/src/main/java/org/solovyev/android/calculator/model/AndroidMathEntityDao.java +++ b/android-app-core/src/main/java/org/solovyev/android/calculator/model/AndroidMathEntityDao.java @@ -5,8 +5,8 @@ import android.content.Context; import android.content.SharedPreferences; import android.content.res.Resources; import android.preference.PreferenceManager; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.simpleframework.xml.Serializer; import org.simpleframework.xml.core.Persister; import org.solovyev.android.App; @@ -23,20 +23,20 @@ import java.io.StringWriter; */ public class AndroidMathEntityDao implements MathEntityDao { - @NotNull + @Nonnull private static final String TAG = AndroidMathEntityDao.class.getSimpleName(); @Nullable private final Integer preferenceStringId; - @NotNull + @Nonnull private final Context context; @Nullable private final Class> persistenceContainerClass; public AndroidMathEntityDao(@Nullable Integer preferenceStringId, - @NotNull Application application, + @Nonnull Application application, @Nullable Class> persistenceContainerClass) { this.preferenceStringId = preferenceStringId; this.context = application; @@ -44,7 +44,7 @@ public class AndroidMathEntityDao implements Ma } @Override - public void save(@NotNull MathEntityPersistenceContainer container) { + public void save(@Nonnull MathEntityPersistenceContainer container) { if (preferenceStringId != null) { final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context); final SharedPreferences.Editor editor = settings.edit(); @@ -86,7 +86,7 @@ public class AndroidMathEntityDao implements Ma } @Nullable - public String getDescription(@NotNull String descriptionId) { + public String getDescription(@Nonnull String descriptionId) { final Resources resources = context.getResources(); final int stringId = resources.getIdentifier(descriptionId, "string", App.getApplication().getClass().getPackage().getName()); diff --git a/android-app-core/src/main/java/org/solovyev/android/calculator/plot/AndroidCalculatorPlotter.java b/android-app-core/src/main/java/org/solovyev/android/calculator/plot/AndroidCalculatorPlotter.java index 37e3e782..041172c3 100644 --- a/android-app-core/src/main/java/org/solovyev/android/calculator/plot/AndroidCalculatorPlotter.java +++ b/android-app-core/src/main/java/org/solovyev/android/calculator/plot/AndroidCalculatorPlotter.java @@ -4,8 +4,8 @@ import android.content.Context; import android.content.SharedPreferences; import android.preference.PreferenceManager; import jscl.math.Generic; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.CalculatorPreferences; import java.util.List; @@ -17,11 +17,11 @@ import java.util.List; */ public class AndroidCalculatorPlotter implements CalculatorPlotter, SharedPreferences.OnSharedPreferenceChangeListener { - @NotNull + @Nonnull private final CalculatorPlotter plotter; - public AndroidCalculatorPlotter(@NotNull Context context, - @NotNull CalculatorPlotter plotter) { + public AndroidCalculatorPlotter(@Nonnull Context context, + @Nonnull CalculatorPlotter plotter) { this.plotter = plotter; final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext()); @@ -31,72 +31,72 @@ public class AndroidCalculatorPlotter implements CalculatorPlotter, SharedPrefer } @Override - @NotNull + @Nonnull public PlotData getPlotData() { return plotter.getPlotData(); } @Override - public boolean addFunction(@NotNull Generic expression) { + public boolean addFunction(@Nonnull Generic expression) { return plotter.addFunction(expression); } @Override - public boolean addFunction(@NotNull PlotFunction plotFunction) { + public boolean addFunction(@Nonnull PlotFunction plotFunction) { return plotter.addFunction(plotFunction); } @Override - public boolean addFunction(@NotNull XyFunction xyFunction) { + public boolean addFunction(@Nonnull XyFunction xyFunction) { return plotter.addFunction(xyFunction); } @Override - public boolean addFunction(@NotNull XyFunction xyFunction, @NotNull PlotLineDef functionLineDef) { + public boolean addFunction(@Nonnull XyFunction xyFunction, @Nonnull PlotLineDef functionLineDef) { return plotter.addFunction(xyFunction, functionLineDef); } @Override - public boolean updateFunction(@NotNull PlotFunction newFunction) { + public boolean updateFunction(@Nonnull PlotFunction newFunction) { return plotter.updateFunction(newFunction); } @Override - public boolean updateFunction(@NotNull XyFunction xyFunction, @NotNull PlotLineDef functionLineDef) { + public boolean updateFunction(@Nonnull XyFunction xyFunction, @Nonnull PlotLineDef functionLineDef) { return plotter.updateFunction(xyFunction, functionLineDef); } @Override - public boolean removeFunction(@NotNull PlotFunction plotFunction) { + public boolean removeFunction(@Nonnull PlotFunction plotFunction) { return plotter.removeFunction(plotFunction); } @Override - public boolean removeFunction(@NotNull XyFunction xyFunction) { + public boolean removeFunction(@Nonnull XyFunction xyFunction) { return plotter.removeFunction(xyFunction); } - @NotNull + @Nonnull @Override - public PlotFunction pin(@NotNull PlotFunction plotFunction) { + public PlotFunction pin(@Nonnull PlotFunction plotFunction) { return plotter.pin(plotFunction); } - @NotNull + @Nonnull @Override - public PlotFunction unpin(@NotNull PlotFunction plotFunction) { + public PlotFunction unpin(@Nonnull PlotFunction plotFunction) { return plotter.unpin(plotFunction); } - @NotNull + @Nonnull @Override - public PlotFunction show(@NotNull PlotFunction plotFunction) { + public PlotFunction show(@Nonnull PlotFunction plotFunction) { return plotter.show(plotFunction); } - @NotNull + @Nonnull @Override - public PlotFunction hide(@NotNull PlotFunction plotFunction) { + public PlotFunction hide(@Nonnull PlotFunction plotFunction) { return plotter.hide(plotFunction); } @@ -107,18 +107,18 @@ public class AndroidCalculatorPlotter implements CalculatorPlotter, SharedPrefer @Nullable @Override - public PlotFunction getFunctionById(@NotNull String functionId) { + public PlotFunction getFunctionById(@Nonnull String functionId) { return plotter.getFunctionById(functionId); } @Override - @NotNull + @Nonnull public List getFunctions() { return plotter.getFunctions(); } @Override - @NotNull + @Nonnull public List getVisibleFunctions() { return plotter.getVisibleFunctions(); } @@ -129,7 +129,7 @@ public class AndroidCalculatorPlotter implements CalculatorPlotter, SharedPrefer } @Override - public void plot(@NotNull Generic expression) { + public void plot(@Nonnull Generic expression) { plotter.plot(expression); } @@ -139,7 +139,7 @@ public class AndroidCalculatorPlotter implements CalculatorPlotter, SharedPrefer } @Override - public boolean isPlotPossibleFor(@NotNull Generic expression) { + public boolean isPlotPossibleFor(@Nonnull Generic expression) { return plotter.isPlotPossibleFor(expression); } @@ -159,12 +159,12 @@ public class AndroidCalculatorPlotter implements CalculatorPlotter, SharedPrefer } @Override - public void savePlotBoundaries(@NotNull PlotBoundaries plotBoundaries) { + public void savePlotBoundaries(@Nonnull PlotBoundaries plotBoundaries) { plotter.savePlotBoundaries(plotBoundaries); } @Override - public void setPlotBoundaries(@NotNull PlotBoundaries plotBoundaries) { + public void setPlotBoundaries(@Nonnull PlotBoundaries plotBoundaries) { plotter.setPlotBoundaries(plotBoundaries); } diff --git a/android-app-core/src/main/java/org/solovyev/android/calculator/plot/AndroidPlotLineStyle.java b/android-app-core/src/main/java/org/solovyev/android/calculator/plot/AndroidPlotLineStyle.java index e741451c..0685d190 100644 --- a/android-app-core/src/main/java/org/solovyev/android/calculator/plot/AndroidPlotLineStyle.java +++ b/android-app-core/src/main/java/org/solovyev/android/calculator/plot/AndroidPlotLineStyle.java @@ -2,8 +2,8 @@ package org.solovyev.android.calculator.plot; import android.graphics.DashPathEffect; import android.graphics.Paint; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; /** * User: serso @@ -14,43 +14,43 @@ public enum AndroidPlotLineStyle { solid(PlotLineStyle.solid) { @Override - public void applyToPaint(@NotNull Paint paint) { + public void applyToPaint(@Nonnull Paint paint) { paint.setPathEffect(null); } }, dashed(PlotLineStyle.dashed) { @Override - public void applyToPaint(@NotNull Paint paint) { + public void applyToPaint(@Nonnull Paint paint) { paint.setPathEffect(new DashPathEffect(new float[]{10, 20}, 0)); } }, dotted(PlotLineStyle.dotted) { @Override - public void applyToPaint(@NotNull Paint paint) { + public void applyToPaint(@Nonnull Paint paint) { paint.setPathEffect(new DashPathEffect(new float[]{5, 1}, 0)); } }, dash_dotted(PlotLineStyle.dash_dotted) { @Override - public void applyToPaint(@NotNull Paint paint) { + public void applyToPaint(@Nonnull Paint paint) { paint.setPathEffect(new DashPathEffect(new float[]{10, 20, 5, 1}, 0)); } }; - @NotNull + @Nonnull private final PlotLineStyle plotLineStyle; - AndroidPlotLineStyle(@NotNull PlotLineStyle plotLineStyle) { + AndroidPlotLineStyle(@Nonnull PlotLineStyle plotLineStyle) { this.plotLineStyle = plotLineStyle; } - public abstract void applyToPaint(@NotNull Paint paint); + public abstract void applyToPaint(@Nonnull Paint paint); @Nullable - public static AndroidPlotLineStyle valueOf(@NotNull PlotLineStyle plotLineStyle) { + public static AndroidPlotLineStyle valueOf(@Nonnull PlotLineStyle plotLineStyle) { for (AndroidPlotLineStyle androidPlotLineStyle : values()) { if (androidPlotLineStyle.plotLineStyle == plotLineStyle) { return androidPlotLineStyle; diff --git a/android-app-core/src/main/java/org/solovyev/android/calculator/view/AngleUnitsButton.java b/android-app-core/src/main/java/org/solovyev/android/calculator/view/AngleUnitsButton.java index 4a17cda2..8c82eed1 100644 --- a/android-app-core/src/main/java/org/solovyev/android/calculator/view/AngleUnitsButton.java +++ b/android-app-core/src/main/java/org/solovyev/android/calculator/view/AngleUnitsButton.java @@ -11,7 +11,7 @@ import android.content.res.Resources; import android.graphics.Paint; import android.text.TextPaint; import android.util.AttributeSet; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.calculator.Locator; import org.solovyev.android.calculator.core.R; import org.solovyev.android.view.drag.DirectionDragButton; @@ -23,14 +23,14 @@ import org.solovyev.android.view.drag.DirectionDragButton; */ public class AngleUnitsButton extends DirectionDragButton { - public AngleUnitsButton(Context context, @NotNull AttributeSet attrs) { + public AngleUnitsButton(Context context, @Nonnull AttributeSet attrs) { super(context, attrs); } @Override - protected void initDirectionTextPaint(@NotNull Paint basePaint, - @NotNull DirectionTextData directionTextData, - @NotNull Resources resources) { + protected void initDirectionTextPaint(@Nonnull Paint basePaint, + @Nonnull DirectionTextData directionTextData, + @Nonnull Resources resources) { super.initDirectionTextPaint(basePaint, directionTextData, resources); final TextPaint directionTextPaint = directionTextData.getPaint(); diff --git a/android-app-core/src/main/java/org/solovyev/android/calculator/view/NumeralBaseConverterDialog.java b/android-app-core/src/main/java/org/solovyev/android/calculator/view/NumeralBaseConverterDialog.java index 1b3dc5ac..73fd0067 100644 --- a/android-app-core/src/main/java/org/solovyev/android/calculator/view/NumeralBaseConverterDialog.java +++ b/android-app-core/src/main/java/org/solovyev/android/calculator/view/NumeralBaseConverterDialog.java @@ -4,8 +4,8 @@ import android.app.AlertDialog; import android.content.Context; import android.view.View; import android.view.WindowManager; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.CalculatorParseException; import org.solovyev.android.calculator.Locator; import org.solovyev.android.calculator.ToJsclTextProcessor; @@ -32,7 +32,7 @@ public class NumeralBaseConverterDialog { this.initialFromValue = initialFromValue; } - public void show(@NotNull Context context) { + public void show(@Nonnull Context context) { final UnitConverterViewBuilder b = new UnitConverterViewBuilder(); b.setFromUnitTypes(Arrays.asList(CalculatorNumeralBase.values())); b.setToUnitTypes(Arrays.asList(CalculatorNumeralBase.values())); @@ -64,7 +64,7 @@ public class NumeralBaseConverterDialog { b.setCustomButtonData(new UnitConverterViewBuilder.CustomButtonData(context.getString(R.string.c_use_short), new UnitConverterViewBuilder.CustomButtonOnClickListener() { @Override - public void onClick(@NotNull Unit fromUnits, @NotNull Unit toUnits) { + public void onClick(@Nonnull Unit fromUnits, @Nonnull Unit toUnits) { String toUnitsValue = toUnits.getValue(); if (!toUnits.getUnitType().equals(CalculatorNumeralBase.valueOf(Locator.getInstance().getEngine().getNumeralBase()))) { diff --git a/android-app-core/src/main/java/org/solovyev/android/calculator/view/NumeralBasesButton.java b/android-app-core/src/main/java/org/solovyev/android/calculator/view/NumeralBasesButton.java index fca46c6c..753ea367 100644 --- a/android-app-core/src/main/java/org/solovyev/android/calculator/view/NumeralBasesButton.java +++ b/android-app-core/src/main/java/org/solovyev/android/calculator/view/NumeralBasesButton.java @@ -11,7 +11,7 @@ import android.content.res.Resources; import android.graphics.Paint; import android.text.TextPaint; import android.util.AttributeSet; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.calculator.Locator; import org.solovyev.android.calculator.core.R; import org.solovyev.android.view.drag.DirectionDragButton; @@ -23,14 +23,14 @@ import org.solovyev.android.view.drag.DirectionDragButton; */ public class NumeralBasesButton extends DirectionDragButton { - public NumeralBasesButton(Context context, @NotNull AttributeSet attrs) { + public NumeralBasesButton(Context context, @Nonnull AttributeSet attrs) { super(context, attrs); } @Override - protected void initDirectionTextPaint(@NotNull Paint basePaint, - @NotNull DirectionTextData directionTextData, - @NotNull Resources resources) { + protected void initDirectionTextPaint(@Nonnull Paint basePaint, + @Nonnull DirectionTextData directionTextData, + @Nonnull Resources resources) { super.initDirectionTextPaint(basePaint, directionTextData, resources); final TextPaint directionTextPaint = directionTextData.getPaint(); diff --git a/android-app-core/src/main/java/org/solovyev/android/calculator/view/TextHighlighter.java b/android-app-core/src/main/java/org/solovyev/android/calculator/view/TextHighlighter.java index bb0240a6..baa8877e 100644 --- a/android-app-core/src/main/java/org/solovyev/android/calculator/view/TextHighlighter.java +++ b/android-app-core/src/main/java/org/solovyev/android/calculator/view/TextHighlighter.java @@ -6,8 +6,8 @@ package org.solovyev.android.calculator.view; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.*; import org.solovyev.android.calculator.math.MathType; import org.solovyev.android.calculator.text.TextProcessor; @@ -31,7 +31,7 @@ public class TextHighlighter implements TextProcessor tagAttributes) { + private int processHighlightedText(@Nonnull StringBuilder result, int i, @Nonnull String match, @Nonnull String tag, @Nullable Map tagAttributes) { result.append("<").append(tag); if (tagAttributes != null && !tagAttributes.entrySet().isEmpty()) { @@ -203,7 +203,7 @@ public class TextHighlighter implements TextProcessor"); diff --git a/android-app-core/src/main/java/org/solovyev/android/calculator/view/UnitConverterViewBuilder.java b/android-app-core/src/main/java/org/solovyev/android/calculator/view/UnitConverterViewBuilder.java index e9f8e75a..a55dc126 100644 --- a/android-app-core/src/main/java/org/solovyev/android/calculator/view/UnitConverterViewBuilder.java +++ b/android-app-core/src/main/java/org/solovyev/android/calculator/view/UnitConverterViewBuilder.java @@ -8,8 +8,8 @@ import android.text.TextWatcher; import android.view.View; import android.view.ViewGroup; import android.widget.*; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.core.R; import org.solovyev.android.view.ViewBuilder; import org.solovyev.android.view.ViewFromLayoutBuilder; @@ -25,16 +25,16 @@ import java.util.List; */ public class UnitConverterViewBuilder implements ViewBuilder { - @NotNull + @Nonnull private List> fromUnitTypes = Collections.emptyList(); - @NotNull + @Nonnull private List> toUnitTypes = Collections.emptyList(); @Nullable private Unit fromValue; - @NotNull + @Nonnull private UnitConverter converter = UnitConverter.Dummy.getInstance(); @Nullable @@ -43,11 +43,11 @@ public class UnitConverterViewBuilder implements ViewBuilder { @Nullable private CustomButtonData customButtonData; - public void setFromUnitTypes(@NotNull List> fromUnitTypes) { + public void setFromUnitTypes(@Nonnull List> fromUnitTypes) { this.fromUnitTypes = fromUnitTypes; } - public void setToUnitTypes(@NotNull List> toUnitTypes) { + public void setToUnitTypes(@Nonnull List> toUnitTypes) { this.toUnitTypes = toUnitTypes; } @@ -55,7 +55,7 @@ public class UnitConverterViewBuilder implements ViewBuilder { this.fromValue = fromValue; } - public void setConverter(@NotNull UnitConverter converter) { + public void setConverter(@Nonnull UnitConverter converter) { this.converter = converter; } @@ -67,9 +67,9 @@ public class UnitConverterViewBuilder implements ViewBuilder { this.customButtonData = customButtonData; } - @NotNull + @Nonnull @Override - public View build(@NotNull final Context context) { + public View build(@Nonnull final Context context) { final View main = ViewFromLayoutBuilder.newInstance(R.layout.cpp_unit_converter).build(context); final Spinner fromSpinner = (Spinner) main.findViewById(R.id.unit_types_from); @@ -137,10 +137,10 @@ public class UnitConverterViewBuilder implements ViewBuilder { return main; } - private void fillSpinner(@NotNull final View main, - @NotNull final Context context, + private void fillSpinner(@Nonnull final View main, + @Nonnull final Context context, final int spinnerId, - @NotNull List> unitTypes) { + @Nonnull List> unitTypes) { final Spinner spinner = (Spinner) main.findViewById(spinnerId); final ArrayAdapter> adapter = new ArrayAdapter>(context, android.R.layout.simple_spinner_item); @@ -161,7 +161,7 @@ public class UnitConverterViewBuilder implements ViewBuilder { spinner.setAdapter(adapter); } - private static void doConversion(@NotNull View main, @NotNull Context context, @NotNull UnitConverter converter) { + private static void doConversion(@Nonnull View main, @Nonnull Context context, @Nonnull UnitConverter converter) { final EditText fromEditText = (EditText) main.findViewById(R.id.units_from); final EditText toEditText = (EditText) main.findViewById(R.id.units_to); @@ -174,46 +174,46 @@ public class UnitConverterViewBuilder implements ViewBuilder { } } - @NotNull - private static Unit getToUnit(@NotNull View main) { + @Nonnull + private static Unit getToUnit(@Nonnull View main) { final EditText toUnits = (EditText) main.findViewById(R.id.units_to); return UnitImpl.newInstance(toUnits.getText().toString(), getToUnitType(main)); } - @NotNull - private static UnitType getToUnitType(@NotNull View main) { + @Nonnull + private static UnitType getToUnitType(@Nonnull View main) { final Spinner toSpinner = (Spinner) main.findViewById(R.id.unit_types_to); return (UnitType) toSpinner.getSelectedItem(); } - @NotNull - private static Unit getFromUnit(@NotNull View main) { + @Nonnull + private static Unit getFromUnit(@Nonnull View main) { final EditText fromUnits = (EditText) main.findViewById(R.id.units_from); return UnitImpl.newInstance(fromUnits.getText().toString(), getFromUnitType(main)); } - @NotNull - private static UnitType getFromUnitType(@NotNull View main) { + @Nonnull + private static UnitType getFromUnitType(@Nonnull View main) { final Spinner fromSpinner = (Spinner) main.findViewById(R.id.unit_types_from); return (UnitType) fromSpinner.getSelectedItem(); } public static class CustomButtonData { - @NotNull + @Nonnull private String text; - @NotNull + @Nonnull private CustomButtonOnClickListener clickListener; - public CustomButtonData(@NotNull String text, @NotNull CustomButtonOnClickListener clickListener) { + public CustomButtonData(@Nonnull String text, @Nonnull CustomButtonOnClickListener clickListener) { this.text = text; this.clickListener = clickListener; } } public static interface CustomButtonOnClickListener { - void onClick(@NotNull Unit fromUnits, @NotNull Unit toUnits); + void onClick(@Nonnull Unit fromUnits, @Nonnull Unit toUnits); } } diff --git a/android-app-onscreen/AndroidManifest.xml b/android-app-onscreen/AndroidManifest.xml index c93288ba..8b799d51 100644 --- a/android-app-onscreen/AndroidManifest.xml +++ b/android-app-onscreen/AndroidManifest.xml @@ -2,4 +2,10 @@ \ No newline at end of file + android:versionName="1.0"> + + + + \ No newline at end of file diff --git a/android-app-onscreen/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenBroadcastReceiver.java b/android-app-onscreen/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenBroadcastReceiver.java index 47b61fcf..6f8c74bb 100644 --- a/android-app-onscreen/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenBroadcastReceiver.java +++ b/android-app-onscreen/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenBroadcastReceiver.java @@ -5,7 +5,7 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.preference.PreferenceManager; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.calculator.CalculatorPreferences; /** @@ -19,8 +19,8 @@ public final class CalculatorOnscreenBroadcastReceiver extends BroadcastReceiver } @Override - public void onReceive(@NotNull Context context, - @NotNull Intent intent) { + public void onReceive(@Nonnull Context context, + @Nonnull Intent intent) { if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) { final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); if (CalculatorPreferences.OnscreenCalculator.startOnBoot.getPreferenceNoError(preferences)) { diff --git a/android-app-onscreen/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenService.java b/android-app-onscreen/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenService.java index 74f98451..8ac2e5d6 100644 --- a/android-app-onscreen/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenService.java +++ b/android-app-onscreen/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenService.java @@ -9,8 +9,8 @@ import android.os.IBinder; import android.support.v4.app.NotificationCompat; import android.util.DisplayMetrics; import android.view.WindowManager; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.Views; import org.solovyev.android.calculator.CalculatorDisplayViewState; import org.solovyev.android.calculator.CalculatorEditorViewState; @@ -29,14 +29,14 @@ public class CalculatorOnscreenService extends Service implements ExternalCalcul private static final int NOTIFICATION_ID = 9031988; // my birthday =) - @NotNull + @Nonnull private final ExternalCalculatorIntentHandler intentHandler = new DefaultExternalCalculatorIntentHandler(this); public static final Class INTENT_LISTENER_CLASS = CalculatorOnscreenBroadcastReceiver.class; @Nullable private static String cursorColor; - @NotNull + @Nonnull private CalculatorOnscreenView view; private boolean compatibilityStart = true; @@ -89,7 +89,7 @@ public class CalculatorOnscreenService extends Service implements ExternalCalcul Locator.getInstance().getExternalListenersContainer().addExternalListener(getIntentListenerClass()); } - @NotNull + @Nonnull private static Class getIntentListenerClass() { return INTENT_LISTENER_CLASS; } @@ -108,13 +108,13 @@ public class CalculatorOnscreenService extends Service implements ExternalCalcul } @Override - public void updateState(@NotNull Context context, @NotNull CalculatorEditorViewState editorState, @NotNull CalculatorDisplayViewState displayState) { + public void updateState(@Nonnull Context context, @Nonnull CalculatorEditorViewState editorState, @Nonnull CalculatorDisplayViewState displayState) { view.updateDisplayState(displayState); view.updateEditorState(editorState); } - @NotNull - private static String getCursorColor(@NotNull Context context) { + @Nonnull + private static String getCursorColor(@Nonnull Context context) { if (cursorColor == null) { cursorColor = Integer.toHexString(context.getResources().getColor(R.color.cpp_onscreen_cursor_color)).substring(2); } @@ -166,7 +166,7 @@ public class CalculatorOnscreenService extends Service implements ExternalCalcul } } - private boolean isInitIntent(@NotNull Intent intent) { + private boolean isInitIntent(@Nonnull Intent intent) { return intent.getAction().equals(AndroidExternalListenersContainer.INIT_ACTION); } @@ -200,19 +200,19 @@ public class CalculatorOnscreenService extends Service implements ExternalCalcul nm.notify(NOTIFICATION_ID, builder.getNotification()); } - public static void showNotification(@NotNull Context context) { + public static void showNotification(@Nonnull Context context) { final Intent intent = new Intent(AndroidExternalListenersContainer.INIT_ACTION); intent.setClass(context, getIntentListenerClass()); context.sendBroadcast(intent); } - public static void showOnscreenView(@NotNull Context context) { + public static void showOnscreenView(@Nonnull Context context) { final Intent intent = createShowOnscreenViewIntent(context); context.sendBroadcast(intent); } - @NotNull - private static Intent createShowOnscreenViewIntent(@NotNull Context context) { + @Nonnull + private static Intent createShowOnscreenViewIntent(@Nonnull Context context) { final Intent intent = new Intent(AndroidExternalListenersContainer.INIT_ACTION); intent.setClass(context, getIntentListenerClass()); intent.putExtra(AndroidExternalListenersContainer.INIT_ACTION_CREATE_VIEW_EXTRA, true); diff --git a/android-app-onscreen/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenStartActivity.java b/android-app-onscreen/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenStartActivity.java index 1079ba3a..ed93e069 100644 --- a/android-app-onscreen/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenStartActivity.java +++ b/android-app-onscreen/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenStartActivity.java @@ -5,7 +5,7 @@ import android.content.Context; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.Android; import org.solovyev.android.App; import org.solovyev.android.calculator.AbstractFixableError; @@ -38,7 +38,7 @@ public class CalculatorOnscreenStartActivity extends Activity { public static class RemoveIconFixableError extends AbstractFixableError { - public RemoveIconFixableError(@NotNull Context context) { + public RemoveIconFixableError(@Nonnull Context context) { super(context.getString(R.string.cpp_onscreen_remove_icon_button_text)); } diff --git a/android-app-onscreen/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenView.java b/android-app-onscreen/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenView.java index 2aaeea03..8f6b629b 100644 --- a/android-app-onscreen/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenView.java +++ b/android-app-onscreen/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenView.java @@ -11,8 +11,8 @@ import android.view.MotionEvent; import android.view.View; import android.view.WindowManager; import android.widget.ImageView; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.*; import org.solovyev.android.prefs.Preference; @@ -50,28 +50,28 @@ public class CalculatorOnscreenView { ********************************************************************** */ - @NotNull + @Nonnull private View root; - @NotNull + @Nonnull private View content; - @NotNull + @Nonnull private View header; - @NotNull + @Nonnull private AndroidCalculatorEditorView editorView; - @NotNull + @Nonnull private AndroidCalculatorDisplayView displayView; - @NotNull + @Nonnull private Context context; - @NotNull + @Nonnull private CalculatorOnscreenViewState state = CalculatorOnscreenViewState.newDefaultState(); - @NotNull + @Nonnull private String cursorColor; @Nullable @@ -107,9 +107,9 @@ public class CalculatorOnscreenView { private CalculatorOnscreenView() { } - public static CalculatorOnscreenView newInstance(@NotNull Context context, - @NotNull CalculatorOnscreenViewState state, - @NotNull String cursorColor, + public static CalculatorOnscreenView newInstance(@Nonnull Context context, + @Nonnull CalculatorOnscreenViewState state, + @Nonnull String cursorColor, @Nullable OnscreenViewListener viewListener) { final CalculatorOnscreenView result = new CalculatorOnscreenView(); @@ -136,12 +136,12 @@ public class CalculatorOnscreenView { ********************************************************************** */ - public void updateDisplayState(@NotNull CalculatorDisplayViewState displayState) { + public void updateDisplayState(@Nonnull CalculatorDisplayViewState displayState) { checkInit(); displayView.setState(displayState); } - public void updateEditorState(@NotNull CalculatorEditorViewState editorState) { + public void updateEditorState(@Nonnull CalculatorEditorViewState editorState) { checkInit(); editorView.setState(editorState); } @@ -312,13 +312,13 @@ public class CalculatorOnscreenView { } } - public static void persistState(@NotNull Context context, @NotNull CalculatorOnscreenViewState state) { + public static void persistState(@Nonnull Context context, @Nonnull CalculatorOnscreenViewState state) { final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); viewStatePreference.putPreference(preferences, state); } @Nullable - public static CalculatorOnscreenViewState readState(@NotNull Context context) { + public static CalculatorOnscreenViewState readState(@Nonnull Context context) { final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); if (viewStatePreference.isSet(preferences)) { return viewStatePreference.getPreference(preferences); @@ -344,12 +344,12 @@ public class CalculatorOnscreenView { } } - @NotNull + @Nonnull private WindowManager getWindowManager() { return ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)); } - @NotNull + @Nonnull public CalculatorOnscreenViewState getCurrentState(boolean useRealSize) { final WindowManager.LayoutParams params = (WindowManager.LayoutParams) root.getLayoutParams(); if (useRealSize) { @@ -389,7 +389,7 @@ public class CalculatorOnscreenView { ********************************************************************** */ - @NotNull + @Nonnull private final WindowManager wm; private int orientation; @@ -400,7 +400,7 @@ public class CalculatorOnscreenView { private long time = 0; - @NotNull + @Nonnull private final View view; private int displayWidth; @@ -415,8 +415,8 @@ public class CalculatorOnscreenView { ********************************************************************** */ - public WindowDragTouchListener(@NotNull WindowManager wm, - @NotNull View view) { + public WindowDragTouchListener(@Nonnull WindowManager wm, + @Nonnull View view) { this.wm = wm; this.view = view; initDisplayParams(); @@ -503,7 +503,7 @@ public class CalculatorOnscreenView { return δx >= DIST_EPS && δx < DIST_MAX; } - @NotNull + @Nonnull private static String toString(float x, float y) { return "(" + formatFloat(x) + ", " + formatFloat(y) + ")"; } diff --git a/android-app-onscreen/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenViewState.java b/android-app-onscreen/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenViewState.java index 103224d6..dac8482b 100644 --- a/android-app-onscreen/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenViewState.java +++ b/android-app-onscreen/src/main/java/org/solovyev/android/calculator/onscreen/CalculatorOnscreenViewState.java @@ -4,8 +4,8 @@ import android.content.SharedPreferences; import android.os.Parcel; import android.os.Parcelable; import android.util.Log; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.json.JSONException; import org.json.JSONObject; import org.solovyev.android.prefs.AbstractPreference; @@ -23,7 +23,7 @@ public class CalculatorOnscreenViewState implements Parcelable { private static final String TAG = CalculatorOnscreenViewState.class.getSimpleName(); public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { - public CalculatorOnscreenViewState createFromParcel(@NotNull Parcel in) { + public CalculatorOnscreenViewState createFromParcel(@Nonnull Parcel in) { return CalculatorOnscreenViewState.fromParcel(in); } @@ -43,8 +43,8 @@ public class CalculatorOnscreenViewState implements Parcelable { private CalculatorOnscreenViewState() { } - @NotNull - private static CalculatorOnscreenViewState fromParcel(@NotNull Parcel in) { + @Nonnull + private static CalculatorOnscreenViewState fromParcel(@Nonnull Parcel in) { final CalculatorOnscreenViewState result = new CalculatorOnscreenViewState(); result.width = in.readInt(); result.height = in.readInt(); @@ -53,12 +53,12 @@ public class CalculatorOnscreenViewState implements Parcelable { return result; } - @NotNull + @Nonnull public static CalculatorOnscreenViewState newDefaultState() { return newInstance(200, 400, 0, 0); } - @NotNull + @Nonnull public static CalculatorOnscreenViewState newInstance(int width, int height, int x, int y) { final CalculatorOnscreenViewState result = new CalculatorOnscreenViewState(); result.width = width; @@ -106,7 +106,7 @@ public class CalculatorOnscreenViewState implements Parcelable { } @Override - public void writeToParcel(@NotNull Parcel out, int flags) { + public void writeToParcel(@Nonnull Parcel out, int flags) { out.writeInt(width); out.writeInt(height); out.writeInt(x); @@ -125,13 +125,13 @@ public class CalculatorOnscreenViewState implements Parcelable { public static class Preference extends AbstractPreference { - public Preference(@NotNull String key, @Nullable CalculatorOnscreenViewState defaultValue) { + public Preference(@Nonnull String key, @Nullable CalculatorOnscreenViewState defaultValue) { super(key, defaultValue); } @Nullable @Override - protected CalculatorOnscreenViewState getPersistedValue(@NotNull SharedPreferences preferences) { + protected CalculatorOnscreenViewState getPersistedValue(@Nonnull SharedPreferences preferences) { try { final CalculatorOnscreenViewState result = new CalculatorOnscreenViewState(); final JSONObject jsonObject = new JSONObject(preferences.getString(getKey(), "{}")); @@ -149,7 +149,7 @@ public class CalculatorOnscreenViewState implements Parcelable { } @Override - protected void putPersistedValue(@NotNull SharedPreferences.Editor editor, @NotNull CalculatorOnscreenViewState value) { + protected void putPersistedValue(@Nonnull SharedPreferences.Editor editor, @Nonnull CalculatorOnscreenViewState value) { final Map properties = new HashMap(); properties.put("width", value.getWidth()); properties.put("height", value.getHeight()); diff --git a/android-app-widget/AndroidManifest.xml b/android-app-widget/AndroidManifest.xml index 49f99a51..19a41354 100644 --- a/android-app-widget/AndroidManifest.xml +++ b/android-app-widget/AndroidManifest.xml @@ -2,4 +2,10 @@ \ No newline at end of file + android:versionName="1.0"> + + + + \ No newline at end of file diff --git a/android-app-widget/src/main/java/org/solovyev/android/calculator/widget/AbstractCalculatorWidgetProvider.java b/android-app-widget/src/main/java/org/solovyev/android/calculator/widget/AbstractCalculatorWidgetProvider.java index 8172e9b5..30d56805 100644 --- a/android-app-widget/src/main/java/org/solovyev/android/calculator/widget/AbstractCalculatorWidgetProvider.java +++ b/android-app-widget/src/main/java/org/solovyev/android/calculator/widget/AbstractCalculatorWidgetProvider.java @@ -8,12 +8,13 @@ import android.content.Context; import android.content.Intent; import android.text.Html; import android.widget.RemoteViews; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import org.solovyev.android.calculator.*; import org.solovyev.android.calculator.external.ExternalCalculatorIntentHandler; import org.solovyev.android.calculator.external.ExternalCalculatorStateUpdater; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + /** * User: Solovyev_S * Date: 19.10.12 @@ -37,7 +38,7 @@ abstract class AbstractCalculatorWidgetProvider extends AppWidgetProvider implem @Nullable private String cursorColor; - @NotNull + @Nonnull private ExternalCalculatorIntentHandler intentHandler = new CalculatorWidgetIntentHandler(this); @@ -70,8 +71,8 @@ abstract class AbstractCalculatorWidgetProvider extends AppWidgetProvider implem getCursorColor(context); } - @NotNull - private String getCursorColor(@NotNull Context context) { + @Nonnull + private String getCursorColor(@Nonnull Context context) { if (cursorColor == null) { cursorColor = Integer.toHexString(context.getResources().getColor(R.color.cpp_widget_cursor_color)).substring(2); } @@ -79,34 +80,34 @@ abstract class AbstractCalculatorWidgetProvider extends AppWidgetProvider implem } @Override - public void onUpdate(@NotNull Context context, - @NotNull AppWidgetManager appWidgetManager, - @NotNull int[] appWidgetIds) { + public void onUpdate(@Nonnull Context context, + @Nonnull AppWidgetManager appWidgetManager, + @Nonnull int[] appWidgetIds) { super.onUpdate(context, appWidgetManager, appWidgetIds); updateWidget(context, appWidgetManager, appWidgetIds, Locator.getInstance().getEditor().getViewState(), Locator.getInstance().getDisplay().getViewState()); } @Override - public void updateState(@NotNull Context context, - @NotNull CalculatorEditorViewState editorState, - @NotNull CalculatorDisplayViewState displayState) { + public void updateState(@Nonnull Context context, + @Nonnull CalculatorEditorViewState editorState, + @Nonnull CalculatorDisplayViewState displayState) { final AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); final int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, getComponentClass())); updateWidget(context, appWidgetManager, appWidgetIds, editorState, displayState); } - @NotNull + @Nonnull protected Class getComponentClass() { return this.getClass(); } - private void updateWidget(@NotNull Context context, - @NotNull AppWidgetManager appWidgetManager, - @NotNull int[] appWidgetIds, - @NotNull CalculatorEditorViewState editorState, - @NotNull CalculatorDisplayViewState displayState) { + private void updateWidget(@Nonnull Context context, + @Nonnull AppWidgetManager appWidgetManager, + @Nonnull int[] appWidgetIds, + @Nonnull CalculatorEditorViewState editorState, + @Nonnull CalculatorDisplayViewState displayState) { for (int appWidgetId : appWidgetIds) { final RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_layout); @@ -136,7 +137,7 @@ abstract class AbstractCalculatorWidgetProvider extends AppWidgetProvider implem this.intentHandler.onIntent(context, intent); } - private void updateDisplayState(@NotNull Context context, @NotNull RemoteViews views, @NotNull CalculatorDisplayViewState displayState) { + private void updateDisplayState(@Nonnull Context context, @Nonnull RemoteViews views, @Nonnull CalculatorDisplayViewState displayState) { if (displayState.isValid()) { views.setTextViewText(R.id.calculator_display, displayState.getText()); views.setTextColor(R.id.calculator_display, context.getResources().getColor(R.color.cpp_default_text_color)); @@ -145,7 +146,7 @@ abstract class AbstractCalculatorWidgetProvider extends AppWidgetProvider implem } } - private void updateEditorState(@NotNull Context context, @NotNull RemoteViews views, @NotNull CalculatorEditorViewState editorState) { + private void updateEditorState(@Nonnull Context context, @Nonnull RemoteViews views, @Nonnull CalculatorEditorViewState editorState) { String text = editorState.getText(); CharSequence newText = text; diff --git a/android-app-widget/src/main/java/org/solovyev/android/calculator/widget/CalculatorWidgetIntentHandler.java b/android-app-widget/src/main/java/org/solovyev/android/calculator/widget/CalculatorWidgetIntentHandler.java index 9508f642..a1e195dc 100644 --- a/android-app-widget/src/main/java/org/solovyev/android/calculator/widget/CalculatorWidgetIntentHandler.java +++ b/android-app-widget/src/main/java/org/solovyev/android/calculator/widget/CalculatorWidgetIntentHandler.java @@ -2,7 +2,7 @@ package org.solovyev.android.calculator.widget; import android.content.Context; import android.content.Intent; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.calculator.CalculatorButton; import org.solovyev.android.calculator.Locator; import org.solovyev.android.calculator.external.DefaultExternalCalculatorIntentHandler; @@ -15,12 +15,12 @@ import org.solovyev.android.calculator.external.ExternalCalculatorStateUpdater; */ public class CalculatorWidgetIntentHandler extends DefaultExternalCalculatorIntentHandler { - public CalculatorWidgetIntentHandler(@NotNull ExternalCalculatorStateUpdater stateUpdater) { + public CalculatorWidgetIntentHandler(@Nonnull ExternalCalculatorStateUpdater stateUpdater) { super(stateUpdater); } @Override - public void onIntent(@NotNull Context context, @NotNull Intent intent) { + public void onIntent(@Nonnull Context context, @Nonnull Intent intent) { super.onIntent(context, intent); if (AbstractCalculatorWidgetProvider.BUTTON_PRESSED_ACTION.equals(intent.getAction())) { diff --git a/android-app/AndroidManifest.xml b/android-app/AndroidManifest.xml index 46e3c58d..6f08b92d 100644 --- a/android-app/AndroidManifest.xml +++ b/android-app/AndroidManifest.xml @@ -1,277 +1,176 @@ - + - - - - - + + + + + - - + + - - - - - + + + + + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - - - - + + + + - + - + - + - + - + - + - + - - + + - - - + + + - - - - + + + + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - - - - - + + + + + - + - + - + - - - + + + - + \ No newline at end of file diff --git a/android-app/pom.xml b/android-app/pom.xml index acc0b41e..602c23aa 100644 --- a/android-app/pom.xml +++ b/android-app/pom.xml @@ -122,15 +122,10 @@ test - - com.intellij - annotations - - com.pivotallabs robolectric - 1.1 + 1.2 test diff --git a/android-app/src/main/java/org/solovyev/android/calculator/AbstractCalculatorHelper.java b/android-app/src/main/java/org/solovyev/android/calculator/AbstractCalculatorHelper.java index b94855d4..aca8589d 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/AbstractCalculatorHelper.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/AbstractCalculatorHelper.java @@ -9,8 +9,8 @@ import android.preference.PreferenceManager; import android.util.Log; import android.view.MotionEvent; import android.view.View; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.history.CalculatorHistoryState; import org.solovyev.android.calculator.view.AngleUnitsButton; import org.solovyev.android.calculator.view.NumeralBasesButton; @@ -33,29 +33,29 @@ import java.util.List; */ public abstract class AbstractCalculatorHelper implements SharedPreferences.OnSharedPreferenceChangeListener { - @NotNull + @Nonnull private CalculatorPreferences.Gui.Layout layout; - @NotNull + @Nonnull private CalculatorPreferences.Gui.Theme theme; @Nullable private Vibrator vibrator; - @NotNull + @Nonnull private final JListeners dpclRegister = Listeners.newHardRefListeners(); - @NotNull + @Nonnull private String logTag = "CalculatorActivity"; protected AbstractCalculatorHelper() { } - protected AbstractCalculatorHelper(@NotNull String logTag) { + protected AbstractCalculatorHelper(@Nonnull String logTag) { this.logTag = logTag; } - protected void onCreate(@NotNull Activity activity) { + protected void onCreate(@Nonnull Activity activity) { final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity); vibrator = (Vibrator) activity.getSystemService(Activity.VIBRATOR_SERVICE); @@ -71,15 +71,15 @@ public abstract class AbstractCalculatorHelper implements SharedPreferences.OnSh } } - public void logDebug(@NotNull String message) { + public void logDebug(@Nonnull String message) { Log.d(logTag, message); } - public void logError(@NotNull String message) { + public void logError(@Nonnull String message) { Log.e(logTag, message); } - public void processButtons(@NotNull final Activity activity, @NotNull View root) { + public void processButtons(@Nonnull final Activity activity, @Nonnull View root) { dpclRegister.removeListeners(); final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity); @@ -97,7 +97,7 @@ public abstract class AbstractCalculatorHelper implements SharedPreferences.OnSh if (subtractionButton != null) { subtractionButton.setOnDragListener(new OnDragListenerVibrator(newOnDragListener(new SimpleOnDragListener.DragProcessor() { @Override - public boolean processDragEvent(@NotNull DragDirection dragDirection, @NotNull DragButton dragButton, @NotNull Point2d startPoint2d, @NotNull MotionEvent motionEvent) { + public boolean processDragEvent(@Nonnull DragDirection dragDirection, @Nonnull DragButton dragButton, @Nonnull Point2d startPoint2d, @Nonnull MotionEvent motionEvent) { if (dragDirection == DragDirection.down) { Locator.getInstance().getCalculator().fireCalculatorEvent(CalculatorEventType.show_operators, null); return true; @@ -175,7 +175,7 @@ public abstract class AbstractCalculatorHelper implements SharedPreferences.OnSh NumeralBaseButtons.toggleNumericDigits(activity, preferences); } - private void toggleButtonDirectionText(@NotNull View root, int id, boolean showDirectionText, @NotNull DragDirection... dragDirections) { + private void toggleButtonDirectionText(@Nonnull View root, int id, boolean showDirectionText, @Nonnull DragDirection... dragDirections) { final View v = getButton(root, id); if (v instanceof DirectionDragButton) { final DirectionDragButton button = (DirectionDragButton) v; @@ -185,13 +185,13 @@ public abstract class AbstractCalculatorHelper implements SharedPreferences.OnSh } } - @NotNull + @Nonnull private Calculator getCalculator() { return Locator.getInstance().getCalculator(); } - private void setOnDragListeners(@NotNull View root, @NotNull SimpleOnDragListener.Preferences dragPreferences, @NotNull SharedPreferences preferences) { + private void setOnDragListeners(@Nonnull View root, @Nonnull SimpleOnDragListener.Preferences dragPreferences, @Nonnull SharedPreferences preferences) { final OnDragListener onDragListener = new OnDragListenerVibrator(newOnDragListener(new DigitButtonDragProcessor(getKeyboard()), dragPreferences), vibrator, preferences); final List dragButtonIds = new ArrayList(); @@ -219,19 +219,19 @@ public abstract class AbstractCalculatorHelper implements SharedPreferences.OnSh } } - @NotNull + @Nonnull private CalculatorKeyboard getKeyboard() { return Locator.getInstance().getKeyboard(); } @Nullable - private T getButton(@NotNull View root, int buttonId) { + private T getButton(@Nonnull View root, int buttonId) { return (T) root.findViewById(buttonId); } - @NotNull - private SimpleOnDragListener newOnDragListener(@NotNull SimpleOnDragListener.DragProcessor dragProcessor, - @NotNull SimpleOnDragListener.Preferences dragPreferences) { + @Nonnull + private SimpleOnDragListener newOnDragListener(@Nonnull SimpleOnDragListener.DragProcessor dragProcessor, + @Nonnull SimpleOnDragListener.Preferences dragPreferences) { final SimpleOnDragListener onDragListener = new SimpleOnDragListener(dragProcessor, dragPreferences); dpclRegister.addListener(onDragListener); return onDragListener; @@ -247,7 +247,7 @@ public abstract class AbstractCalculatorHelper implements SharedPreferences.OnSh } } - public void onDestroy(@NotNull Activity activity) { + public void onDestroy(@Nonnull Activity activity) { final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity); preferences.unregisterOnSharedPreferenceChangeListener(this); diff --git a/android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculator.java b/android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculator.java index b8d64497..caa9819d 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculator.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculator.java @@ -7,8 +7,8 @@ import android.content.SharedPreferences; import android.preference.PreferenceManager; import jscl.NumeralBase; import jscl.math.Generic; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.history.CalculatorHistoryState; import org.solovyev.android.calculator.jscl.JsclOperation; import org.solovyev.common.history.HistoryAction; @@ -23,40 +23,40 @@ import java.util.List; */ public class AndroidCalculator implements Calculator, CalculatorEventListener, SharedPreferences.OnSharedPreferenceChangeListener { - @NotNull + @Nonnull private final CalculatorImpl calculator = new CalculatorImpl(); - @NotNull + @Nonnull private final Application context; - public AndroidCalculator(@NotNull Application application) { + public AndroidCalculator(@Nonnull Application application) { this.context = application; this.calculator.addCalculatorEventListener(this); PreferenceManager.getDefaultSharedPreferences(application).registerOnSharedPreferenceChangeListener(this); } - public void init(@NotNull final Activity activity) { + public void init(@Nonnull final Activity activity) { setEditor(activity); setDisplay(activity); } - public void setDisplay(@NotNull Activity activity) { + public void setDisplay(@Nonnull Activity activity) { final AndroidCalculatorDisplayView displayView = (AndroidCalculatorDisplayView) activity.findViewById(R.id.calculator_display); setDisplay(activity, displayView); } - public void setDisplay(@NotNull Context context, @NotNull AndroidCalculatorDisplayView displayView) { + public void setDisplay(@Nonnull Context context, @Nonnull AndroidCalculatorDisplayView displayView) { displayView.init(context); Locator.getInstance().getDisplay().setView(displayView); } - public void setEditor(@NotNull Activity activity) { + public void setEditor(@Nonnull Activity activity) { final AndroidCalculatorEditorView editorView = (AndroidCalculatorEditorView) activity.findViewById(R.id.calculator_editor); setEditor(activity, editorView); } - public void setEditor(@NotNull Context context, @NotNull AndroidCalculatorEditorView editorView) { + public void setEditor(@Nonnull Context context, @Nonnull AndroidCalculatorEditorView editorView) { editorView.init(context); Locator.getInstance().getEditor().setView(editorView); } @@ -71,49 +71,49 @@ public class AndroidCalculator implements Calculator, CalculatorEventListener, S */ @Override - @NotNull - public CalculatorEventData evaluate(@NotNull JsclOperation operation, @NotNull String expression) { + @Nonnull + public CalculatorEventData evaluate(@Nonnull JsclOperation operation, @Nonnull String expression) { return calculator.evaluate(operation, expression); } @Override - @NotNull - public CalculatorEventData evaluate(@NotNull JsclOperation operation, @NotNull String expression, @NotNull Long sequenceId) { + @Nonnull + public CalculatorEventData evaluate(@Nonnull JsclOperation operation, @Nonnull String expression, @Nonnull Long sequenceId) { return calculator.evaluate(operation, expression, sequenceId); } @Override - public boolean isConversionPossible(@NotNull Generic generic, @NotNull NumeralBase from, @NotNull NumeralBase to) { + public boolean isConversionPossible(@Nonnull Generic generic, @Nonnull NumeralBase from, @Nonnull NumeralBase to) { return calculator.isConversionPossible(generic, from, to); } @Override - @NotNull - public CalculatorEventData convert(@NotNull Generic generic, @NotNull NumeralBase to) { + @Nonnull + public CalculatorEventData convert(@Nonnull Generic generic, @Nonnull NumeralBase to) { return calculator.convert(generic, to); } @Override - @NotNull - public CalculatorEventData fireCalculatorEvent(@NotNull CalculatorEventType calculatorEventType, @Nullable Object data) { + @Nonnull + public CalculatorEventData fireCalculatorEvent(@Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) { return calculator.fireCalculatorEvent(calculatorEventType, data); } - @NotNull + @Nonnull @Override - public CalculatorEventData fireCalculatorEvent(@NotNull CalculatorEventType calculatorEventType, @Nullable Object data, @NotNull Object source) { + public CalculatorEventData fireCalculatorEvent(@Nonnull CalculatorEventType calculatorEventType, @Nullable Object data, @Nonnull Object source) { return calculator.fireCalculatorEvent(calculatorEventType, data, source); } @Override - @NotNull - public CalculatorEventData fireCalculatorEvent(@NotNull CalculatorEventType calculatorEventType, @Nullable Object data, @NotNull Long sequenceId) { + @Nonnull + public CalculatorEventData fireCalculatorEvent(@Nonnull CalculatorEventType calculatorEventType, @Nullable Object data, @Nonnull Long sequenceId) { return calculator.fireCalculatorEvent(calculatorEventType, data, sequenceId); } - @NotNull + @Nonnull @Override - public PreparedExpression prepareExpression(@NotNull String expression) throws CalculatorParseException { + public PreparedExpression prepareExpression(@Nonnull String expression) throws CalculatorParseException { return calculator.prepareExpression(expression); } @@ -126,37 +126,37 @@ public class AndroidCalculator implements Calculator, CalculatorEventListener, S } @Override - public void addCalculatorEventListener(@NotNull CalculatorEventListener calculatorEventListener) { + public void addCalculatorEventListener(@Nonnull CalculatorEventListener calculatorEventListener) { calculator.addCalculatorEventListener(calculatorEventListener); } @Override - public void removeCalculatorEventListener(@NotNull CalculatorEventListener calculatorEventListener) { + public void removeCalculatorEventListener(@Nonnull CalculatorEventListener calculatorEventListener) { calculator.removeCalculatorEventListener(calculatorEventListener); } @Override - public void fireCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) { + public void fireCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) { calculator.fireCalculatorEvent(calculatorEventData, calculatorEventType, data); } @Override - public void fireCalculatorEvents(@NotNull List calculatorEvents) { + public void fireCalculatorEvents(@Nonnull List calculatorEvents) { calculator.fireCalculatorEvents(calculatorEvents); } @Override - public void doHistoryAction(@NotNull HistoryAction historyAction) { + public void doHistoryAction(@Nonnull HistoryAction historyAction) { calculator.doHistoryAction(historyAction); } @Override - public void setCurrentHistoryState(@NotNull CalculatorHistoryState editorHistoryState) { + public void setCurrentHistoryState(@Nonnull CalculatorHistoryState editorHistoryState) { calculator.setCurrentHistoryState(editorHistoryState); } @Override - @NotNull + @Nonnull public CalculatorHistoryState getCurrentHistoryState() { return calculator.getCurrentHistoryState(); } @@ -167,7 +167,7 @@ public class AndroidCalculator implements Calculator, CalculatorEventListener, S } @Override - public void evaluate(@NotNull Long sequenceId) { + public void evaluate(@Nonnull Long sequenceId) { calculator.evaluate(sequenceId); } @@ -177,7 +177,7 @@ public class AndroidCalculator implements Calculator, CalculatorEventListener, S } @Override - public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) { + public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) { switch (calculatorEventType) { case calculation_messages: CalculatorActivityLauncher.showCalculationMessagesDialog(CalculatorApplication.getInstance(), (List) data); @@ -222,7 +222,7 @@ public class AndroidCalculator implements Calculator, CalculatorEventListener, S } @Override - public void onSharedPreferenceChanged(@NotNull SharedPreferences prefs, @NotNull String key) { + public void onSharedPreferenceChanged(@Nonnull SharedPreferences prefs, @Nonnull String key) { if (CalculatorPreferences.Calculations.calculateOnFly.getKey().equals(key)) { this.calculator.setCalculateOnFly(CalculatorPreferences.Calculations.calculateOnFly.getPreference(prefs)); } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculatorClipboard.java b/android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculatorClipboard.java index acd89890..493f044f 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculatorClipboard.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculatorClipboard.java @@ -3,7 +3,7 @@ package org.solovyev.android.calculator; import android.app.Application; import android.content.Context; import android.text.ClipboardManager; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; /** * User: serso @@ -12,10 +12,10 @@ import org.jetbrains.annotations.NotNull; */ public class AndroidCalculatorClipboard implements CalculatorClipboard { - @NotNull + @Nonnull private final Context context; - public AndroidCalculatorClipboard(@NotNull Application application) { + public AndroidCalculatorClipboard(@Nonnull Application application) { this.context = application; } @@ -30,13 +30,13 @@ public class AndroidCalculatorClipboard implements CalculatorClipboard { } @Override - public void setText(@NotNull String text) { + public void setText(@Nonnull String text) { final ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); clipboard.setText(text); } @Override - public void setText(@NotNull CharSequence text) { + public void setText(@Nonnull CharSequence text) { final ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); clipboard.setText(text); } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculatorKeyboard.java b/android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculatorKeyboard.java index 1f436caf..dfe030ec 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculatorKeyboard.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculatorKeyboard.java @@ -6,8 +6,8 @@ import android.content.Context; import android.content.SharedPreferences; import android.os.Vibrator; import android.preference.PreferenceManager; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.view.VibratorContainer; /** @@ -17,16 +17,16 @@ import org.solovyev.android.view.VibratorContainer; */ public class AndroidCalculatorKeyboard implements CalculatorKeyboard { - @NotNull + @Nonnull private final CalculatorKeyboard calculatorKeyboard; - @NotNull + @Nonnull private final Context context; private VibratorContainer vibrator; - public AndroidCalculatorKeyboard(@NotNull Application application, - @NotNull CalculatorKeyboard calculatorKeyboard) { + public AndroidCalculatorKeyboard(@Nonnull Application application, + @Nonnull CalculatorKeyboard calculatorKeyboard) { this.context = application; this.calculatorKeyboard = calculatorKeyboard; } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculatorLogger.java b/android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculatorLogger.java index e9cdbf8d..7f227e1f 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculatorLogger.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculatorLogger.java @@ -1,8 +1,8 @@ package org.solovyev.android.calculator; import android.util.Log; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; /** * User: serso @@ -11,26 +11,26 @@ import org.jetbrains.annotations.Nullable; */ public class AndroidCalculatorLogger implements CalculatorLogger { - @NotNull + @Nonnull private static final String TAG = "Calculatorpp"; @Override - public void debug(@Nullable String tag, @NotNull String message) { + public void debug(@Nullable String tag, @Nonnull String message) { Log.d(getTag(tag), message); } - @NotNull + @Nonnull private String getTag(@Nullable String tag) { return tag != null ? TAG + "/" + tag : TAG; } @Override - public void debug(@Nullable String tag, @Nullable String message, @NotNull Throwable e) { + public void debug(@Nullable String tag, @Nullable String message, @Nonnull Throwable e) { Log.d(getTag(tag), message, e); } @Override - public void error(@Nullable String tag, @Nullable String message, @NotNull Throwable e) { + public void error(@Nullable String tag, @Nullable String message, @Nonnull Throwable e) { Log.e(getTag(tag), message, e); } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculatorNotifier.java b/android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculatorNotifier.java index 49bf3561..ffcdd8dc 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculatorNotifier.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculatorNotifier.java @@ -3,8 +3,8 @@ package org.solovyev.android.calculator; import android.app.Application; import android.os.Handler; import android.widget.Toast; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.Threads; import org.solovyev.android.msg.AndroidMessage; import org.solovyev.common.msg.Message; @@ -19,19 +19,19 @@ import java.util.List; */ public class AndroidCalculatorNotifier implements CalculatorNotifier { - @NotNull + @Nonnull private final Application application; - @NotNull + @Nonnull private final Handler uiHandler = new Handler(); private final boolean showDebugMessages; - public AndroidCalculatorNotifier(@NotNull Application application) { + public AndroidCalculatorNotifier(@Nonnull Application application) { this(application, false); } - public AndroidCalculatorNotifier(@NotNull Application application, boolean showDebugMessages) { + public AndroidCalculatorNotifier(@Nonnull Application application, boolean showDebugMessages) { assert Threads.isUiThread(); this.application = application; @@ -39,28 +39,28 @@ public class AndroidCalculatorNotifier implements CalculatorNotifier { } @Override - public void showMessage(@NotNull Message message) { + public void showMessage(@Nonnull Message message) { showMessageInUiThread(message.getLocalizedMessage()); } @Override - public void showMessage(@NotNull Integer messageCode, @NotNull MessageType messageType, @NotNull List parameters) { + public void showMessage(@Nonnull Integer messageCode, @Nonnull MessageType messageType, @Nonnull List parameters) { showMessage(new AndroidMessage(messageCode, messageType, application, parameters)); } @Override - public void showMessage(@NotNull Integer messageCode, @NotNull MessageType messageType, @Nullable Object... parameters) { + public void showMessage(@Nonnull Integer messageCode, @Nonnull MessageType messageType, @Nullable Object... parameters) { showMessage(new AndroidMessage(messageCode, messageType, application, parameters)); } @Override - public void showDebugMessage(@Nullable final String tag, @NotNull final String message) { + public void showDebugMessage(@Nullable final String tag, @Nonnull final String message) { if (showDebugMessages) { showMessageInUiThread(tag == null ? message : tag + ": " + message); } } - private void showMessageInUiThread(@NotNull final String message) { + private void showMessageInUiThread(@Nonnull final String message) { if (Threads.isUiThread()) { Toast.makeText(application, message, Toast.LENGTH_SHORT).show(); } else { diff --git a/android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculatorPreferenceService.java b/android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculatorPreferenceService.java index 39c64dce..509ee3b2 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculatorPreferenceService.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculatorPreferenceService.java @@ -5,7 +5,7 @@ import android.content.SharedPreferences; import android.preference.PreferenceManager; import jscl.AngleUnit; import jscl.NumeralBase; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.calculator.model.AndroidCalculatorEngine; import org.solovyev.android.msg.AndroidMessage; import org.solovyev.common.msg.MessageType; @@ -23,10 +23,10 @@ public class AndroidCalculatorPreferenceService implements CalculatorPreferenceS // one hour private static final Long PREFERRED_PREFS_INTERVAL_TIME = 1000L * 60L * 60L; - @NotNull + @Nonnull private final Application application; - public AndroidCalculatorPreferenceService(@NotNull Application application) { + public AndroidCalculatorPreferenceService(@Nonnull Application application) { this.application = application; } @@ -58,7 +58,7 @@ public class AndroidCalculatorPreferenceService implements CalculatorPreferenceS } } - private boolean isTimeForCheck(@NotNull Long currentTime, @NotNull SharedPreferences preferences) { + private boolean isTimeForCheck(@Nonnull Long currentTime, @Nonnull SharedPreferences preferences) { final Long lastPreferredPreferencesCheckTime = CalculatorPreferences.Calculations.lastPreferredPreferencesCheck.getPreference(preferences); return currentTime - lastPreferredPreferencesCheckTime > PREFERRED_PREFS_INTERVAL_TIME; @@ -71,7 +71,7 @@ public class AndroidCalculatorPreferenceService implements CalculatorPreferenceS } @Override - public void setAngleUnits(@NotNull AngleUnit angleUnit) { + public void setAngleUnits(@Nonnull AngleUnit angleUnit) { final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(application); AndroidCalculatorEngine.Preferences.angleUnit.putPreference(preferences, angleUnit); @@ -85,7 +85,7 @@ public class AndroidCalculatorPreferenceService implements CalculatorPreferenceS } @Override - public void setNumeralBase(@NotNull NumeralBase numeralBase) { + public void setNumeralBase(@Nonnull NumeralBase numeralBase) { final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(application); AndroidCalculatorEngine.Preferences.numeralBase.putPreference(preferences, numeralBase); diff --git a/android-app/src/main/java/org/solovyev/android/calculator/AndroidFunctionCategory.java b/android-app/src/main/java/org/solovyev/android/calculator/AndroidFunctionCategory.java index 4b752004..ef1ef2b2 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/AndroidFunctionCategory.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/AndroidFunctionCategory.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; /** * User: serso @@ -27,7 +27,7 @@ public enum AndroidFunctionCategory { } @Nullable - public static AndroidFunctionCategory valueOf(@NotNull FunctionCategory functionCategory) { + public static AndroidFunctionCategory valueOf(@Nonnull FunctionCategory functionCategory) { for (AndroidFunctionCategory androidFunctionCategory : values()) { if (androidFunctionCategory.name().equals(functionCategory.name())) { return androidFunctionCategory; diff --git a/android-app/src/main/java/org/solovyev/android/calculator/AndroidNumeralBase.java b/android-app/src/main/java/org/solovyev/android/calculator/AndroidNumeralBase.java index 2361fcb2..919a87cd 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/AndroidNumeralBase.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/AndroidNumeralBase.java @@ -2,7 +2,7 @@ package org.solovyev.android.calculator; import android.app.Activity; import jscl.NumeralBase; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.calculator.units.CalculatorNumeralBase; import org.solovyev.android.view.drag.DirectionDragButton; import org.solovyev.android.view.drag.DragDirection; @@ -19,7 +19,7 @@ import java.util.List; public enum AndroidNumeralBase { bin(CalculatorNumeralBase.bin) { - @NotNull + @Nonnull @Override public List getButtonIds() { return Arrays.asList(R.id.cpp_button_0, R.id.cpp_button_1); @@ -27,7 +27,7 @@ public enum AndroidNumeralBase { }, oct(CalculatorNumeralBase.oct) { - @NotNull + @Nonnull @Override public List getButtonIds() { final List result = new ArrayList(bin.getButtonIds()); @@ -37,7 +37,7 @@ public enum AndroidNumeralBase { }, dec(CalculatorNumeralBase.dec) { - @NotNull + @Nonnull @Override public List getButtonIds() { final List result = new ArrayList(oct.getButtonIds()); @@ -48,17 +48,17 @@ public enum AndroidNumeralBase { hex(CalculatorNumeralBase.hex) { - @NotNull + @Nonnull private List specialHexButtonIds = Arrays.asList(R.id.cpp_button_1, R.id.cpp_button_2, R.id.cpp_button_3, R.id.cpp_button_4, R.id.cpp_button_5, R.id.cpp_button_6); - @NotNull + @Nonnull @Override public List getButtonIds() { return dec.getButtonIds(); } @Override - protected void toggleButton(boolean show, @NotNull DirectionDragButton button) { + protected void toggleButton(boolean show, @Nonnull DirectionDragButton button) { super.toggleButton(show, button); if (specialHexButtonIds.contains(button.getId())) { button.showDirectionText(show, DragDirection.left); @@ -67,17 +67,17 @@ public enum AndroidNumeralBase { } }; - @NotNull + @Nonnull private final CalculatorNumeralBase calculatorNumeralBase; - private AndroidNumeralBase(@NotNull CalculatorNumeralBase calculatorNumeralBase) { + private AndroidNumeralBase(@Nonnull CalculatorNumeralBase calculatorNumeralBase) { this.calculatorNumeralBase = calculatorNumeralBase; } - @NotNull + @Nonnull public abstract List getButtonIds(); - public void toggleButtons(boolean show, @NotNull Activity activity) { + public void toggleButtons(boolean show, @Nonnull Activity activity) { for (Integer buttonId : getButtonIds()) { final DirectionDragButton button = (DirectionDragButton) activity.findViewById(buttonId); if (button != null) { @@ -86,18 +86,18 @@ public enum AndroidNumeralBase { } } - protected void toggleButton(boolean show, @NotNull DirectionDragButton button) { + protected void toggleButton(boolean show, @Nonnull DirectionDragButton button) { button.setShowText(show); button.invalidate(); } - @NotNull + @Nonnull public NumeralBase getNumeralBase() { return calculatorNumeralBase.getNumeralBase(); } - @NotNull - public static AndroidNumeralBase valueOf(@NotNull NumeralBase nb) { + @Nonnull + public static AndroidNumeralBase valueOf(@Nonnull NumeralBase nb) { for (AndroidNumeralBase androidNumeralBase : values()) { if (androidNumeralBase.calculatorNumeralBase.getNumeralBase() == nb) { return androidNumeralBase; diff --git a/android-app/src/main/java/org/solovyev/android/calculator/AndroidOperatorCategory.java b/android-app/src/main/java/org/solovyev/android/calculator/AndroidOperatorCategory.java index ec33ae36..4a111950 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/AndroidOperatorCategory.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/AndroidOperatorCategory.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; /** * User: serso @@ -26,7 +26,7 @@ public enum AndroidOperatorCategory { } @Nullable - public static AndroidOperatorCategory valueOf(@NotNull OperatorCategory operatorCategory) { + public static AndroidOperatorCategory valueOf(@Nonnull OperatorCategory operatorCategory) { for (AndroidOperatorCategory androidOperatorCategory : values()) { if (androidOperatorCategory.name().equals(operatorCategory.name())) { return androidOperatorCategory; diff --git a/android-app/src/main/java/org/solovyev/android/calculator/AndroidVarCategory.java b/android-app/src/main/java/org/solovyev/android/calculator/AndroidVarCategory.java index 6ece06f5..d163cbc2 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/AndroidVarCategory.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/AndroidVarCategory.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; /** * User: serso @@ -24,7 +24,7 @@ public enum AndroidVarCategory { } @Nullable - public static AndroidVarCategory valueOf(@NotNull VarCategory varCategory) { + public static AndroidVarCategory valueOf(@Nonnull VarCategory varCategory) { for (AndroidVarCategory androidVarCategory : values()) { if (androidVarCategory.name().equals(varCategory.name())) { return androidVarCategory; diff --git a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java index ce1abe82..716a4202 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java @@ -21,8 +21,8 @@ import android.widget.Button; import android.widget.TextView; import com.actionbarsherlock.app.ActionBar; import com.actionbarsherlock.app.SherlockFragmentActivity; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.Activities; import org.solovyev.android.Android; import org.solovyev.android.Threads; @@ -36,12 +36,12 @@ import org.solovyev.common.text.Strings; public class CalculatorActivity extends SherlockFragmentActivity implements SharedPreferences.OnSharedPreferenceChangeListener, CalculatorEventListener { - @NotNull + @Nonnull public static final String TAG = CalculatorActivity.class.getSimpleName(); private boolean useBackAsPrev; - @NotNull + @Nonnull private CalculatorActivityHelper activityHelper; /** @@ -96,12 +96,12 @@ public class CalculatorActivity extends SherlockFragmentActivity implements Shar return findViewById(R.id.main_second_pane) != null; } - @NotNull + @Nonnull private AndroidCalculator getCalculator() { return ((AndroidCalculator) Locator.getInstance().getCalculator()); } - private static void firstTimeInit(@NotNull SharedPreferences preferences, @NotNull Context context) { + private static void firstTimeInit(@Nonnull SharedPreferences preferences, @Nonnull Context context) { final Integer appOpenedCounter = CalculatorPreferences.appOpenedCounter.getPreference(preferences); if (appOpenedCounter != null) { CalculatorPreferences.appOpenedCounter.putPreference(preferences, appOpenedCounter + 1); @@ -149,7 +149,7 @@ public class CalculatorActivity extends SherlockFragmentActivity implements Shar } } - private static boolean showSpecialWindow(@NotNull SharedPreferences preferences, @NotNull Preference specialWindowShownPref, int layoutId, int textViewId, @NotNull Context context) { + private static boolean showSpecialWindow(@Nonnull SharedPreferences preferences, @Nonnull Preference specialWindowShownPref, int layoutId, int textViewId, @Nonnull Context context) { boolean result = false; final Boolean specialWindowShown = specialWindowShownPref.getPreference(preferences); @@ -183,7 +183,7 @@ public class CalculatorActivity extends SherlockFragmentActivity implements Shar } @SuppressWarnings({"UnusedDeclaration"}) - public void equalsButtonClickHandler(@NotNull View v) { + public void equalsButtonClickHandler(@Nonnull View v) { buttonPressed(CalculatorSpecialButton.equals); } @@ -252,47 +252,47 @@ public class CalculatorActivity extends SherlockFragmentActivity implements Shar */ @SuppressWarnings({"UnusedDeclaration"}) - public void elementaryButtonClickHandler(@NotNull View v) { + public void elementaryButtonClickHandler(@Nonnull View v) { throw new UnsupportedOperationException("Not implemented yet!"); } @SuppressWarnings({"UnusedDeclaration"}) - public void historyButtonClickHandler(@NotNull View v) { + public void historyButtonClickHandler(@Nonnull View v) { buttonPressed(CalculatorSpecialButton.history); } @SuppressWarnings({"UnusedDeclaration"}) - public void eraseButtonClickHandler(@NotNull View v) { + public void eraseButtonClickHandler(@Nonnull View v) { buttonPressed(CalculatorSpecialButton.erase); } @SuppressWarnings({"UnusedDeclaration"}) - public void simplifyButtonClickHandler(@NotNull View v) { + public void simplifyButtonClickHandler(@Nonnull View v) { throw new UnsupportedOperationException("Not implemented yet!"); } @SuppressWarnings({"UnusedDeclaration"}) - public void pasteButtonClickHandler(@NotNull View v) { + public void pasteButtonClickHandler(@Nonnull View v) { buttonPressed(CalculatorSpecialButton.paste); } @SuppressWarnings({"UnusedDeclaration"}) - public void copyButtonClickHandler(@NotNull View v) { + public void copyButtonClickHandler(@Nonnull View v) { buttonPressed(CalculatorSpecialButton.copy); } - @NotNull + @Nonnull private static CalculatorKeyboard getKeyboard() { return Locator.getInstance().getKeyboard(); } @SuppressWarnings({"UnusedDeclaration"}) - public void clearButtonClickHandler(@NotNull View v) { + public void clearButtonClickHandler(@Nonnull View v) { buttonPressed(CalculatorSpecialButton.clear); } @SuppressWarnings({"UnusedDeclaration"}) - public void digitButtonClickHandler(@NotNull View v) { + public void digitButtonClickHandler(@Nonnull View v) { Log.d(String.valueOf(v.getId()), "digitButtonClickHandler() for: " + v.getId() + ". Pressed: " + v.isPressed()); if (v instanceof Button) { @@ -300,36 +300,36 @@ public class CalculatorActivity extends SherlockFragmentActivity implements Shar } } - private void buttonPressed(@NotNull CalculatorSpecialButton button) { + private void buttonPressed(@Nonnull CalculatorSpecialButton button) { buttonPressed(button.getActionCode()); } - private void buttonPressed(@NotNull String text) { + private void buttonPressed(@Nonnull String text) { getKeyboard().buttonPressed(text); } @SuppressWarnings({"UnusedDeclaration"}) - public void functionsButtonClickHandler(@NotNull View v) { + public void functionsButtonClickHandler(@Nonnull View v) { buttonPressed(CalculatorSpecialButton.functions); } @SuppressWarnings({"UnusedDeclaration"}) - public void operatorsButtonClickHandler(@NotNull View v) { + public void operatorsButtonClickHandler(@Nonnull View v) { buttonPressed(CalculatorSpecialButton.operators); } @SuppressWarnings({"UnusedDeclaration"}) - public void varsButtonClickHandler(@NotNull View v) { + public void varsButtonClickHandler(@Nonnull View v) { buttonPressed(CalculatorSpecialButton.vars); } @SuppressWarnings({"UnusedDeclaration"}) - public void likeButtonClickHandler(@NotNull View v) { + public void likeButtonClickHandler(@Nonnull View v) { buttonPressed(CalculatorSpecialButton.like); } @Override - public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) { + public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) { switch (calculatorEventType) { case plot_graph: Threads.tryRunOnUiThread(this, new Runnable() { diff --git a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorActivityHelper.java b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorActivityHelper.java index 41b4104b..d6257aec 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorActivityHelper.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorActivityHelper.java @@ -5,8 +5,8 @@ import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.View; import com.actionbarsherlock.app.SherlockFragmentActivity; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; /** * User: serso @@ -15,57 +15,57 @@ import org.jetbrains.annotations.Nullable; */ public interface CalculatorActivityHelper { - void onCreate(@NotNull SherlockFragmentActivity activity, @Nullable Bundle savedInstanceState); + void onCreate(@Nonnull SherlockFragmentActivity activity, @Nullable Bundle savedInstanceState); - void onCreate(@NotNull Activity activity, @Nullable Bundle savedInstanceState); + void onCreate(@Nonnull Activity activity, @Nullable Bundle savedInstanceState); - void onSaveInstanceState(@NotNull SherlockFragmentActivity activity, @NotNull Bundle outState); + void onSaveInstanceState(@Nonnull SherlockFragmentActivity activity, @Nonnull Bundle outState); - void onSaveInstanceState(@NotNull Activity activity, @NotNull Bundle outState); + void onSaveInstanceState(@Nonnull Activity activity, @Nonnull Bundle outState); int getLayoutId(); - @NotNull + @Nonnull CalculatorPreferences.Gui.Theme getTheme(); - @NotNull + @Nonnull CalculatorPreferences.Gui.Layout getLayout(); - void onResume(@NotNull SherlockFragmentActivity activity); + void onResume(@Nonnull SherlockFragmentActivity activity); - void onResume(@NotNull Activity activity); + void onResume(@Nonnull Activity activity); - void onPause(@NotNull Activity activity); + void onPause(@Nonnull Activity activity); - void onPause(@NotNull SherlockFragmentActivity activity); + void onPause(@Nonnull SherlockFragmentActivity activity); - void onDestroy(@NotNull SherlockFragmentActivity activity); + void onDestroy(@Nonnull SherlockFragmentActivity activity); - void onDestroy(@NotNull Activity activity); + void onDestroy(@Nonnull Activity activity); - void addTab(@NotNull SherlockFragmentActivity activity, - @NotNull String tag, - @NotNull Class fragmentClass, + void addTab(@Nonnull SherlockFragmentActivity activity, + @Nonnull String tag, + @Nonnull Class fragmentClass, @Nullable Bundle fragmentArgs, int captionResId, int parentViewId); - void addTab(@NotNull SherlockFragmentActivity activity, - @NotNull CalculatorFragmentType fragmentType, + void addTab(@Nonnull SherlockFragmentActivity activity, + @Nonnull CalculatorFragmentType fragmentType, @Nullable Bundle fragmentArgs, int parentViewId); - void setFragment(@NotNull SherlockFragmentActivity activity, - @NotNull CalculatorFragmentType fragmentType, + void setFragment(@Nonnull SherlockFragmentActivity activity, + @Nonnull CalculatorFragmentType fragmentType, @Nullable Bundle fragmentArgs, int parentViewId); - void logDebug(@NotNull String message); + void logDebug(@Nonnull String message); - void processButtons(@NotNull Activity activity, @NotNull View root); + void processButtons(@Nonnull Activity activity, @Nonnull View root); - void logError(@NotNull String message); + void logError(@Nonnull String message); - void selectTab(@NotNull SherlockFragmentActivity activity, @NotNull CalculatorFragmentType fragmentType); + void selectTab(@Nonnull SherlockFragmentActivity activity, @Nonnull CalculatorFragmentType fragmentType); } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorActivityHelperImpl.java b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorActivityHelperImpl.java index 6e2c7673..690e8203 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorActivityHelperImpl.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorActivityHelperImpl.java @@ -16,8 +16,8 @@ import android.view.ViewGroup; import android.widget.TextView; import com.actionbarsherlock.app.ActionBar; import com.actionbarsherlock.app.SherlockFragmentActivity; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.Activities; import org.solovyev.android.Views; import org.solovyev.android.sherlock.tabs.ActionBarFragmentTabListener; @@ -49,15 +49,15 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple private boolean homeIcon = false; - @NotNull + @Nonnull private CalculatorPreferences.Gui.Theme theme; - @NotNull + @Nonnull private CalculatorPreferences.Gui.Layout layout; private int selectedNavigationIndex = 0; - public CalculatorActivityHelperImpl(int layoutId, @NotNull String logTag) { + public CalculatorActivityHelperImpl(int layoutId, @Nonnull String logTag) { super(logTag); this.layoutId = layoutId; } @@ -68,7 +68,7 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple } @Override - public void onCreate(@NotNull Activity activity, @Nullable Bundle savedInstanceState) { + public void onCreate(@Nonnull Activity activity, @Nullable Bundle savedInstanceState) { super.onCreate(activity); if (activity instanceof CalculatorEventListener) { @@ -94,7 +94,7 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple } @Override - public void onCreate(@NotNull final SherlockFragmentActivity activity, @Nullable Bundle savedInstanceState) { + public void onCreate(@Nonnull final SherlockFragmentActivity activity, @Nullable Bundle savedInstanceState) { this.onCreate((Activity) activity, savedInstanceState); final ActionBar actionBar = activity.getSupportActionBar(); @@ -109,7 +109,7 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); } - private void toggleTitle(@NotNull SherlockFragmentActivity activity, boolean showTitle) { + private void toggleTitle(@Nonnull SherlockFragmentActivity activity, boolean showTitle) { final ActionBar actionBar = activity.getSupportActionBar(); if (activity instanceof CalculatorActivity) { @@ -123,7 +123,7 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple } } - public void restoreSavedTab(@NotNull SherlockFragmentActivity activity) { + public void restoreSavedTab(@Nonnull SherlockFragmentActivity activity) { final ActionBar actionBar = activity.getSupportActionBar(); if (selectedNavigationIndex >= 0 && selectedNavigationIndex < actionBar.getTabCount()) { actionBar.setSelectedNavigationItem(selectedNavigationIndex); @@ -131,16 +131,16 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple } @Override - public void onSaveInstanceState(@NotNull SherlockFragmentActivity activity, @NotNull Bundle outState) { + public void onSaveInstanceState(@Nonnull SherlockFragmentActivity activity, @Nonnull Bundle outState) { onSaveInstanceState((Activity) activity, outState); } @Override - public void onSaveInstanceState(@NotNull Activity activity, @NotNull Bundle outState) { + public void onSaveInstanceState(@Nonnull Activity activity, @Nonnull Bundle outState) { } @Override - public void onResume(@NotNull Activity activity) { + public void onResume(@Nonnull Activity activity) { final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity); final CalculatorPreferences.Gui.Theme newTheme = CalculatorPreferences.Gui.theme.getPreference(preferences); @@ -150,11 +150,11 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple } @Override - public void onPause(@NotNull Activity activity) { + public void onPause(@Nonnull Activity activity) { } @Override - public void onPause(@NotNull SherlockFragmentActivity activity) { + public void onPause(@Nonnull SherlockFragmentActivity activity) { onPause((Activity) activity); final int selectedNavigationIndex = activity.getSupportActionBar().getSelectedNavigationIndex(); @@ -167,13 +167,13 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple } - @NotNull - private String getSavedTabPreferenceName(@NotNull Activity activity) { + @Nonnull + private String getSavedTabPreferenceName(@Nonnull Activity activity) { return "tab_" + activity.getClass().getSimpleName(); } @Override - public void onDestroy(@NotNull Activity activity) { + public void onDestroy(@Nonnull Activity activity) { super.onDestroy(activity); if (activity instanceof CalculatorEventListener) { @@ -182,14 +182,14 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple } @Override - public void onDestroy(@NotNull SherlockFragmentActivity activity) { + public void onDestroy(@Nonnull SherlockFragmentActivity activity) { this.onDestroy((Activity) activity); } @Override - public void addTab(@NotNull SherlockFragmentActivity activity, - @NotNull String tag, - @NotNull Class fragmentClass, + public void addTab(@Nonnull SherlockFragmentActivity activity, + @Nonnull String tag, + @Nonnull Class fragmentClass, @Nullable Bundle fragmentArgs, int captionResId, int parentViewId) { @@ -205,12 +205,12 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple } @Override - public void addTab(@NotNull SherlockFragmentActivity activity, @NotNull CalculatorFragmentType fragmentType, @Nullable Bundle fragmentArgs, int parentViewId) { + public void addTab(@Nonnull SherlockFragmentActivity activity, @Nonnull CalculatorFragmentType fragmentType, @Nullable Bundle fragmentArgs, int parentViewId) { addTab(activity, fragmentType.getFragmentTag(), fragmentType.getFragmentClass(), fragmentArgs, fragmentType.getDefaultTitleResId(), parentViewId); } @Override - public void setFragment(@NotNull SherlockFragmentActivity activity, @NotNull CalculatorFragmentType fragmentType, @Nullable Bundle fragmentArgs, int parentViewId) { + public void setFragment(@Nonnull SherlockFragmentActivity activity, @Nonnull CalculatorFragmentType fragmentType, @Nullable Bundle fragmentArgs, int parentViewId) { final FragmentManager fm = activity.getSupportFragmentManager(); Fragment fragment = fm.findFragmentByTag(fragmentType.getFragmentTag()); @@ -230,7 +230,7 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple } @Override - public void selectTab(@NotNull SherlockFragmentActivity activity, @NotNull CalculatorFragmentType fragmentType) { + public void selectTab(@Nonnull SherlockFragmentActivity activity, @Nonnull CalculatorFragmentType fragmentType) { final ActionBar actionBar = activity.getSupportActionBar(); for (int i = 0; i < actionBar.getTabCount(); i++) { final ActionBar.Tab tab = actionBar.getTabAt(i); @@ -247,19 +247,19 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple } @Override - @NotNull + @Nonnull public CalculatorPreferences.Gui.Theme getTheme() { return theme; } @Override - @NotNull + @Nonnull public CalculatorPreferences.Gui.Layout getLayout() { return layout; } @Override - public void onResume(@NotNull SherlockFragmentActivity activity) { + public void onResume(@Nonnull SherlockFragmentActivity activity) { onResume((Activity) activity); final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity); @@ -267,7 +267,7 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple restoreSavedTab(activity); } - private void addHelpInfo(@NotNull Activity activity, @NotNull View root) { + private void addHelpInfo(@Nonnull Activity activity, @Nonnull View root) { if (CalculatorApplication.isMonkeyRunner(activity)) { if (root instanceof ViewGroup) { final TextView helperTextView = new TextView(activity); diff --git a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorActivityLauncher.java b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorActivityLauncher.java index 3dc3cacd..c653cfcc 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorActivityLauncher.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorActivityLauncher.java @@ -12,8 +12,8 @@ import android.view.View; import android.widget.TextView; import com.actionbarsherlock.app.SherlockFragmentActivity; import jscl.math.Generic; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.Android; import org.solovyev.android.App; import org.solovyev.android.calculator.about.CalculatorAboutActivity; @@ -41,72 +41,72 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener public CalculatorActivityLauncher() { } - public static void showHistory(@NotNull final Context context) { + public static void showHistory(@Nonnull final Context context) { showHistory(context, false); } - public static void showHistory(@NotNull final Context context, boolean detached) { + public static void showHistory(@Nonnull final Context context, boolean detached) { final Intent intent = new Intent(context, CalculatorHistoryActivity.class); Android.addIntentFlags(intent, detached, context); context.startActivity(intent); } - public static void showHelp(@NotNull final Context context) { + public static void showHelp(@Nonnull final Context context) { context.startActivity(new Intent(context, CalculatorHelpActivity.class)); } - public static void showSettings(@NotNull final Context context) { + public static void showSettings(@Nonnull final Context context) { showSettings(context, false); } - public static void showSettings(@NotNull final Context context, boolean detached) { + public static void showSettings(@Nonnull final Context context, boolean detached) { final Intent intent = new Intent(context, CalculatorPreferencesActivity.class); Android.addIntentFlags(intent, detached, context); context.startActivity(intent); } - public static void showAbout(@NotNull final Context context) { + public static void showAbout(@Nonnull final Context context) { context.startActivity(new Intent(context, CalculatorAboutActivity.class)); } - public static void showFunctions(@NotNull final Context context) { + public static void showFunctions(@Nonnull final Context context) { showFunctions(context, false); } - public static void showFunctions(@NotNull final Context context, boolean detached) { + public static void showFunctions(@Nonnull final Context context, boolean detached) { final Intent intent = new Intent(context, CalculatorFunctionsActivity.class); Android.addIntentFlags(intent, detached, context); context.startActivity(intent); } - public static void showOperators(@NotNull final Context context) { + public static void showOperators(@Nonnull final Context context) { showOperators(context, false); } - public static void showOperators(@NotNull final Context context, boolean detached) { + public static void showOperators(@Nonnull final Context context, boolean detached) { final Intent intent = new Intent(context, CalculatorOperatorsActivity.class); Android.addIntentFlags(intent, detached, context); context.startActivity(intent); } - public static void showVars(@NotNull final Context context) { + public static void showVars(@Nonnull final Context context) { showVars(context, false); } - public static void showVars(@NotNull final Context context, boolean detached) { + public static void showVars(@Nonnull final Context context, boolean detached) { final Intent intent = new Intent(context, CalculatorVarsActivity.class); Android.addIntentFlags(intent, detached, context); context.startActivity(intent); } - public static void plotGraph(@NotNull final Context context) { + public static void plotGraph(@Nonnull final Context context) { final Intent intent = new Intent(); intent.setClass(context, CalculatorPlotActivity.class); Android.addIntentFlags(intent, false, context); context.startActivity(intent); } - public static void tryCreateVar(@NotNull final Context context) { + public static void tryCreateVar(@Nonnull final Context context) { final CalculatorDisplay display = Locator.getInstance().getDisplay(); final CalculatorDisplayViewState viewState = display.getViewState(); if (viewState.isValid()) { @@ -132,7 +132,7 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener } } - public static void tryCreateFunction(@NotNull final Context context) { + public static void tryCreateFunction(@Nonnull final Context context) { final CalculatorDisplay display = Locator.getInstance().getDisplay(); final CalculatorDisplayViewState viewState = display.getViewState(); @@ -150,7 +150,7 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener } } - @NotNull + @Nonnull private static CalculatorNotifier getNotifier() { return Locator.getInstance().getNotifier(); } @@ -177,19 +177,19 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener } } - public static void openApp(@NotNull Context context) { + public static void openApp(@Nonnull Context context) { final Intent intent = new Intent(context, CalculatorActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); context.startActivity(intent); } - public static void likeButtonPressed(@NotNull final Context context) { + public static void likeButtonPressed(@Nonnull final Context context) { final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(CalculatorApplication.FACEBOOK_APP_URL)); Android.addIntentFlags(intent, false, context); context.startActivity(intent); } - public static void showCalculationMessagesDialog(@NotNull Context context, @NotNull List messages) { + public static void showCalculationMessagesDialog(@Nonnull Context context, @Nonnull List messages) { final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); if (CalculatorPreferences.Calculations.showCalculationMessagesDialog.getPreference(prefs)) { @@ -198,7 +198,7 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener } @Override - public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) { + public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) { final Context context; final Object source = calculatorEventData.getSource(); @@ -261,7 +261,7 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener } } - public static void showEvaluationError(@NotNull Context context, @NotNull final String errorMessage) { + public static void showEvaluationError(@Nonnull Context context, @Nonnull final String errorMessage) { final LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); final View errorMessageView = layoutInflater.inflate(R.layout.display_error_message, null); diff --git a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorActivityMobile.java b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorActivityMobile.java index fbfcd911..73f1aebd 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorActivityMobile.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorActivityMobile.java @@ -3,7 +3,7 @@ package org.solovyev.android.calculator; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nullable; /** * User: serso diff --git a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java index 454a6197..825becc1 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java @@ -12,7 +12,7 @@ import net.robotmedia.billing.model.BillingDB; import org.acra.ACRA; import org.acra.ReportingInteractionMode; import org.acra.annotation.ReportsCrashes; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.Android; import org.solovyev.android.App; import org.solovyev.android.ServiceLocator; @@ -59,7 +59,7 @@ public class CalculatorApplication extends android.app.Application implements Sh public static final String ADMOB_USER_ID = "a14f02cf9c80cbc"; - @NotNull + @Nonnull private static CalculatorApplication instance; /* @@ -70,10 +70,10 @@ public class CalculatorApplication extends android.app.Application implements Sh ********************************************************************** */ - @NotNull + @Nonnull private final List listeners = new ArrayList(); - @NotNull + @Nonnull protected final Handler uiHandler = new Handler(); /* @@ -171,32 +171,32 @@ public class CalculatorApplication extends android.app.Application implements Sh Locator.getInstance().getNotifier().showDebugMessage(TAG, "Application started!"); } - private void setTheme(@NotNull SharedPreferences preferences) { + private void setTheme(@Nonnull SharedPreferences preferences) { final CalculatorPreferences.Gui.Theme theme = CalculatorPreferences.Gui.getTheme(preferences); setTheme(theme.getThemeId()); } - @NotNull - public CalculatorActivityHelper createActivityHelper(int layoutResId, @NotNull String logTag) { + @Nonnull + public CalculatorActivityHelper createActivityHelper(int layoutResId, @Nonnull String logTag) { return new CalculatorActivityHelperImpl(layoutResId, logTag); } - @NotNull + @Nonnull public CalculatorFragmentHelper createFragmentHelper(int layoutId) { return new CalculatorFragmentHelperImpl(layoutId); } - @NotNull + @Nonnull public CalculatorFragmentHelper createFragmentHelper(int layoutId, int titleResId) { return new CalculatorFragmentHelperImpl(layoutId, titleResId); } - @NotNull + @Nonnull public CalculatorFragmentHelper createFragmentHelper(int layoutId, int titleResId, boolean listenersOnCreate) { return new CalculatorFragmentHelperImpl(layoutId, titleResId, listenersOnCreate); } - @NotNull + @Nonnull public Handler getUiHandler() { return uiHandler; } @@ -209,12 +209,12 @@ public class CalculatorApplication extends android.app.Application implements Sh ********************************************************************** */ - @NotNull + @Nonnull public static CalculatorApplication getInstance() { return instance; } - public static boolean isMonkeyRunner(@NotNull Context context) { + public static boolean isMonkeyRunner(@Nonnull Context context) { // NOTE: this code is only for monkeyrunner return context.checkCallingOrSelfPermission(android.Manifest.permission.DISABLE_KEYGUARD) == PackageManager.PERMISSION_GRANTED; } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorDialogActivity.java b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorDialogActivity.java index 1d43b458..8b3a857b 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorDialogActivity.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorDialogActivity.java @@ -9,8 +9,8 @@ import android.view.View; import android.widget.Button; import android.widget.TextView; import com.actionbarsherlock.app.SherlockFragmentActivity; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.Android; import org.solovyev.android.fragments.FragmentUtils; import org.solovyev.common.msg.MessageType; @@ -23,13 +23,13 @@ import org.solovyev.common.text.Strings; */ public class CalculatorDialogActivity extends SherlockFragmentActivity { - @NotNull + @Nonnull private static final String TAG = CalculatorDialogActivity.class.getSimpleName(); - @NotNull + @Nonnull private static final String DIALOG_DATA_EXTRA = "dialog_data"; - public static void showDialog(@NotNull Context context, @NotNull DialogData dialogData) { + public static void showDialog(@Nonnull Context context, @Nonnull DialogData dialogData) { final Intent intent = new Intent(); intent.setClass(context, CalculatorDialogActivity.class); intent.putExtra(DIALOG_DATA_EXTRA, ParcelableDialogData.wrap(dialogData)); @@ -91,7 +91,7 @@ public class CalculatorDialogActivity extends SherlockFragmentActivity { } @Override - public void onViewCreated(@NotNull View root, Bundle savedInstanceState) { + public void onViewCreated(@Nonnull View root, Bundle savedInstanceState) { super.onViewCreated(root, savedInstanceState); final DialogData dialogData = readDialogData(getArguments()); diff --git a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorDisplayFragment.java b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorDisplayFragment.java index d0d56dc2..07294898 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorDisplayFragment.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorDisplayFragment.java @@ -7,7 +7,7 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.actionbarsherlock.app.SherlockFragment; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; /** * User: Solovyev_S @@ -16,7 +16,7 @@ import org.jetbrains.annotations.NotNull; */ public class CalculatorDisplayFragment extends SherlockFragment { - @NotNull + @Nonnull private CalculatorFragmentHelper fragmentHelper; @Override diff --git a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorEditorFragment.java b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorEditorFragment.java index 183563d0..b22d6f52 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorEditorFragment.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorEditorFragment.java @@ -11,7 +11,7 @@ import com.actionbarsherlock.app.SherlockFragment; import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.MenuInflater; import com.actionbarsherlock.view.MenuItem; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.menu.ActivityMenu; import org.solovyev.android.menu.ListActivityMenu; import org.solovyev.android.sherlock.menu.SherlockMenuHelper; @@ -23,10 +23,10 @@ import org.solovyev.android.sherlock.menu.SherlockMenuHelper; */ public class CalculatorEditorFragment extends SherlockFragment { - @NotNull + @Nonnull private CalculatorFragmentHelper fragmentHelper; - @NotNull + @Nonnull private ActivityMenu menu = ListActivityMenu.fromEnum(CalculatorMenu.class, SherlockMenuHelper.getInstance()); public CalculatorEditorFragment() { diff --git a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorFragment.java b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorFragment.java index 98525161..e9cf5096 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorFragment.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorFragment.java @@ -6,7 +6,7 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.actionbarsherlock.app.SherlockFragment; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; /** * User: Solovyev_S @@ -15,18 +15,18 @@ import org.jetbrains.annotations.NotNull; */ public abstract class CalculatorFragment extends SherlockFragment { - @NotNull + @Nonnull private final CalculatorFragmentHelper fragmentHelper; protected CalculatorFragment(int layoutResId, int titleResId) { fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(layoutResId, titleResId); } - protected CalculatorFragment(@NotNull CalculatorFragmentType fragmentType) { + protected CalculatorFragment(@Nonnull CalculatorFragmentType fragmentType) { fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(fragmentType.getDefaultLayoutId(), fragmentType.getDefaultTitleResId()); } - protected CalculatorFragment(@NotNull CalculatorFragmentHelper fragmentHelper) { + protected CalculatorFragment(@Nonnull CalculatorFragmentHelper fragmentHelper) { this.fragmentHelper = fragmentHelper; } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorFragmentActivity.java b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorFragmentActivity.java index f8405ecc..c9315153 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorFragmentActivity.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorFragmentActivity.java @@ -2,7 +2,7 @@ package org.solovyev.android.calculator; import android.os.Bundle; import com.actionbarsherlock.app.SherlockFragmentActivity; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; /** * User: Solovyev_S @@ -11,7 +11,7 @@ import org.jetbrains.annotations.NotNull; */ public abstract class CalculatorFragmentActivity extends SherlockFragmentActivity { - @NotNull + @Nonnull private final CalculatorActivityHelper activityHelper; protected CalculatorFragmentActivity() { @@ -22,7 +22,7 @@ public abstract class CalculatorFragmentActivity extends SherlockFragmentActivit this.activityHelper = CalculatorApplication.getInstance().createActivityHelper(layoutResId, getClass().getSimpleName()); } - @NotNull + @Nonnull protected CalculatorActivityHelper getActivityHelper() { return activityHelper; } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorFragmentHelper.java b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorFragmentHelper.java index 5f9d681d..6ffa92b1 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorFragmentHelper.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorFragmentHelper.java @@ -4,8 +4,8 @@ import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; /** * User: serso @@ -14,20 +14,20 @@ import org.jetbrains.annotations.Nullable; */ public interface CalculatorFragmentHelper { - boolean isPane(@NotNull Fragment fragment); + boolean isPane(@Nonnull Fragment fragment); - void setPaneTitle(@NotNull Fragment fragment, int titleResId); + void setPaneTitle(@Nonnull Fragment fragment, int titleResId); - void onCreate(@NotNull Fragment fragment); + void onCreate(@Nonnull Fragment fragment); - @NotNull - View onCreateView(@NotNull Fragment fragment, @NotNull LayoutInflater inflater, @Nullable ViewGroup container); + @Nonnull + View onCreateView(@Nonnull Fragment fragment, @Nonnull LayoutInflater inflater, @Nullable ViewGroup container); - void onViewCreated(@NotNull Fragment fragment, @NotNull View root); + void onViewCreated(@Nonnull Fragment fragment, @Nonnull View root); - void onResume(@NotNull Fragment fragment); + void onResume(@Nonnull Fragment fragment); - void onPause(@NotNull Fragment fragment); + void onPause(@Nonnull Fragment fragment); - void onDestroy(@NotNull Fragment fragment); + void onDestroy(@Nonnull Fragment fragment); } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorFragmentHelperImpl.java b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorFragmentHelperImpl.java index a02f305d..ff9c3a2f 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorFragmentHelperImpl.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorFragmentHelperImpl.java @@ -6,8 +6,8 @@ import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.google.ads.AdView; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.ads.AdsController; /** @@ -42,11 +42,11 @@ public class CalculatorFragmentHelperImpl extends AbstractCalculatorHelper imple } @Override - public boolean isPane(@NotNull Fragment fragment) { + public boolean isPane(@Nonnull Fragment fragment) { return fragment.getActivity() instanceof CalculatorActivity; } - public void setPaneTitle(@NotNull Fragment fragment, int titleResId) { + public void setPaneTitle(@Nonnull Fragment fragment, int titleResId) { final TextView fragmentTitle = (TextView) fragment.getView().findViewById(R.id.fragment_title); if (fragmentTitle != null) { if (!isPane(fragment)) { @@ -58,7 +58,7 @@ public class CalculatorFragmentHelperImpl extends AbstractCalculatorHelper imple } @Override - public void onCreate(@NotNull Fragment fragment) { + public void onCreate(@Nonnull Fragment fragment) { super.onCreate(fragment.getActivity()); if (listenersOnCreate) { @@ -69,7 +69,7 @@ public class CalculatorFragmentHelperImpl extends AbstractCalculatorHelper imple } @Override - public void onResume(@NotNull Fragment fragment) { + public void onResume(@Nonnull Fragment fragment) { if (!listenersOnCreate) { if (fragment instanceof CalculatorEventListener) { Locator.getInstance().getCalculator().addCalculatorEventListener((CalculatorEventListener) fragment); @@ -78,7 +78,7 @@ public class CalculatorFragmentHelperImpl extends AbstractCalculatorHelper imple } @Override - public void onPause(@NotNull Fragment fragment) { + public void onPause(@Nonnull Fragment fragment) { if (!listenersOnCreate) { if (fragment instanceof CalculatorEventListener) { Locator.getInstance().getCalculator().removeCalculatorEventListener((CalculatorEventListener) fragment); @@ -87,7 +87,7 @@ public class CalculatorFragmentHelperImpl extends AbstractCalculatorHelper imple } @Override - public void onViewCreated(@NotNull Fragment fragment, @NotNull View root) { + public void onViewCreated(@Nonnull Fragment fragment, @Nonnull View root) { final ViewGroup adParentView = (ViewGroup) root.findViewById(R.id.ad_parent_view); final ViewGroup mainFragmentLayout = (ViewGroup) root.findViewById(R.id.main_fragment_layout); @@ -109,7 +109,7 @@ public class CalculatorFragmentHelperImpl extends AbstractCalculatorHelper imple } @Override - public void onDestroy(@NotNull Fragment fragment) { + public void onDestroy(@Nonnull Fragment fragment) { super.onDestroy(fragment.getActivity()); if (listenersOnCreate) { @@ -123,9 +123,9 @@ public class CalculatorFragmentHelperImpl extends AbstractCalculatorHelper imple } } - @NotNull + @Nonnull @Override - public View onCreateView(@NotNull Fragment fragment, @NotNull LayoutInflater inflater, @Nullable ViewGroup container) { + public View onCreateView(@Nonnull Fragment fragment, @Nonnull LayoutInflater inflater, @Nullable ViewGroup container) { return inflater.inflate(layoutId, container, false); } } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorFragmentType.java b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorFragmentType.java index 30c4e556..cc02ba3e 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorFragmentType.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorFragmentType.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator; import android.support.v4.app.Fragment; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.calculator.about.CalculatorAboutFragment; import org.solovyev.android.calculator.about.CalculatorReleaseNotesFragment; import org.solovyev.android.calculator.help.CalculatorHelpFaqFragment; @@ -51,14 +51,14 @@ public enum CalculatorFragmentType { matrix_edit(CalculatorMatrixEditFragment.class, R.layout.matrix_edit_fragment, R.string.c_screens), release_notes(CalculatorReleaseNotesFragment.class, R.layout.release_notes_fragment, R.string.c_release_notes); - @NotNull + @Nonnull private Class fragmentClass; private final int defaultLayoutId; private int defaultTitleResId; - private CalculatorFragmentType(@NotNull Class fragmentClass, + private CalculatorFragmentType(@Nonnull Class fragmentClass, int defaultLayoutId, int defaultTitleResId) { this.fragmentClass = fragmentClass; @@ -66,7 +66,7 @@ public enum CalculatorFragmentType { this.defaultTitleResId = defaultTitleResId; } - @NotNull + @Nonnull public String getFragmentTag() { return this.name(); } @@ -75,7 +75,7 @@ public enum CalculatorFragmentType { return defaultTitleResId; } - @NotNull + @Nonnull public Class getFragmentClass() { return fragmentClass; } @@ -84,8 +84,8 @@ public enum CalculatorFragmentType { return defaultLayoutId; } - @NotNull - public String createSubFragmentTag(@NotNull String subFragmentTag) { + @Nonnull + public String createSubFragmentTag(@Nonnull String subFragmentTag) { return this.getFragmentTag() + "_" + subFragmentTag; } } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorKeyboardFragment.java b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorKeyboardFragment.java index 61802c03..241e8cb8 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorKeyboardFragment.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorKeyboardFragment.java @@ -7,8 +7,8 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.actionbarsherlock.app.SherlockFragment; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.model.AndroidCalculatorEngine; /** @@ -18,10 +18,10 @@ import org.solovyev.android.calculator.model.AndroidCalculatorEngine; */ public class CalculatorKeyboardFragment extends SherlockFragment implements SharedPreferences.OnSharedPreferenceChangeListener { - @NotNull + @Nonnull private CalculatorPreferences.Gui.Theme theme; - @NotNull + @Nonnull private CalculatorFragmentHelper fragmentHelper; @Override @@ -83,7 +83,7 @@ public class CalculatorKeyboardFragment extends SherlockFragment implements Shar } - /* private static void setMarginsForView(@Nullable View view, int marginLeft, int marginBottom, @NotNull Context context) { + /* private static void setMarginsForView(@Nullable View view, int marginLeft, int marginBottom, @Nonnull Context context) { // IMPORTANT: this is workaround for probably android bug // currently margin values set in styles are not applied for some reasons to the views (using include tag) => set them manually @@ -134,12 +134,12 @@ public class CalculatorKeyboardFragment extends SherlockFragment implements Shar return (AndroidCalculatorDisplayView) Locator.getInstance().getDisplay().getView(); } - @NotNull + @Nonnull private Calculator getCalculator() { return Locator.getInstance().getCalculator(); } - @NotNull + @Nonnull private static CalculatorKeyboard getKeyboard() { return Locator.getInstance().getKeyboard(); } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorListFragment.java b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorListFragment.java index c9bba456..99a40e46 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorListFragment.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorListFragment.java @@ -6,7 +6,7 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.actionbarsherlock.app.SherlockListFragment; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; /** * User: Solovyev_S @@ -15,18 +15,18 @@ import org.jetbrains.annotations.NotNull; */ public abstract class CalculatorListFragment extends SherlockListFragment { - @NotNull + @Nonnull private final CalculatorFragmentHelper fragmentHelper; protected CalculatorListFragment(int layoutResId, int titleResId) { fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(layoutResId, titleResId); } - protected CalculatorListFragment(@NotNull CalculatorFragmentType fragmentType) { + protected CalculatorListFragment(@Nonnull CalculatorFragmentType fragmentType) { fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(fragmentType.getDefaultLayoutId(), fragmentType.getDefaultTitleResId()); } - protected CalculatorListFragment(@NotNull CalculatorFragmentHelper fragmentHelper) { + protected CalculatorListFragment(@Nonnull CalculatorFragmentHelper fragmentHelper) { this.fragmentHelper = fragmentHelper; } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorMenu.java b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorMenu.java index 59873d32..396de494 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorMenu.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorMenu.java @@ -4,7 +4,7 @@ import android.app.Activity; import android.content.Context; import android.util.Log; import com.actionbarsherlock.view.MenuItem; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.calculator.view.NumeralBaseConverterDialog; import org.solovyev.android.menu.LabeledMenuItem; @@ -17,35 +17,35 @@ enum CalculatorMenu implements LabeledMenuItem { settings(R.string.c_settings) { @Override - public void onClick(@NotNull MenuItem data, @NotNull Context context) { + public void onClick(@Nonnull MenuItem data, @Nonnull Context context) { CalculatorActivityLauncher.showSettings(context); } }, history(R.string.c_history) { @Override - public void onClick(@NotNull MenuItem data, @NotNull Context context) { + public void onClick(@Nonnull MenuItem data, @Nonnull Context context) { CalculatorActivityLauncher.showHistory(context); } }, plotter(R.string.cpp_plotter) { @Override - public void onClick(@NotNull MenuItem data, @NotNull Context context) { + public void onClick(@Nonnull MenuItem data, @Nonnull Context context) { Locator.getInstance().getPlotter().plot(); } }, conversion_tool(R.string.c_conversion_tool) { @Override - public void onClick(@NotNull MenuItem data, @NotNull Context context) { + public void onClick(@Nonnull MenuItem data, @Nonnull Context context) { new NumeralBaseConverterDialog(null).show(context); } }, exit(R.string.c_exit) { @Override - public void onClick(@NotNull MenuItem data, @NotNull Context context) { + public void onClick(@Nonnull MenuItem data, @Nonnull Context context) { if (context instanceof Activity) { ((Activity) context).finish(); } else { @@ -56,14 +56,14 @@ enum CalculatorMenu implements LabeledMenuItem { help(R.string.c_help) { @Override - public void onClick(@NotNull MenuItem data, @NotNull Context context) { + public void onClick(@Nonnull MenuItem data, @Nonnull Context context) { CalculatorActivityLauncher.showHelp(context); } }, about(R.string.c_about) { @Override - public void onClick(@NotNull MenuItem data, @NotNull Context context) { + public void onClick(@Nonnull MenuItem data, @Nonnull Context context) { CalculatorActivityLauncher.showAbout(context); } }; @@ -74,9 +74,9 @@ enum CalculatorMenu implements LabeledMenuItem { this.captionResId = captionResId; } - @NotNull + @Nonnull @Override - public String getCaption(@NotNull Context context) { + public String getCaption(@Nonnull Context context) { return context.getString(captionResId); } } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorSecurity.java b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorSecurity.java index 250dcef3..0e3d24b2 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorSecurity.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorSecurity.java @@ -6,7 +6,7 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; /** * User: serso @@ -18,7 +18,7 @@ public final class CalculatorSecurity { private CalculatorSecurity() { } - @NotNull + @Nonnull public static String getPK() { final StringBuilder result = new StringBuilder(); diff --git a/android-app/src/main/java/org/solovyev/android/calculator/CharacterAtPositionFinder.java b/android-app/src/main/java/org/solovyev/android/calculator/CharacterAtPositionFinder.java index 27d98f3e..e2bcb8aa 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/CharacterAtPositionFinder.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/CharacterAtPositionFinder.java @@ -6,8 +6,8 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.common.JPredicate; /** @@ -19,10 +19,10 @@ public class CharacterAtPositionFinder implements JPredicate { private int i; - @NotNull + @Nonnull private final String targetString; - public CharacterAtPositionFinder(@NotNull String targetString, int i) { + public CharacterAtPositionFinder(@Nonnull String targetString, int i) { this.targetString = targetString; this.i = i; } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/CursorDragProcessor.java b/android-app/src/main/java/org/solovyev/android/calculator/CursorDragProcessor.java index 473d758e..4541db54 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/CursorDragProcessor.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/CursorDragProcessor.java @@ -6,7 +6,7 @@ package org.solovyev.android.calculator; import android.view.MotionEvent; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.view.drag.DirectionDragButton; import org.solovyev.android.view.drag.DragButton; import org.solovyev.android.view.drag.DragDirection; @@ -24,7 +24,7 @@ public class CursorDragProcessor implements SimpleOnDragListener.DragProcessor { } @Override - public boolean processDragEvent(@NotNull DragDirection dragDirection, @NotNull DragButton dragButton, @NotNull Point2d startPoint2d, @NotNull MotionEvent motionEvent) { + public boolean processDragEvent(@Nonnull DragDirection dragDirection, @Nonnull DragButton dragButton, @Nonnull Point2d startPoint2d, @Nonnull MotionEvent motionEvent) { boolean result = false; if (dragButton instanceof DirectionDragButton) { diff --git a/android-app/src/main/java/org/solovyev/android/calculator/EqualsDragProcessor.java b/android-app/src/main/java/org/solovyev/android/calculator/EqualsDragProcessor.java index e2798654..8e0bb850 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/EqualsDragProcessor.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/EqualsDragProcessor.java @@ -7,7 +7,7 @@ package org.solovyev.android.calculator; import android.view.MotionEvent; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.view.drag.DirectionDragButton; import org.solovyev.android.view.drag.DragButton; import org.solovyev.android.view.drag.DragDirection; @@ -25,7 +25,7 @@ public class EqualsDragProcessor implements SimpleOnDragListener.DragProcessor { } @Override - public boolean processDragEvent(@NotNull DragDirection dragDirection, @NotNull DragButton dragButton, @NotNull Point2d startPoint2d, @NotNull MotionEvent motionEvent) { + public boolean processDragEvent(@Nonnull DragDirection dragDirection, @Nonnull DragButton dragButton, @Nonnull Point2d startPoint2d, @Nonnull MotionEvent motionEvent) { boolean result = false; if (dragButton instanceof DirectionDragButton) { diff --git a/android-app/src/main/java/org/solovyev/android/calculator/NumeralBaseButtons.java b/android-app/src/main/java/org/solovyev/android/calculator/NumeralBaseButtons.java index f09b7d2d..0f7d702e 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/NumeralBaseButtons.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/NumeralBaseButtons.java @@ -3,7 +3,7 @@ package org.solovyev.android.calculator; import android.app.Activity; import android.content.SharedPreferences; import jscl.NumeralBase; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.calculator.model.AndroidCalculatorEngine; /** @@ -13,7 +13,7 @@ import org.solovyev.android.calculator.model.AndroidCalculatorEngine; */ public class NumeralBaseButtons { - public static void toggleNumericDigits(@NotNull Activity activity, @NotNull NumeralBase currentNumeralBase) { + public static void toggleNumericDigits(@Nonnull Activity activity, @Nonnull NumeralBase currentNumeralBase) { for (NumeralBase numeralBase : NumeralBase.values()) { if (currentNumeralBase != numeralBase) { AndroidNumeralBase.valueOf(numeralBase).toggleButtons(false, activity); @@ -23,7 +23,7 @@ public class NumeralBaseButtons { AndroidNumeralBase.valueOf(currentNumeralBase).toggleButtons(true, activity); } - public static void toggleNumericDigits(@NotNull Activity activity, @NotNull SharedPreferences preferences) { + public static void toggleNumericDigits(@Nonnull Activity activity, @Nonnull SharedPreferences preferences) { if (CalculatorPreferences.Gui.hideNumeralBaseDigits.getPreference(preferences)) { final NumeralBase nb = AndroidCalculatorEngine.Preferences.numeralBase.getPreference(preferences); toggleNumericDigits(activity, nb); diff --git a/android-app/src/main/java/org/solovyev/android/calculator/about/CalculatorAboutActivity.java b/android-app/src/main/java/org/solovyev/android/calculator/about/CalculatorAboutActivity.java index 2a4d5408..0a8acec3 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/about/CalculatorAboutActivity.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/about/CalculatorAboutActivity.java @@ -6,7 +6,7 @@ package org.solovyev.android.calculator.about; import android.os.Bundle; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nullable; import org.solovyev.android.calculator.CalculatorFragmentActivity; import org.solovyev.android.calculator.CalculatorFragmentType; import org.solovyev.android.calculator.R; diff --git a/android-app/src/main/java/org/solovyev/android/calculator/about/CalculatorReleaseNotesFragment.java b/android-app/src/main/java/org/solovyev/android/calculator/about/CalculatorReleaseNotesFragment.java index c1a11e68..d9603a6c 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/about/CalculatorReleaseNotesFragment.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/about/CalculatorReleaseNotesFragment.java @@ -12,7 +12,7 @@ import android.text.Html; import android.text.method.LinkMovementMethod; import android.view.View; import android.widget.TextView; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.Android; import org.solovyev.android.calculator.CalculatorApplication; import org.solovyev.android.calculator.CalculatorFragment; @@ -41,13 +41,13 @@ public class CalculatorReleaseNotesFragment extends CalculatorFragment { releaseNotes.setText(Html.fromHtml(getReleaseNotes(this.getActivity()))); } - @NotNull - public static String getReleaseNotes(@NotNull Context context) { + @Nonnull + public static String getReleaseNotes(@Nonnull Context context) { return getReleaseNotes(context, 0); } - @NotNull - public static String getReleaseNotes(@NotNull Context context, int minVersion) { + @Nonnull + public static String getReleaseNotes(@Nonnull Context context, int minVersion) { final StringBuilder result = new StringBuilder(); final String releaseNotesForTitle = context.getString(R.string.c_release_notes_for_title); diff --git a/android-app/src/main/java/org/solovyev/android/calculator/about/TextHelper.java b/android-app/src/main/java/org/solovyev/android/calculator/about/TextHelper.java index 44b4cce9..f9489d6e 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/about/TextHelper.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/about/TextHelper.java @@ -1,8 +1,8 @@ package org.solovyev.android.calculator.about; import android.content.res.Resources; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; /** * User: serso @@ -11,19 +11,19 @@ import org.jetbrains.annotations.Nullable; */ public class TextHelper { - @NotNull + @Nonnull public String packageName; - @NotNull + @Nonnull public Resources resources; - public TextHelper(@NotNull Resources resources, @NotNull String packageName) { + public TextHelper(@Nonnull Resources resources, @Nonnull String packageName) { this.packageName = packageName; this.resources = resources; } @Nullable - public String getText(@NotNull String stringName) { + public String getText(@Nonnull String stringName) { final int stringId = this.resources.getIdentifier(stringName, "string", this.packageName); try { return resources.getString(stringId); diff --git a/android-app/src/main/java/org/solovyev/android/calculator/function/FunctionEditDialogFragment.java b/android-app/src/main/java/org/solovyev/android/calculator/function/FunctionEditDialogFragment.java index 0362b0ad..2b5e100b 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/function/FunctionEditDialogFragment.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/function/FunctionEditDialogFragment.java @@ -17,8 +17,8 @@ import jscl.math.function.Constant; import jscl.math.function.CustomFunction; import jscl.math.function.Function; import jscl.math.function.IFunction; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.*; import org.solovyev.android.calculator.math.edit.CalculatorFunctionsActivity; import org.solovyev.android.calculator.math.edit.CalculatorFunctionsFragment; @@ -39,14 +39,14 @@ public class FunctionEditDialogFragment extends DialogFragment implements Calcul private static final String INPUT = "input"; - @NotNull + @Nonnull private Input input; public FunctionEditDialogFragment() { this(Input.newInstance()); } - public FunctionEditDialogFragment(@NotNull Input input) { + public FunctionEditDialogFragment(@Nonnull Input input) { this.input = input; } @@ -65,7 +65,7 @@ public class FunctionEditDialogFragment extends DialogFragment implements Calcul } @Override - public void onViewCreated(@NotNull View root, Bundle savedInstanceState) { + public void onViewCreated(@Nonnull View root, Bundle savedInstanceState) { super.onViewCreated(root, savedInstanceState); final FunctionParamsView paramsView = (FunctionParamsView) root.findViewById(R.id.function_params_layout); @@ -120,7 +120,7 @@ public class FunctionEditDialogFragment extends DialogFragment implements Calcul } @Override - public void onSaveInstanceState(@NotNull Bundle out) { + public void onSaveInstanceState(@Nonnull Bundle out) { super.onSaveInstanceState(out); out.putParcelable(INPUT, FunctionEditorSaver.readInput(input.getFunction(), getView())); @@ -141,7 +141,7 @@ public class FunctionEditDialogFragment extends DialogFragment implements Calcul } @Override - public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) { + public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) { switch (calculatorEventType) { case function_removed: case function_added: @@ -162,7 +162,7 @@ public class FunctionEditDialogFragment extends DialogFragment implements Calcul ********************************************************************** */ - public static void showDialog(@NotNull Input input, @NotNull Context context) { + public static void showDialog(@Nonnull Input input, @Nonnull Context context) { if (context instanceof SherlockFragmentActivity) { FunctionEditDialogFragment.showDialog(input, ((SherlockFragmentActivity) context).getSupportFragmentManager()); } else { @@ -173,7 +173,7 @@ public class FunctionEditDialogFragment extends DialogFragment implements Calcul } } - public static void showDialog(@NotNull Input input, @NotNull FragmentManager fm) { + public static void showDialog(@Nonnull Input input, @Nonnull FragmentManager fm) { AndroidSherlockUtils.showDialog(new FunctionEditDialogFragment(input), "function-editor", fm); } @@ -181,7 +181,7 @@ public class FunctionEditDialogFragment extends DialogFragment implements Calcul public static final Parcelable.Creator CREATOR = new Creator() { @Override - public Input createFromParcel(@NotNull Parcel in) { + public Input createFromParcel(@Nonnull Parcel in) { return Input.fromParcel(in); } @@ -193,7 +193,7 @@ public class FunctionEditDialogFragment extends DialogFragment implements Calcul private static final Parcelable.Creator STRING_CREATOR = new Creator() { @Override - public String createFromParcel(@NotNull Parcel in) { + public String createFromParcel(@Nonnull Parcel in) { return in.readString(); } @@ -203,8 +203,8 @@ public class FunctionEditDialogFragment extends DialogFragment implements Calcul } }; - @NotNull - private static Input fromParcel(@NotNull Parcel in) { + @Nonnull + private static Input fromParcel(@Nonnull Parcel in) { final Input result = new Input(); result.name = in.readString(); result.content = in.readString(); @@ -237,24 +237,24 @@ public class FunctionEditDialogFragment extends DialogFragment implements Calcul private Input() { } - @NotNull + @Nonnull public static Input newInstance() { return new Input(); } - @NotNull - public static Input newFromFunction(@NotNull IFunction function) { + @Nonnull + public static Input newFromFunction(@Nonnull IFunction function) { final Input result = new Input(); result.function = AFunction.fromIFunction(function); return result; } - @NotNull + @Nonnull public static Input newInstance(@Nullable IFunction function, @Nullable String name, @Nullable String value, @Nullable String description, - @NotNull List parameterNames) { + @Nonnull List parameterNames) { final Input result = new Input(); if (function != null) { @@ -299,7 +299,7 @@ public class FunctionEditDialogFragment extends DialogFragment implements Calcul } @Override - public void writeToParcel(@NotNull Parcel out, int flags) { + public void writeToParcel(@Nonnull Parcel out, int flags) { out.writeString(name); out.writeString(content); out.writeString(description); @@ -307,8 +307,8 @@ public class FunctionEditDialogFragment extends DialogFragment implements Calcul out.writeSerializable(function); } - @NotNull - public static Input newFromDisplay(@NotNull CalculatorDisplayViewState viewState) { + @Nonnull + public static Input newFromDisplay(@Nonnull CalculatorDisplayViewState viewState) { final Input result = new Input(); result.content = viewState.getText(); diff --git a/android-app/src/main/java/org/solovyev/android/calculator/function/FunctionEditorSaver.java b/android-app/src/main/java/org/solovyev/android/calculator/function/FunctionEditorSaver.java index c5ddf36a..889c4ac9 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/function/FunctionEditorSaver.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/function/FunctionEditorSaver.java @@ -5,8 +5,8 @@ import android.widget.EditText; import jscl.CustomFunctionCalculationException; import jscl.math.function.Function; import jscl.math.function.IFunction; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.CalculatorFunctionsMathRegistry; import org.solovyev.android.calculator.CalculatorMathRegistry; import org.solovyev.android.calculator.Locator; @@ -21,27 +21,27 @@ import java.util.List; public class FunctionEditorSaver implements View.OnClickListener { - @NotNull + @Nonnull private final Object source; - @NotNull + @Nonnull private final AFunction.Builder builder; @Nullable private final IFunction editedInstance; - @NotNull + @Nonnull private final View view; - @NotNull + @Nonnull private final CalculatorMathRegistry mathRegistry; - public FunctionEditorSaver(@NotNull AFunction.Builder builder, + public FunctionEditorSaver(@Nonnull AFunction.Builder builder, @Nullable IFunction editedInstance, - @NotNull View view, - @NotNull CalculatorMathRegistry registry, - @NotNull Object source) { + @Nonnull View view, + @Nonnull CalculatorMathRegistry registry, + @Nonnull Object source) { this.builder = builder; this.editedInstance = editedInstance; @@ -111,8 +111,8 @@ public class FunctionEditorSaver implements View.OnClickListener { } } - @NotNull - public static FunctionEditDialogFragment.Input readInput(@Nullable IFunction function, @NotNull View root) { + @Nonnull + public static FunctionEditDialogFragment.Input readInput(@Nullable IFunction function, @Nonnull View root) { final EditText editName = (EditText) root.findViewById(R.id.function_edit_name); String name = editName.getText().toString(); @@ -128,7 +128,7 @@ public class FunctionEditorSaver implements View.OnClickListener { return FunctionEditDialogFragment.Input.newInstance(function, name, content, description, parameterNames); } - private boolean validateParameters(@NotNull List parameterNames) { + private boolean validateParameters(@Nonnull List parameterNames) { for (String parameterName : parameterNames) { if (!VarEditorSaver.isValidName(parameterName)) { return false; diff --git a/android-app/src/main/java/org/solovyev/android/calculator/function/FunctionParamsView.java b/android-app/src/main/java/org/solovyev/android/calculator/function/FunctionParamsView.java index 70e97cca..b9d8d6f9 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/function/FunctionParamsView.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/function/FunctionParamsView.java @@ -9,8 +9,8 @@ import android.widget.EditText; import android.widget.LinearLayout; import android.widget.TextView; import jscl.text.MutableInt; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.R; import java.util.ArrayList; @@ -19,10 +19,10 @@ import java.util.List; public class FunctionParamsView extends LinearLayout { - @NotNull + @Nonnull private final MutableInt paramsCount = new MutableInt(0); - @NotNull + @Nonnull private final List paramIds = new ArrayList(10); private static final String PARAM_TAG_PREFIX = "function_param_"; @@ -43,7 +43,7 @@ public class FunctionParamsView extends LinearLayout { init(Collections.emptyList()); } - public void init(@NotNull List parameters) { + public void init(@Nonnull List parameters) { this.setOrientation(VERTICAL); final LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); @@ -110,7 +110,7 @@ public class FunctionParamsView extends LinearLayout { } } - private void downParam(@NotNull Integer id) { + private void downParam(@Nonnull Integer id) { synchronized (paramsCount) { int index = paramIds.indexOf(id); if (index < paramIds.size() - 1) { @@ -119,7 +119,7 @@ public class FunctionParamsView extends LinearLayout { } } - private void upParam(@NotNull Integer id) { + private void upParam(@Nonnull Integer id) { synchronized (paramsCount) { int index = paramIds.indexOf(id); if (index > 0) { @@ -139,25 +139,25 @@ public class FunctionParamsView extends LinearLayout { } } - private void swap(@NotNull TextView first, - @NotNull TextView second) { + private void swap(@Nonnull TextView first, + @Nonnull TextView second) { final CharSequence tmp = first.getText(); first.setText(second.getText()); second.setText(tmp); } @Nullable - private View getParamView(@NotNull Integer id) { + private View getParamView(@Nonnull Integer id) { final String tag = getParamTag(id); return this.findViewWithTag(tag); } - @NotNull - private String getParamTag(@NotNull Integer index) { + @Nonnull + private String getParamTag(@Nonnull Integer index) { return PARAM_TAG_PREFIX + index; } - public void removeParam(@NotNull Integer id) { + public void removeParam(@Nonnull Integer id) { synchronized (paramsCount) { if (paramIds.contains(id)) { final View editParamView = getParamView(id); @@ -169,7 +169,7 @@ public class FunctionParamsView extends LinearLayout { } } - @NotNull + @Nonnull public List getParameterNames() { synchronized (paramsCount) { final List result = new ArrayList(paramsCount.intValue()); diff --git a/android-app/src/main/java/org/solovyev/android/calculator/help/CalculatorHelpActivity.java b/android-app/src/main/java/org/solovyev/android/calculator/help/CalculatorHelpActivity.java index 5eb94a57..8e91f062 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/help/CalculatorHelpActivity.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/help/CalculatorHelpActivity.java @@ -7,7 +7,7 @@ package org.solovyev.android.calculator.help; import android.os.Bundle; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nullable; import org.solovyev.android.calculator.CalculatorFragmentActivity; import org.solovyev.android.calculator.CalculatorFragmentType; import org.solovyev.android.calculator.R; diff --git a/android-app/src/main/java/org/solovyev/android/calculator/history/AbstractCalculatorHistoryFragment.java b/android-app/src/main/java/org/solovyev/android/calculator/history/AbstractCalculatorHistoryFragment.java index 2e1740b1..0edc4e99 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/history/AbstractCalculatorHistoryFragment.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/history/AbstractCalculatorHistoryFragment.java @@ -20,8 +20,8 @@ import com.actionbarsherlock.app.SherlockListFragment; import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.MenuInflater; import com.actionbarsherlock.view.MenuItem; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.*; import org.solovyev.android.calculator.jscl.JsclOperation; import org.solovyev.android.menu.*; @@ -52,7 +52,7 @@ public abstract class AbstractCalculatorHistoryFragment extends SherlockListFrag ********************************************************************** */ - @NotNull + @Nonnull private static final String TAG = "CalculatorHistoryFragment"; public static final Comparator COMPARATOR = new Comparator() { @@ -79,15 +79,15 @@ public abstract class AbstractCalculatorHistoryFragment extends SherlockListFrag */ - @NotNull + @Nonnull private ArrayAdapter adapter; - @NotNull + @Nonnull private CalculatorFragmentHelper fragmentHelper; private ActivityMenu menu = ListActivityMenu.fromResource(org.solovyev.android.calculator.R.menu.history_menu, HistoryMenu.class, SherlockMenuHelper.getInstance()); - protected AbstractCalculatorHistoryFragment(@NotNull CalculatorFragmentType fragmentType) { + protected AbstractCalculatorHistoryFragment(@Nonnull CalculatorFragmentType fragmentType) { fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(fragmentType.getDefaultLayoutId(), fragmentType.getDefaultTitleResId(), false); } @@ -102,7 +102,7 @@ public abstract class AbstractCalculatorHistoryFragment extends SherlockListFrag logDebug("onCreate"); } - private int logDebug(@NotNull String msg) { + private int logDebug(@Nonnull String msg) { return Log.d(TAG + ": " + getTag(), msg); } @@ -212,7 +212,7 @@ public abstract class AbstractCalculatorHistoryFragment extends SherlockListFrag adapter.notifyDataSetChanged(); } - public static boolean isAlreadySaved(@NotNull CalculatorHistoryState historyState) { + public static boolean isAlreadySaved(@Nonnull CalculatorHistoryState historyState) { assert !historyState.isSaved(); boolean result = false; @@ -235,11 +235,11 @@ public abstract class AbstractCalculatorHistoryFragment extends SherlockListFrag return result; } - public static void useHistoryItem(@NotNull final CalculatorHistoryState historyState) { + public static void useHistoryItem(@Nonnull final CalculatorHistoryState historyState) { Locator.getInstance().getCalculator().fireCalculatorEvent(CalculatorEventType.use_history_state, historyState); } - @NotNull + @Nonnull private List getHistoryList() { final List calculatorHistoryStates = getHistoryItems(); @@ -258,11 +258,11 @@ public abstract class AbstractCalculatorHistoryFragment extends SherlockListFrag return calculatorHistoryStates; } - @NotNull + @Nonnull protected abstract List getHistoryItems(); - @NotNull - public static String getHistoryText(@NotNull CalculatorHistoryState state) { + @Nonnull + public static String getHistoryText(@Nonnull CalculatorHistoryState state) { final StringBuilder result = new StringBuilder(); result.append(state.getEditorState().getText()); result.append(getIdentitySign(state.getDisplayState().getJsclOperation())); @@ -273,20 +273,20 @@ public abstract class AbstractCalculatorHistoryFragment extends SherlockListFrag return result.toString(); } - @NotNull - private static String getIdentitySign(@NotNull JsclOperation jsclOperation) { + @Nonnull + private static String getIdentitySign(@Nonnull JsclOperation jsclOperation) { return jsclOperation == JsclOperation.simplify ? "≡" : "="; } protected abstract void clearHistory(); - @NotNull + @Nonnull protected ArrayAdapter getAdapter() { return adapter; } @Override - public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) { + public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) { switch (calculatorEventType) { case history_state_added: getActivity().runOnUiThread(new Runnable() { @@ -337,7 +337,7 @@ public abstract class AbstractCalculatorHistoryFragment extends SherlockListFrag clear_history(org.solovyev.android.calculator.R.id.history_menu_clear_history) { @Override - public void onClick(@NotNull MenuItem data, @NotNull Context context) { + public void onClick(@Nonnull MenuItem data, @Nonnull Context context) { Locator.getInstance().getCalculator().fireCalculatorEvent(CalculatorEventType.clear_history_requested, null); } }; @@ -348,7 +348,7 @@ public abstract class AbstractCalculatorHistoryFragment extends SherlockListFrag this.itemId = itemId; } - @NotNull + @Nonnull @Override public Integer getItemId() { return this.itemId; diff --git a/android-app/src/main/java/org/solovyev/android/calculator/history/AndroidCalculatorHistory.java b/android-app/src/main/java/org/solovyev/android/calculator/history/AndroidCalculatorHistory.java index 35fc5912..5debb927 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/history/AndroidCalculatorHistory.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/history/AndroidCalculatorHistory.java @@ -10,8 +10,8 @@ import android.app.Application; import android.content.Context; import android.content.SharedPreferences; import android.preference.PreferenceManager; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.Calculator; import org.solovyev.android.calculator.CalculatorEventData; import org.solovyev.android.calculator.CalculatorEventType; @@ -27,13 +27,13 @@ import java.util.List; */ public class AndroidCalculatorHistory implements CalculatorHistory { - @NotNull + @Nonnull private final CalculatorHistoryImpl calculatorHistory; - @NotNull + @Nonnull private final Context context; - public AndroidCalculatorHistory(@NotNull Application application, @NotNull Calculator calculator) { + public AndroidCalculatorHistory(@Nonnull Application application, @Nonnull Calculator calculator) { this.context = application; calculatorHistory = new CalculatorHistoryImpl(calculator); } @@ -63,7 +63,7 @@ public class AndroidCalculatorHistory implements CalculatorHistory { save(); } - public void removeSavedHistory(@NotNull CalculatorHistoryState historyState) { + public void removeSavedHistory(@Nonnull CalculatorHistoryState historyState) { historyState.setSaved(false); calculatorHistory.removeSavedHistory(historyState); save(); @@ -100,12 +100,12 @@ public class AndroidCalculatorHistory implements CalculatorHistory { } @Override - public boolean isActionAvailable(@NotNull HistoryAction historyAction) { + public boolean isActionAvailable(@Nonnull HistoryAction historyAction) { return calculatorHistory.isActionAvailable(historyAction); } @Override - public CalculatorHistoryState doAction(@NotNull HistoryAction historyAction, @Nullable CalculatorHistoryState currentState) { + public CalculatorHistoryState doAction(@Nonnull HistoryAction historyAction, @Nullable CalculatorHistoryState currentState) { return calculatorHistory.doAction(historyAction, currentState); } @@ -114,13 +114,13 @@ public class AndroidCalculatorHistory implements CalculatorHistory { calculatorHistory.addState(currentState); } - @NotNull + @Nonnull @Override public List getStates() { return calculatorHistory.getStates(); } - @NotNull + @Nonnull @Override public List getStates(boolean includeIntermediateStates) { return calculatorHistory.getStates(includeIntermediateStates); @@ -131,18 +131,18 @@ public class AndroidCalculatorHistory implements CalculatorHistory { calculatorHistory.clear(); } - @NotNull + @Nonnull public List getSavedHistory() { return calculatorHistory.getSavedHistory(); } - @NotNull - public CalculatorHistoryState addSavedState(@NotNull CalculatorHistoryState historyState) { + @Nonnull + public CalculatorHistoryState addSavedState(@Nonnull CalculatorHistoryState historyState) { return calculatorHistory.addSavedState(historyState); } @Override - public void fromXml(@NotNull String xml) { + public void fromXml(@Nonnull String xml) { calculatorHistory.fromXml(xml); } @@ -152,7 +152,7 @@ public class AndroidCalculatorHistory implements CalculatorHistory { } @Override - public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) { + public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) { calculatorHistory.onCalculatorEvent(calculatorEventData, calculatorEventType, data); } } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/history/CalculatorHistoryActivity.java b/android-app/src/main/java/org/solovyev/android/calculator/history/CalculatorHistoryActivity.java index 8457968c..9eba569e 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/history/CalculatorHistoryActivity.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/history/CalculatorHistoryActivity.java @@ -8,8 +8,8 @@ package org.solovyev.android.calculator.history; import android.os.Bundle; import com.actionbarsherlock.app.SherlockFragmentActivity; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.*; /** @@ -19,7 +19,7 @@ import org.solovyev.android.calculator.*; */ public class CalculatorHistoryActivity extends SherlockFragmentActivity implements CalculatorEventListener { - @NotNull + @Nonnull private final CalculatorActivityHelper activityHelper = CalculatorApplication.getInstance().createActivityHelper(R.layout.main_empty, CalculatorHistoryActivity.class.getSimpleName()); @Override @@ -62,7 +62,7 @@ public class CalculatorHistoryActivity extends SherlockFragmentActivity implemen } @Override - public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) { + public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) { if (calculatorEventType == CalculatorEventType.use_history_state) { this.finish(); } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/history/CalculatorHistoryFragment.java b/android-app/src/main/java/org/solovyev/android/calculator/history/CalculatorHistoryFragment.java index ad513a1c..59849f17 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/history/CalculatorHistoryFragment.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/history/CalculatorHistoryFragment.java @@ -7,7 +7,7 @@ package org.solovyev.android.calculator.history; import android.preference.PreferenceManager; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.calculator.CalculatorFragmentType; import org.solovyev.android.calculator.CalculatorPreferences; import org.solovyev.android.calculator.Locator; @@ -32,7 +32,7 @@ public class CalculatorHistoryFragment extends AbstractCalculatorHistoryFragment return R.layout.history_item; } - @NotNull + @Nonnull @Override protected List getHistoryItems() { final boolean showIntermediateCalculations = CalculatorPreferences.History.showIntermediateCalculations.getPreference(PreferenceManager.getDefaultSharedPreferences(getActivity())); diff --git a/android-app/src/main/java/org/solovyev/android/calculator/history/CalculatorSavedHistoryFragment.java b/android-app/src/main/java/org/solovyev/android/calculator/history/CalculatorSavedHistoryFragment.java index 1768b9d1..37ad35bc 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/history/CalculatorSavedHistoryFragment.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/history/CalculatorSavedHistoryFragment.java @@ -6,7 +6,7 @@ package org.solovyev.android.calculator.history; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.calculator.CalculatorFragmentType; import org.solovyev.android.calculator.Locator; import org.solovyev.android.calculator.R; @@ -30,7 +30,7 @@ public class CalculatorSavedHistoryFragment extends AbstractCalculatorHistoryFra return R.layout.saved_history_item; } - @NotNull + @Nonnull @Override protected List getHistoryItems() { return new ArrayList(Locator.getInstance().getHistory().getSavedHistory()); diff --git a/android-app/src/main/java/org/solovyev/android/calculator/history/HistoryArrayAdapter.java b/android-app/src/main/java/org/solovyev/android/calculator/history/HistoryArrayAdapter.java index 8790d2fa..5df6d736 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/history/HistoryArrayAdapter.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/history/HistoryArrayAdapter.java @@ -11,7 +11,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.calculator.R; import org.solovyev.common.text.Strings; @@ -26,7 +26,7 @@ import java.util.List; */ public class HistoryArrayAdapter extends ArrayAdapter { - HistoryArrayAdapter(Context context, int resource, int textViewResourceId, @NotNull List historyList) { + HistoryArrayAdapter(Context context, int resource, int textViewResourceId, @Nonnull List historyList) { super(context, resource, textViewResourceId, historyList); } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/history/HistoryItemMenuData.java b/android-app/src/main/java/org/solovyev/android/calculator/history/HistoryItemMenuData.java index 9a5994de..1a68884a 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/history/HistoryItemMenuData.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/history/HistoryItemMenuData.java @@ -7,7 +7,7 @@ package org.solovyev.android.calculator.history; import android.widget.ArrayAdapter; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; /** * User: serso @@ -16,23 +16,23 @@ import org.jetbrains.annotations.NotNull; */ public class HistoryItemMenuData { - @NotNull + @Nonnull private final ArrayAdapter adapter; - @NotNull + @Nonnull private final CalculatorHistoryState historyState; - public HistoryItemMenuData(@NotNull CalculatorHistoryState historyState, ArrayAdapter adapter) { + public HistoryItemMenuData(@Nonnull CalculatorHistoryState historyState, ArrayAdapter adapter) { this.historyState = historyState; this.adapter = adapter; } - @NotNull + @Nonnull public CalculatorHistoryState getHistoryState() { return historyState; } - @NotNull + @Nonnull public ArrayAdapter getAdapter() { return adapter; } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/history/HistoryItemMenuItem.java b/android-app/src/main/java/org/solovyev/android/calculator/history/HistoryItemMenuItem.java index 3c4b2cde..5ff289e0 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/history/HistoryItemMenuItem.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/history/HistoryItemMenuItem.java @@ -16,7 +16,7 @@ import android.view.View; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.calculator.Locator; import org.solovyev.android.calculator.R; import org.solovyev.android.menu.LabeledMenuItem; @@ -31,14 +31,14 @@ public enum HistoryItemMenuItem implements LabeledMenuItem use(R.string.c_use) { @Override - public void onClick(@NotNull HistoryItemMenuData data, @NotNull Context context) { + public void onClick(@Nonnull HistoryItemMenuData data, @Nonnull Context context) { AbstractCalculatorHistoryFragment.useHistoryItem(data.getHistoryState()); } }, copy_expression(R.string.c_copy_expression) { @Override - public void onClick(@NotNull HistoryItemMenuData data, @NotNull Context context) { + public void onClick(@Nonnull HistoryItemMenuData data, @Nonnull Context context) { final CalculatorHistoryState calculatorHistoryState = data.getHistoryState(); final String text = calculatorHistoryState.getEditorState().getText(); if (!Strings.isEmpty(text)) { @@ -51,7 +51,7 @@ public enum HistoryItemMenuItem implements LabeledMenuItem copy_result(R.string.c_copy_result) { @Override - public void onClick(@NotNull HistoryItemMenuData data, @NotNull Context context) { + public void onClick(@Nonnull HistoryItemMenuData data, @Nonnull Context context) { final CalculatorHistoryState calculatorHistoryState = data.getHistoryState(); final String text = calculatorHistoryState.getDisplayState().getEditorState().getText(); if (!Strings.isEmpty(text)) { @@ -64,7 +64,7 @@ public enum HistoryItemMenuItem implements LabeledMenuItem save(R.string.c_save) { @Override - public void onClick(@NotNull final HistoryItemMenuData data, @NotNull final Context context) { + public void onClick(@Nonnull final HistoryItemMenuData data, @Nonnull final Context context) { final CalculatorHistoryState historyState = data.getHistoryState(); if (!historyState.isSaved()) { createEditHistoryDialog(data, context, true); @@ -76,7 +76,7 @@ public enum HistoryItemMenuItem implements LabeledMenuItem edit(R.string.c_edit) { @Override - public void onClick(@NotNull final HistoryItemMenuData data, @NotNull final Context context) { + public void onClick(@Nonnull final HistoryItemMenuData data, @Nonnull final Context context) { final CalculatorHistoryState historyState = data.getHistoryState(); if (historyState.isSaved()) { createEditHistoryDialog(data, context, false); @@ -88,7 +88,7 @@ public enum HistoryItemMenuItem implements LabeledMenuItem remove(R.string.c_remove) { @Override - public void onClick(@NotNull HistoryItemMenuData data, @NotNull Context context) { + public void onClick(@Nonnull HistoryItemMenuData data, @Nonnull Context context) { final CalculatorHistoryState historyState = data.getHistoryState(); if (historyState.isSaved()) { data.getAdapter().remove(historyState); @@ -99,7 +99,7 @@ public enum HistoryItemMenuItem implements LabeledMenuItem } }; - private static void createEditHistoryDialog(@NotNull final HistoryItemMenuData data, @NotNull final Context context, final boolean save) { + private static void createEditHistoryDialog(@Nonnull final HistoryItemMenuData data, @Nonnull final Context context, final boolean save) { final CalculatorHistoryState historyState = data.getHistoryState(); final LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); @@ -142,9 +142,9 @@ public enum HistoryItemMenuItem implements LabeledMenuItem this.captionId = captionId; } - @NotNull + @Nonnull @Override - public String getCaption(@NotNull Context context) { + public String getCaption(@Nonnull Context context) { return context.getString(captionId); } } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/history/TextViewEditorAdapter.java b/android-app/src/main/java/org/solovyev/android/calculator/history/TextViewEditorAdapter.java index 1ef2d56e..697151e8 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/history/TextViewEditorAdapter.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/history/TextViewEditorAdapter.java @@ -8,8 +8,8 @@ package org.solovyev.android.calculator.history; import android.widget.EditText; import android.widget.TextView; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.Editor; /** @@ -19,10 +19,10 @@ import org.solovyev.android.calculator.Editor; */ public class TextViewEditorAdapter implements Editor { - @NotNull + @Nonnull private final TextView textView; - public TextViewEditorAdapter(@NotNull TextView textView) { + public TextViewEditorAdapter(@Nonnull TextView textView) { this.textView = textView; } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/math/edit/AbstractMathEntityListFragment.java b/android-app/src/main/java/org/solovyev/android/calculator/math/edit/AbstractMathEntityListFragment.java index 5f12b68a..359539af 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/math/edit/AbstractMathEntityListFragment.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/math/edit/AbstractMathEntityListFragment.java @@ -16,8 +16,8 @@ import android.view.View; import android.view.ViewGroup; import android.widget.*; import com.actionbarsherlock.app.SherlockListFragment; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.*; import org.solovyev.android.menu.AMenuItem; import org.solovyev.android.menu.ContextMenuBuilder; @@ -67,13 +67,13 @@ public abstract class AbstractMathEntityListFragment exten @Nullable private String category; - @NotNull + @Nonnull private final CalculatorFragmentHelper fragmentHelper; - @NotNull + @Nonnull private final Handler uiHandler = new Handler(); - protected AbstractMathEntityListFragment(@NotNull CalculatorFragmentType fragmentType) { + protected AbstractMathEntityListFragment(@Nonnull CalculatorFragmentType fragmentType) { fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(fragmentType.getDefaultLayoutId(), fragmentType.getDefaultTitleResId()); } @@ -142,8 +142,8 @@ public abstract class AbstractMathEntityListFragment exten super.onDestroy(); } - @NotNull - protected abstract List> getMenuItemsOnLongClick(@NotNull T item); + @Nonnull + protected abstract List> getMenuItemsOnLongClick(@Nonnull T item); @Override public void onPause() { @@ -164,7 +164,7 @@ public abstract class AbstractMathEntityListFragment exten sort(); } - @NotNull + @Nonnull private List getMathEntitiesByCategory() { final List result = getMathEntities(); @@ -182,14 +182,14 @@ public abstract class AbstractMathEntityListFragment exten return t != null && (category == null || Objects.areEqual(getMathEntityCategory(t), category)); } - @NotNull + @Nonnull protected abstract MathEntityDescriptionGetter getDescriptionGetter(); - @NotNull + @Nonnull protected abstract List getMathEntities(); @Nullable - abstract String getMathEntityCategory(@NotNull T t); + abstract String getMathEntityCategory(@Nonnull T t); protected void sort() { final MathEntityArrayAdapter localAdapter = adapter; @@ -207,14 +207,14 @@ public abstract class AbstractMathEntityListFragment exten protected static class MathEntityArrayAdapter extends ArrayAdapter { - @NotNull + @Nonnull private final MathEntityDescriptionGetter descriptionGetter; - private MathEntityArrayAdapter(@NotNull MathEntityDescriptionGetter descriptionGetter, - @NotNull Context context, + private MathEntityArrayAdapter(@Nonnull MathEntityDescriptionGetter descriptionGetter, + @Nonnull Context context, int resource, int textViewResourceId, - @NotNull List objects) { + @Nonnull List objects) { super(context, resource, textViewResourceId, objects); this.descriptionGetter = descriptionGetter; @@ -236,7 +236,7 @@ public abstract class AbstractMathEntityListFragment exten return result; } - private void fillView(int position, @NotNull ViewGroup result) { + private void fillView(int position, @Nonnull ViewGroup result) { final T mathEntity = getItem(position); final TextView text = (TextView) result.findViewById(R.id.math_entity_text); @@ -256,15 +256,15 @@ public abstract class AbstractMathEntityListFragment exten protected static class MathEntityDescriptionGetterImpl implements MathEntityDescriptionGetter { - @NotNull + @Nonnull private final CalculatorMathRegistry mathRegistry; - public MathEntityDescriptionGetterImpl(@NotNull CalculatorMathRegistry mathRegistry) { + public MathEntityDescriptionGetterImpl(@Nonnull CalculatorMathRegistry mathRegistry) { this.mathRegistry = mathRegistry; } @Override - public String getDescription(@NotNull Context context, @NotNull String mathEntityName) { + public String getDescription(@Nonnull Context context, @Nonnull String mathEntityName) { return this.mathRegistry.getDescription(mathEntityName); } } @@ -272,16 +272,16 @@ public abstract class AbstractMathEntityListFragment exten protected static interface MathEntityDescriptionGetter { @Nullable - String getDescription(@NotNull Context context, @NotNull String mathEntityName); + String getDescription(@Nonnull Context context, @Nonnull String mathEntityName); } - public void addToAdapter(@NotNull T mathEntity) { + public void addToAdapter(@Nonnull T mathEntity) { if (this.adapter != null) { this.adapter.add(mathEntity); } } - public void removeFromAdapter(@NotNull T mathEntity) { + public void removeFromAdapter(@Nonnull T mathEntity) { if (this.adapter != null) { this.adapter.remove(mathEntity); } @@ -298,7 +298,7 @@ public abstract class AbstractMathEntityListFragment exten return adapter; } - @NotNull + @Nonnull protected Handler getUiHandler() { return uiHandler; } @@ -311,12 +311,12 @@ public abstract class AbstractMathEntityListFragment exten ********************************************************************** */ - static void createTab(@NotNull Context context, - @NotNull TabHost tabHost, - @NotNull String tabId, - @NotNull String categoryId, + static void createTab(@Nonnull Context context, + @Nonnull TabHost tabHost, + @Nonnull String tabId, + @Nonnull String categoryId, int tabCaptionId, - @NotNull Class activityClass, + @Nonnull Class activityClass, @Nullable Intent parentIntent) { TabHost.TabSpec spec; @@ -336,18 +336,18 @@ public abstract class AbstractMathEntityListFragment exten tabHost.addTab(spec); } - @NotNull - public static Bundle createBundleFor(@NotNull String categoryId) { + @Nonnull + public static Bundle createBundleFor(@Nonnull String categoryId) { final Bundle result = new Bundle(1); putCategory(result, categoryId); return result; } - static void putCategory(@NotNull Bundle bundle, @NotNull String categoryId) { + static void putCategory(@Nonnull Bundle bundle, @Nonnull String categoryId) { bundle.putString(MATH_ENTITY_CATEGORY_EXTRA_STRING, categoryId); } @Override - public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) { + public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) { } } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/math/edit/CalculatorFunctionsActivity.java b/android-app/src/main/java/org/solovyev/android/calculator/math/edit/CalculatorFunctionsActivity.java index 8701865f..c7654b45 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/math/edit/CalculatorFunctionsActivity.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/math/edit/CalculatorFunctionsActivity.java @@ -10,8 +10,8 @@ import android.content.Intent; import android.os.Bundle; import android.util.Log; import com.actionbarsherlock.app.SherlockFragmentActivity; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.*; import org.solovyev.android.calculator.history.CalculatorHistoryActivity; @@ -22,7 +22,7 @@ import org.solovyev.android.calculator.history.CalculatorHistoryActivity; */ public class CalculatorFunctionsActivity extends SherlockFragmentActivity implements CalculatorEventListener { - @NotNull + @Nonnull private final CalculatorActivityHelper activityHelper = CalculatorApplication.getInstance().createActivityHelper(R.layout.main_empty, CalculatorHistoryActivity.class.getSimpleName()); @Override @@ -93,7 +93,7 @@ public class CalculatorFunctionsActivity extends SherlockFragmentActivity implem } @Override - public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) { + public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) { switch (calculatorEventType) { case use_function: this.finish(); diff --git a/android-app/src/main/java/org/solovyev/android/calculator/math/edit/CalculatorFunctionsFragment.java b/android-app/src/main/java/org/solovyev/android/calculator/math/edit/CalculatorFunctionsFragment.java index 7dda77b1..72121de1 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/math/edit/CalculatorFunctionsFragment.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/math/edit/CalculatorFunctionsFragment.java @@ -17,8 +17,8 @@ import com.actionbarsherlock.view.MenuInflater; import com.actionbarsherlock.view.MenuItem; import jscl.math.function.Function; import jscl.math.function.IFunction; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.*; import org.solovyev.android.calculator.function.FunctionEditDialogFragment; import org.solovyev.android.menu.AMenuItem; @@ -66,9 +66,9 @@ public class CalculatorFunctionsFragment extends AbstractMathEntityListFragment< return LongClickMenuItem.use; } - @NotNull + @Nonnull @Override - protected List> getMenuItemsOnLongClick(@NotNull Function item) { + protected List> getMenuItemsOnLongClick(@Nonnull Function item) { List> result = new ArrayList>(Arrays.asList(LongClickMenuItem.values())); final CalculatorMathRegistry functionsRegistry = Locator.getInstance().getEngine().getFunctionsRegistry(); @@ -85,25 +85,25 @@ public class CalculatorFunctionsFragment extends AbstractMathEntityListFragment< return result; } - @NotNull + @Nonnull @Override protected MathEntityDescriptionGetter getDescriptionGetter() { return new MathEntityDescriptionGetterImpl(Locator.getInstance().getEngine().getFunctionsRegistry()); } - @NotNull + @Nonnull @Override protected List getMathEntities() { return new ArrayList(Locator.getInstance().getEngine().getFunctionsRegistry().getEntities()); } @Override - protected String getMathEntityCategory(@NotNull Function function) { + protected String getMathEntityCategory(@Nonnull Function function) { return Locator.getInstance().getEngine().getFunctionsRegistry().getCategory(function); } @Override - public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) { + public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) { super.onCalculatorEvent(calculatorEventData, calculatorEventType, data); switch (calculatorEventType) { @@ -122,7 +122,7 @@ public class CalculatorFunctionsFragment extends AbstractMathEntityListFragment< } - private void processFunctionRemoved(@NotNull final Function function) { + private void processFunctionRemoved(@Nonnull final Function function) { if (this.isInCategory(function)) { getUiHandler().post(new Runnable() { @Override @@ -134,7 +134,7 @@ public class CalculatorFunctionsFragment extends AbstractMathEntityListFragment< } } - private void processFunctionChanged(@NotNull final Change change) { + private void processFunctionChanged(@Nonnull final Change change) { final IFunction newFunction = change.getNewValue(); if (newFunction instanceof Function) { @@ -169,7 +169,7 @@ public class CalculatorFunctionsFragment extends AbstractMathEntityListFragment< } } - private void processFunctionAdded(@NotNull final Function function) { + private void processFunctionAdded(@Nonnull final Function function) { if (this.isInCategory(function)) { getUiHandler().post(new Runnable() { @Override @@ -222,14 +222,14 @@ public class CalculatorFunctionsFragment extends AbstractMathEntityListFragment< private static enum LongClickMenuItem implements LabeledMenuItem { use(R.string.c_use) { @Override - public void onClick(@NotNull Function function, @NotNull Context context) { + public void onClick(@Nonnull Function function, @Nonnull Context context) { Locator.getInstance().getCalculator().fireCalculatorEvent(CalculatorEventType.use_function, function); } }, edit(R.string.c_edit) { @Override - public void onClick(@NotNull Function function, @NotNull Context context) { + public void onClick(@Nonnull Function function, @Nonnull Context context) { if (function instanceof IFunction) { FunctionEditDialogFragment.showDialog(FunctionEditDialogFragment.Input.newFromFunction((IFunction) function), ((SherlockFragmentActivity) context).getSupportFragmentManager()); } @@ -238,14 +238,14 @@ public class CalculatorFunctionsFragment extends AbstractMathEntityListFragment< remove(R.string.c_remove) { @Override - public void onClick(@NotNull Function function, @NotNull Context context) { + public void onClick(@Nonnull Function function, @Nonnull Context context) { MathEntityRemover.newFunctionRemover(function, null, context, context).showConfirmationDialog(); } }, copy_description(R.string.c_copy_description) { @Override - public void onClick(@NotNull Function function, @NotNull Context context) { + public void onClick(@Nonnull Function function, @Nonnull Context context) { final String text = Locator.getInstance().getEngine().getFunctionsRegistry().getDescription(function.getName()); if (!Strings.isEmpty(text)) { final ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Activity.CLIPBOARD_SERVICE); @@ -259,9 +259,9 @@ public class CalculatorFunctionsFragment extends AbstractMathEntityListFragment< this.captionId = captionId; } - @NotNull + @Nonnull @Override - public String getCaption(@NotNull Context context) { + public String getCaption(@Nonnull Context context) { return context.getString(captionId); } } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/math/edit/CalculatorOperatorsActivity.java b/android-app/src/main/java/org/solovyev/android/calculator/math/edit/CalculatorOperatorsActivity.java index 2fc8a74f..29c9629c 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/math/edit/CalculatorOperatorsActivity.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/math/edit/CalculatorOperatorsActivity.java @@ -8,8 +8,8 @@ package org.solovyev.android.calculator.math.edit; import android.os.Bundle; import com.actionbarsherlock.app.SherlockFragmentActivity; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.*; import org.solovyev.android.calculator.history.CalculatorHistoryActivity; @@ -20,7 +20,7 @@ import org.solovyev.android.calculator.history.CalculatorHistoryActivity; */ public class CalculatorOperatorsActivity extends SherlockFragmentActivity implements CalculatorEventListener { - @NotNull + @Nonnull private final CalculatorActivityHelper activityHelper = CalculatorApplication.getInstance().createActivityHelper(R.layout.main_empty, CalculatorHistoryActivity.class.getSimpleName()); @Override @@ -71,7 +71,7 @@ public class CalculatorOperatorsActivity extends SherlockFragmentActivity implem } @Override - public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) { + public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) { switch (calculatorEventType) { case use_operator: this.finish(); diff --git a/android-app/src/main/java/org/solovyev/android/calculator/math/edit/CalculatorOperatorsFragment.java b/android-app/src/main/java/org/solovyev/android/calculator/math/edit/CalculatorOperatorsFragment.java index 2b420fc6..a4c563c5 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/math/edit/CalculatorOperatorsFragment.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/math/edit/CalculatorOperatorsFragment.java @@ -4,7 +4,7 @@ import android.app.Activity; import android.content.Context; import android.text.ClipboardManager; import jscl.math.operator.Operator; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.calculator.CalculatorEventType; import org.solovyev.android.calculator.CalculatorFragmentType; import org.solovyev.android.calculator.Locator; @@ -34,9 +34,9 @@ public class CalculatorOperatorsFragment extends AbstractMathEntityListFragment< return LongClickMenuItem.use; } - @NotNull + @Nonnull @Override - protected List> getMenuItemsOnLongClick(@NotNull Operator item) { + protected List> getMenuItemsOnLongClick(@Nonnull Operator item) { final List> result = new ArrayList>(Arrays.asList(LongClickMenuItem.values())); if (Strings.isEmpty(OperatorDescriptionGetter.instance.getDescription(this.getActivity(), item.getName()))) { @@ -46,14 +46,14 @@ public class CalculatorOperatorsFragment extends AbstractMathEntityListFragment< return result; } - @NotNull + @Nonnull @Override protected MathEntityDescriptionGetter getDescriptionGetter() { return OperatorDescriptionGetter.instance; } - @NotNull + @Nonnull @Override protected List getMathEntities() { final List result = new ArrayList(); @@ -65,7 +65,7 @@ public class CalculatorOperatorsFragment extends AbstractMathEntityListFragment< } @Override - protected String getMathEntityCategory(@NotNull Operator operator) { + protected String getMathEntityCategory(@Nonnull Operator operator) { String result = Locator.getInstance().getEngine().getOperatorsRegistry().getCategory(operator); if (result == null) { result = Locator.getInstance().getEngine().getPostfixFunctionsRegistry().getCategory(operator); @@ -79,7 +79,7 @@ public class CalculatorOperatorsFragment extends AbstractMathEntityListFragment< instance; @Override - public String getDescription(@NotNull Context context, @NotNull String mathEntityName) { + public String getDescription(@Nonnull Context context, @Nonnull String mathEntityName) { String result = Locator.getInstance().getEngine().getOperatorsRegistry().getDescription(mathEntityName); if (Strings.isEmpty(result)) { result = Locator.getInstance().getEngine().getPostfixFunctionsRegistry().getDescription(mathEntityName); @@ -101,14 +101,14 @@ public class CalculatorOperatorsFragment extends AbstractMathEntityListFragment< use(R.string.c_use) { @Override - public void onClick(@NotNull Operator data, @NotNull Context context) { + public void onClick(@Nonnull Operator data, @Nonnull Context context) { Locator.getInstance().getCalculator().fireCalculatorEvent(CalculatorEventType.use_operator, data); } }, copy_description(R.string.c_copy_description) { @Override - public void onClick(@NotNull Operator data, @NotNull Context context) { + public void onClick(@Nonnull Operator data, @Nonnull Context context) { final String text = OperatorDescriptionGetter.instance.getDescription(context, data.getName()); if (!Strings.isEmpty(text)) { final ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Activity.CLIPBOARD_SERVICE); @@ -122,9 +122,9 @@ public class CalculatorOperatorsFragment extends AbstractMathEntityListFragment< this.captionId = captionId; } - @NotNull + @Nonnull @Override - public String getCaption(@NotNull Context context) { + public String getCaption(@Nonnull Context context) { return context.getString(captionId); } } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/math/edit/CalculatorVarsActivity.java b/android-app/src/main/java/org/solovyev/android/calculator/math/edit/CalculatorVarsActivity.java index 292841b0..78bdb506 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/math/edit/CalculatorVarsActivity.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/math/edit/CalculatorVarsActivity.java @@ -9,8 +9,8 @@ package org.solovyev.android.calculator.math.edit; import android.content.Intent; import android.os.Bundle; import com.actionbarsherlock.app.SherlockFragmentActivity; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.*; import org.solovyev.android.calculator.history.CalculatorHistoryActivity; @@ -21,7 +21,7 @@ import org.solovyev.android.calculator.history.CalculatorHistoryActivity; */ public class CalculatorVarsActivity extends SherlockFragmentActivity implements CalculatorEventListener { - @NotNull + @Nonnull private final CalculatorActivityHelper activityHelper = CalculatorApplication.getInstance().createActivityHelper(R.layout.main_empty, CalculatorHistoryActivity.class.getSimpleName()); @Override @@ -94,7 +94,7 @@ public class CalculatorVarsActivity extends SherlockFragmentActivity implements } @Override - public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) { + public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) { switch (calculatorEventType) { case use_constant: this.finish(); diff --git a/android-app/src/main/java/org/solovyev/android/calculator/math/edit/CalculatorVarsFragment.java b/android-app/src/main/java/org/solovyev/android/calculator/math/edit/CalculatorVarsFragment.java index 296127bf..90e01499 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/math/edit/CalculatorVarsFragment.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/math/edit/CalculatorVarsFragment.java @@ -14,8 +14,8 @@ import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.MenuInflater; import com.actionbarsherlock.view.MenuItem; import jscl.math.function.IConstant; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.*; import org.solovyev.android.calculator.math.MathType; import org.solovyev.android.menu.AMenuItem; @@ -64,9 +64,9 @@ public class CalculatorVarsFragment extends AbstractMathEntityListFragment> getMenuItemsOnLongClick(@NotNull IConstant item) { + protected List> getMenuItemsOnLongClick(@Nonnull IConstant item) { final List> result = new ArrayList>(Arrays.asList(LongClickMenuItem.values())); if (item.isSystem()) { @@ -85,18 +85,18 @@ public class CalculatorVarsFragment extends AbstractMathEntityListFragment getMathEntities() { final List result = new ArrayList(Locator.getInstance().getEngine().getVarsRegistry().getEntities()); @@ -112,11 +112,11 @@ public class CalculatorVarsFragment extends AbstractMathEntityListFragment constants = expression.getUndefinedVars(); @@ -158,7 +158,7 @@ public class CalculatorVarsFragment extends AbstractMathEntityListFragment change) { + private void processConstantChanged(@Nonnull final Change change) { final IConstant newConstant = change.getNewValue(); if (this.isInCategory(newConstant)) { getUiHandler().post(new Runnable() { @@ -202,7 +202,7 @@ public class CalculatorVarsFragment extends AbstractMathEntityListFragment { use(R.string.c_use) { @Override - public void onClick(@NotNull IConstant data, @NotNull Context context) { + public void onClick(@Nonnull IConstant data, @Nonnull Context context) { Locator.getInstance().getCalculator().fireCalculatorEvent(CalculatorEventType.use_constant, data); } }, edit(R.string.c_edit) { @Override - public void onClick(@NotNull IConstant constant, @NotNull Context context) { + public void onClick(@Nonnull IConstant constant, @Nonnull Context context) { VarEditDialogFragment.showDialog(VarEditDialogFragment.Input.newFromConstant(constant), ((SherlockFragmentActivity) context).getSupportFragmentManager()); } }, remove(R.string.c_remove) { @Override - public void onClick(@NotNull IConstant constant, @NotNull Context context) { + public void onClick(@Nonnull IConstant constant, @Nonnull Context context) { MathEntityRemover.newConstantRemover(constant, null, context, context).showConfirmationDialog(); } }, copy_value(R.string.c_copy_value) { @Override - public void onClick(@NotNull IConstant data, @NotNull Context context) { + public void onClick(@Nonnull IConstant data, @Nonnull Context context) { final String text = data.getValue(); if (!Strings.isEmpty(text)) { assert text != null; @@ -257,7 +257,7 @@ public class CalculatorVarsFragment extends AbstractMathEntityListFragment implements View.OnClickListener, DialogInterface.OnClickListener { - @NotNull + @Nonnull private final T mathEntity; @Nullable @@ -36,16 +36,16 @@ public class MathEntityRemover implements View.OnClickList private final boolean confirmed; - @NotNull + @Nonnull private final CalculatorMathRegistry varsRegistry; - @NotNull + @Nonnull private Context context; - @NotNull + @Nonnull private final Object source; - @NotNull + @Nonnull private final Params params; /* @@ -56,13 +56,13 @@ public class MathEntityRemover implements View.OnClickList ********************************************************************** */ - private MathEntityRemover(@NotNull T mathEntity, + private MathEntityRemover(@Nonnull T mathEntity, @Nullable DialogInterface.OnClickListener callbackOnCancel, boolean confirmed, - @NotNull CalculatorMathRegistry varsRegistry, - @NotNull Context context, - @NotNull Object source, - @NotNull Params params) { + @Nonnull CalculatorMathRegistry varsRegistry, + @Nonnull Context context, + @Nonnull Object source, + @Nonnull Params params) { this.mathEntity = mathEntity; this.callbackOnCancel = callbackOnCancel; this.confirmed = confirmed; @@ -72,17 +72,17 @@ public class MathEntityRemover implements View.OnClickList this.params = params; } - public static MathEntityRemover newConstantRemover(@NotNull IConstant constant, + public static MathEntityRemover newConstantRemover(@Nonnull IConstant constant, @Nullable DialogInterface.OnClickListener callbackOnCancel, - @NotNull Context context, - @NotNull Object source) { + @Nonnull Context context, + @Nonnull Object source) { return new MathEntityRemover(constant, callbackOnCancel, false, Locator.getInstance().getEngine().getVarsRegistry(), context, source, Params.newConstantInstance()); } - public static MathEntityRemover newFunctionRemover(@NotNull Function function, + public static MathEntityRemover newFunctionRemover(@Nonnull Function function, @Nullable DialogInterface.OnClickListener callbackOnCancel, - @NotNull Context context, - @NotNull Object source) { + @Nonnull Context context, + @Nonnull Object source) { return new MathEntityRemover(function, callbackOnCancel, false, Locator.getInstance().getEngine().getFunctionsRegistry(), context, source, Params.newFunctionInstance()); } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/math/edit/VarEditDialogFragment.java b/android-app/src/main/java/org/solovyev/android/calculator/math/edit/VarEditDialogFragment.java index f78c5cf7..8b9278c3 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/math/edit/VarEditDialogFragment.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/math/edit/VarEditDialogFragment.java @@ -12,8 +12,8 @@ import android.view.WindowManager; import android.widget.EditText; import android.widget.Toast; import jscl.math.function.IConstant; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.*; import org.solovyev.android.calculator.model.Var; import org.solovyev.android.sherlock.AndroidSherlockUtils; @@ -25,14 +25,14 @@ import org.solovyev.android.sherlock.AndroidSherlockUtils; */ public class VarEditDialogFragment extends DialogFragment implements CalculatorEventListener { - @NotNull + @Nonnull private final Input input; public VarEditDialogFragment() { this(Input.newInstance()); } - public VarEditDialogFragment(@NotNull Input input) { + public VarEditDialogFragment(@Nonnull Input input) { this.input = input; } @@ -56,7 +56,7 @@ public class VarEditDialogFragment extends DialogFragment implements CalculatorE } @Override - public void onViewCreated(@NotNull View root, Bundle savedInstanceState) { + public void onViewCreated(@Nonnull View root, Bundle savedInstanceState) { super.onViewCreated(root, savedInstanceState); final String errorMsg = this.getString(R.string.c_char_is_not_accepted); @@ -126,7 +126,7 @@ public class VarEditDialogFragment extends DialogFragment implements CalculatorE } @Override - public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) { + public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) { switch (calculatorEventType) { case constant_removed: case constant_added: @@ -147,7 +147,7 @@ public class VarEditDialogFragment extends DialogFragment implements CalculatorE ********************************************************************** */ - public static void showDialog(@NotNull Input input, @NotNull FragmentManager fm) { + public static void showDialog(@Nonnull Input input, @Nonnull FragmentManager fm) { AndroidSherlockUtils.showDialog(new VarEditDialogFragment(input), "constant-editor", fm); } @@ -168,26 +168,26 @@ public class VarEditDialogFragment extends DialogFragment implements CalculatorE private Input() { } - @NotNull + @Nonnull public static Input newInstance() { return new Input(); } - @NotNull - public static Input newFromConstant(@NotNull IConstant constant) { + @Nonnull + public static Input newFromConstant(@Nonnull IConstant constant) { final Input result = new Input(); result.constant = constant; return result; } - @NotNull + @Nonnull public static Input newFromValue(@Nullable String value) { final Input result = new Input(); result.value = value; return result; } - @NotNull + @Nonnull public static Input newInstance(@Nullable IConstant constant, @Nullable String name, @Nullable String value, @Nullable String description) { final Input result = new Input(); result.constant = constant; diff --git a/android-app/src/main/java/org/solovyev/android/calculator/math/edit/VarEditorSaver.java b/android-app/src/main/java/org/solovyev/android/calculator/math/edit/VarEditorSaver.java index 5620e72e..3517d4af 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/math/edit/VarEditorSaver.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/math/edit/VarEditorSaver.java @@ -12,8 +12,8 @@ import jscl.text.Identifier; import jscl.text.MutableInt; import jscl.text.ParseException; import jscl.text.Parser; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.CalculatorMathRegistry; import org.solovyev.android.calculator.CalculatorVarsRegistry; import org.solovyev.android.calculator.Locator; @@ -31,26 +31,26 @@ import org.solovyev.common.text.Strings; */ public class VarEditorSaver implements View.OnClickListener { - @NotNull + @Nonnull private final MathEntityBuilder varBuilder; @Nullable private final T editedInstance; - @NotNull + @Nonnull private final CalculatorMathRegistry mathRegistry; - @NotNull + @Nonnull private final Object source; - @NotNull + @Nonnull private View editView; - public VarEditorSaver(@NotNull MathEntityBuilder varBuilder, + public VarEditorSaver(@Nonnull MathEntityBuilder varBuilder, @Nullable T editedInstance, - @NotNull View editView, - @NotNull CalculatorMathRegistry mathRegistry, - @NotNull Object source) { + @Nonnull View editView, + @Nonnull CalculatorMathRegistry mathRegistry, + @Nonnull Object source) { this.varBuilder = varBuilder; this.editedInstance = editedInstance; this.editView = editView; diff --git a/android-app/src/main/java/org/solovyev/android/calculator/matrix/CalculatorMatrixEditFragment.java b/android-app/src/main/java/org/solovyev/android/calculator/matrix/CalculatorMatrixEditFragment.java index 0f58aa46..8d9432b4 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/matrix/CalculatorMatrixEditFragment.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/matrix/CalculatorMatrixEditFragment.java @@ -2,8 +2,8 @@ package org.solovyev.android.calculator.matrix; import android.os.Bundle; import android.view.View; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.CalculatorFragment; import org.solovyev.android.calculator.CalculatorFragmentType; import org.solovyev.android.calculator.R; @@ -86,24 +86,24 @@ public class CalculatorMatrixEditFragment extends CalculatorFragment implements } @Override - public void onSaveInstanceState(@NotNull Bundle out) { + public void onSaveInstanceState(@Nonnull Bundle out) { super.onSaveInstanceState(out); out.putSerializable(MATRIX, new Matrix(getMatrixView(getView()).toMatrix())); } - @NotNull - private MatrixView getMatrixView(@NotNull View root) { + @Nonnull + private MatrixView getMatrixView(@Nonnull View root) { return (MatrixView) root.findViewById(R.id.matrix_layout); } - private void initPicker(@NotNull Picker picker) { + private void initPicker(@Nonnull Picker picker) { picker.setRange(new IntegerRange(MIN_COUNT, MAX_COUNT, 1, 0, null)); picker.setOnChangeListener(this); } @Override - public void onChanged(@NotNull Picker picker, @NotNull Integer value) { + public void onChanged(@Nonnull Picker picker, @Nonnull Integer value) { switch (picker.getId()) { case R.id.matrix_rows_count_picker: onRowsCountChange(value); @@ -114,23 +114,23 @@ public class CalculatorMatrixEditFragment extends CalculatorFragment implements } } - private void onColsCountChange(@NotNull Integer newCols) { + private void onColsCountChange(@Nonnull Integer newCols) { getMatrixView(getView()).setMatrixCols(newCols); } - private void onRowsCountChange(@NotNull Integer newRows) { + private void onRowsCountChange(@Nonnull Integer newRows) { getMatrixView(getView()).setMatrixRows(newRows); } public static class Matrix implements Serializable { - @NotNull + @Nonnull private String[][] bakingArray; public Matrix() { } - public Matrix(@NotNull String[][] bakingArray) { + public Matrix(@Nonnull String[][] bakingArray) { this.bakingArray = bakingArray; } } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/matrix/MatrixView.java b/android-app/src/main/java/org/solovyev/android/calculator/matrix/MatrixView.java index 28cabfd7..9cb75610 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/matrix/MatrixView.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/matrix/MatrixView.java @@ -8,8 +8,8 @@ import android.widget.EditText; import android.widget.TableLayout; import android.widget.TableRow; import android.widget.TextView; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; /** * User: Solovyev_S @@ -122,7 +122,7 @@ public class MatrixView extends TableLayout { } } - public void setMatrix(@NotNull Object[][] matrix) { + public void setMatrix(@Nonnull Object[][] matrix) { final int rows = matrix.length; final int cols = matrix[0].length; @@ -134,7 +134,7 @@ public class MatrixView extends TableLayout { } } - @NotNull + @Nonnull public String[][] toMatrix() { final String[][] result = new String[rows][cols]; @@ -223,11 +223,11 @@ public class MatrixView extends TableLayout { } @Nullable - private View getCell(@NotNull View view, int row, int col) { + private View getCell(@Nonnull View view, int row, int col) { return view.findViewWithTag(getCellTag(row, col)); } - @NotNull + @Nonnull private String getRowTag(int row) { if (row != NUMBER_INDEX) { return "row_" + row; @@ -236,7 +236,7 @@ public class MatrixView extends TableLayout { } } - @NotNull + @Nonnull private View createRowView(int row, int cols) { final ViewGroup rowView = new TableRow(this.getContext()); @@ -255,7 +255,7 @@ public class MatrixView extends TableLayout { return rowView; } - @NotNull + @Nonnull private View createCellView(int row, int col) { final TextView result; @@ -277,7 +277,7 @@ public class MatrixView extends TableLayout { } - @NotNull + @Nonnull private String getCellTag(int row, int col) { if (row != NUMBER_INDEX) { return "cell_" + row + "_" + col; diff --git a/android-app/src/main/java/org/solovyev/android/calculator/plot/AbstractCalculatorPlotFragment.java b/android-app/src/main/java/org/solovyev/android/calculator/plot/AbstractCalculatorPlotFragment.java index cbe55ea2..b778462f 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/plot/AbstractCalculatorPlotFragment.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/plot/AbstractCalculatorPlotFragment.java @@ -5,6 +5,7 @@ import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Bitmap; import android.graphics.Paint; +import android.os.Build; import android.os.Bundle; import android.os.Environment; import android.preference.PreferenceManager; @@ -14,8 +15,8 @@ import com.actionbarsherlock.app.SherlockFragmentActivity; import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.MenuInflater; import com.actionbarsherlock.view.MenuItem; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.Android; import org.solovyev.android.Threads; import org.solovyev.android.calculator.*; @@ -64,17 +65,17 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment private int bgColor; - @NotNull + @Nonnull private PlotData plotData = new PlotData(Collections.emptyList(), false, PlotBoundaries.newDefaultInstance()); - @NotNull + @Nonnull private ActivityMenu fragmentMenu; // thread which calculated data for graph view - @NotNull + @Nonnull private final Executor plotExecutor = Executors.newSingleThreadExecutor(); - @NotNull + @Nonnull private final CalculatorEventHolder lastEventHolder = new CalculatorEventHolder(CalculatorUtils.createFirstEventDataId()); @@ -133,7 +134,7 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment } @Override - public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable final Object data) { + public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable final Object data) { switch (calculatorEventType) { case plot_data_changed: final CalculatorEventHolder.Result result = this.lastEventHolder.apply(calculatorEventData); @@ -145,14 +146,14 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment } - private void onNewPlotData(@NotNull final PlotData plotData) { + private void onNewPlotData(@Nonnull final PlotData plotData) { this.plotData = plotData; final SherlockFragmentActivity activity = getSherlockActivity(); updateChart(plotData, activity); } - private void updateChart(@NotNull final PlotData plotData, @Nullable final SherlockFragmentActivity activity) { + private void updateChart(@Nonnull final PlotData plotData, @Nullable final SherlockFragmentActivity activity) { Threads.tryRunOnUiThread(activity, new Runnable() { @Override public void run() { @@ -170,9 +171,9 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment protected abstract void onError(); - protected abstract void createGraphicalView(@NotNull View view, @NotNull PlotData plotData); + protected abstract void createGraphicalView(@Nonnull View view, @Nonnull PlotData plotData); - protected abstract void createChart(@NotNull PlotData plotData); + protected abstract void createChart(@Nonnull PlotData plotData); /* ********************************************************************** @@ -186,7 +187,7 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment return bgColor; } - @NotNull + @Nonnull public Executor getPlotExecutor() { return plotExecutor; } @@ -208,14 +209,14 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment menuItems.add(PlotMenu.functions); final IdentifiableMenuItem plotRangeMenuItem = new IdentifiableMenuItem() { - @NotNull + @Nonnull @Override public Integer getItemId() { return R.id.menu_plot_range; } @Override - public void onClick(@NotNull MenuItem data, @NotNull Context context) { + public void onClick(@Nonnull MenuItem data, @Nonnull Context context) { savePlotBoundaries(); context.startActivity(new Intent(context, CalculatorPlotRangeActivity.class)); @@ -224,14 +225,14 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment menuItems.add(plotRangeMenuItem); final IdentifiableMenuItem plot3dMenuItem = new IdentifiableMenuItem() { - @NotNull + @Nonnull @Override public Integer getItemId() { return R.id.menu_plot_3d; } @Override - public void onClick(@NotNull MenuItem data, @NotNull Context context) { + public void onClick(@Nonnull MenuItem data, @Nonnull Context context) { savePlotBoundaries(); Locator.getInstance().getPlotter().setPlot3d(true); @@ -241,14 +242,14 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment final IdentifiableMenuItem plot2dMenuItem = new IdentifiableMenuItem() { - @NotNull + @Nonnull @Override public Integer getItemId() { return R.id.menu_plot_2d; } @Override - public void onClick(@NotNull MenuItem data, @NotNull Context context) { + public void onClick(@Nonnull MenuItem data, @Nonnull Context context) { savePlotBoundaries(); Locator.getInstance().getPlotter().setPlot3d(false); @@ -257,14 +258,14 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment menuItems.add(plot2dMenuItem); final IdentifiableMenuItem captureScreenshotMenuItem = new IdentifiableMenuItem() { - @NotNull + @Nonnull @Override public Integer getItemId() { return R.id.menu_plot_schreeshot; } @Override - public void onClick(@NotNull MenuItem data, @NotNull Context context) { + public void onClick(@Nonnull MenuItem data, @Nonnull Context context) { captureScreehshot(); } }; @@ -299,14 +300,14 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment protected abstract boolean isScreenshotSupported(); - @NotNull + @Nonnull protected abstract Bitmap getScreehshot(); private void captureScreehshot() { if (isScreenshotSupported()) { final Bitmap screenshot = getScreehshot(); final String screenShotFileName = generateScreenshotFileName(); - final File externalFilesDir = getActivity().getExternalFilesDir(Environment.DIRECTORY_PICTURES); + final File externalFilesDir = getActivity().getExternalFilesDir(getPicturesDirectory()); if (externalFilesDir != null) { final String path = externalFilesDir.getPath(); Android.saveBitmap(screenshot, path, screenShotFileName); @@ -317,6 +318,14 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment } } + private String getPicturesDirectory() { + if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) { + return Environment.DIRECTORY_PICTURES; + } else { + return "Pictures"; + } + } + private String generateScreenshotFileName() { final Date now = new Date(); final String timestamp = new SimpleDateFormat("yyyy.MM.dd HH.mm.ss.S").format(now); @@ -353,14 +362,14 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment functions(R.id.menu_plot_functions) { @Override - public void onClick(@NotNull MenuItem data, @NotNull Context context) { + public void onClick(@Nonnull MenuItem data, @Nonnull Context context) { context.startActivity(new Intent(context, CalculatorPlotFunctionsActivity.class)); } }, preferences(R.id.menu_plot_settings) { @Override - public void onClick(@NotNull MenuItem data, @NotNull Context context) { + public void onClick(@Nonnull MenuItem data, @Nonnull Context context) { context.startActivity(new Intent(context, CalculatorPlotPreferenceActivity.class)); } }; @@ -372,14 +381,14 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment } - @NotNull + @Nonnull @Override public Integer getItemId() { return itemId; } } - public static void applyToPaint(@NotNull PlotLineDef plotLineDef, @NotNull Paint paint) { + public static void applyToPaint(@Nonnull PlotLineDef plotLineDef, @Nonnull Paint paint) { paint.setColor(plotLineDef.getLineColor()); paint.setStyle(Paint.Style.STROKE); diff --git a/android-app/src/main/java/org/solovyev/android/calculator/plot/AbstractGraphCalculator.java b/android-app/src/main/java/org/solovyev/android/calculator/plot/AbstractGraphCalculator.java index 87b68423..2fdf934b 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/plot/AbstractGraphCalculator.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/plot/AbstractGraphCalculator.java @@ -1,6 +1,6 @@ package org.solovyev.android.calculator.plot; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; /** * User: serso @@ -9,22 +9,22 @@ import org.jetbrains.annotations.NotNull; */ public abstract class AbstractGraphCalculator implements GraphCalculator { - @NotNull + @Nonnull protected final GraphData next = GraphData.newEmptyInstance(); - @NotNull + @Nonnull private final GraphData endGraph = GraphData.newEmptyInstance(); - @NotNull + @Nonnull private final GraphData startGraph = GraphData.newEmptyInstance(); @Override - public final void computeGraph(@NotNull XyFunction f, + public final void computeGraph(@Nonnull XyFunction f, float xMin, float xMax, - @NotNull GraphData graph, - @NotNull GraphsData graphsData, - @NotNull Graph2dDimensions dimensions) { + @Nonnull GraphData graph, + @Nonnull GraphsData graphsData, + @Nonnull Graph2dDimensions dimensions) { if (f.getArity() == 0) { final float v = (float) f.eval(); graph.clear(); @@ -96,11 +96,11 @@ public abstract class AbstractGraphCalculator implements GraphCalculator { startGraph.clear(); } - protected abstract void compute(@NotNull XyFunction f, + protected abstract void compute(@Nonnull XyFunction f, float xMin, float xMax, float yMin, float yMax, - @NotNull GraphData graph, - @NotNull Graph2dDimensions dimensions); + @Nonnull GraphData graph, + @Nonnull Graph2dDimensions dimensions); } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/plot/CalculatorGraph2dView.java b/android-app/src/main/java/org/solovyev/android/calculator/plot/CalculatorGraph2dView.java index b4f96716..e6cfad79 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/plot/CalculatorGraph2dView.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/plot/CalculatorGraph2dView.java @@ -8,7 +8,7 @@ import android.view.MotionEvent; import android.view.View; import android.widget.Scroller; import android.widget.ZoomButtonsController; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.common.math.Point2d; import java.text.DecimalFormat; @@ -46,41 +46,41 @@ public class CalculatorGraph2dView extends View implements GraphView { ********************************************************************** */ - @NotNull + @Nonnull private final Matrix matrix = new Matrix(); // paints - @NotNull + @Nonnull private final Paint paint = new Paint(); - @NotNull + @Nonnull private final Paint textPaint = new Paint(); - @NotNull + @Nonnull private GraphViewHelper graphViewHelper = GraphViewHelper.newDefaultInstance(); - @NotNull + @Nonnull private final GraphsData graphsData = new GraphsData(this); private float lastTouchXPxs = NO_TOUCH; private float lastTouchYPxs = NO_TOUCH; - @NotNull + @Nonnull private TouchHandler touchHandler; - @NotNull + @Nonnull protected ZoomButtonsController zoomController = new ZoomButtonsController(this); - @NotNull + @Nonnull private ZoomTracker zoomTracker = new ZoomTracker(); - @NotNull + @Nonnull private Scroller scroller; - @NotNull + @Nonnull private final Graph2dDimensions dimensions = new Graph2dDimensions(this); - @NotNull + @Nonnull private final GraphCalculator graphCalculator = new GraphCalculatorImpl(); private boolean mDrawn = false; @@ -115,7 +115,7 @@ public class CalculatorGraph2dView extends View implements GraphView { } @Override - public void init(@NotNull PlotViewDef plotViewDef) { + public void init(@Nonnull PlotViewDef plotViewDef) { this.graphViewHelper = GraphViewHelper.newInstance(plotViewDef, Collections.emptyList()); } @@ -127,7 +127,7 @@ public class CalculatorGraph2dView extends View implements GraphView { ********************************************************************** */ - public void setPlotFunctions(@NotNull List plotFunctions) { + public void setPlotFunctions(@Nonnull List plotFunctions) { for (PlotFunction plotFunction : plotFunctions) { final int arity = plotFunction.getXyFunction().getArity(); @@ -140,7 +140,7 @@ public class CalculatorGraph2dView extends View implements GraphView { invalidateGraphs(); } - @NotNull + @Nonnull @Override public List getPlotFunctions() { return this.graphViewHelper.getPlotFunctions(); @@ -151,7 +151,7 @@ public class CalculatorGraph2dView extends View implements GraphView { onPause(); } - @NotNull + @Nonnull public Bitmap captureScreenshot() { final Bitmap result = Bitmap.createBitmap(dimensions.getVWidthPxs(), dimensions.getVHeightPxs(), Bitmap.Config.RGB_565); onDraw(new Canvas(result)); @@ -183,7 +183,7 @@ public class CalculatorGraph2dView extends View implements GraphView { dimensions.setViewDimensions(w, h); } - protected void onDraw(@NotNull Canvas canvas) { + protected void onDraw(@Nonnull Canvas canvas) { if (!graphViewHelper.getPlotFunctions().isEmpty()) { if (scroller.computeScrollOffset()) { @@ -199,7 +199,7 @@ public class CalculatorGraph2dView extends View implements GraphView { } } - private static void graphToPath(@NotNull GraphData graph, @NotNull Path path) { + private static void graphToPath(@Nonnull GraphData graph, @Nonnull Path path) { final int size = graph.getSize(); final float[] xs = graph.getXs(); @@ -227,7 +227,7 @@ public class CalculatorGraph2dView extends View implements GraphView { } } - private void drawGraph(@NotNull Canvas canvas) { + private void drawGraph(@Nonnull Canvas canvas) { mDrawn = true; final float graphWidth = dimensions.getGWidth(); @@ -300,8 +300,8 @@ public class CalculatorGraph2dView extends View implements GraphView { graphsData.setLastXMax(xMax); } - @NotNull - private TickDigits drawGridAndAxis(@NotNull Canvas canvas) { + @Nonnull + private TickDigits drawGridAndAxis(@Nonnull Canvas canvas) { final TickDigits result = new TickDigits(); final float xMin = dimensions.getXMin(); @@ -412,7 +412,7 @@ public class CalculatorGraph2dView extends View implements GraphView { ********************************************************************** */ - @NotNull + @Nonnull public static CharSequence formatTick(final float tickValue, final int tickDigits) { String result = "0"; @@ -545,7 +545,7 @@ public class CalculatorGraph2dView extends View implements GraphView { */ @Override - public boolean onTouchEvent(@NotNull MotionEvent event) { + public boolean onTouchEvent(@Nonnull MotionEvent event) { boolean handled = touchHandler.handleTouchEvent(event); if (!handled) { handled = super.onTouchEvent(event); diff --git a/android-app/src/main/java/org/solovyev/android/calculator/plot/CalculatorGraph3dView.java b/android-app/src/main/java/org/solovyev/android/calculator/plot/CalculatorGraph3dView.java index f550fb02..ba67da98 100755 --- a/android-app/src/main/java/org/solovyev/android/calculator/plot/CalculatorGraph3dView.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/plot/CalculatorGraph3dView.java @@ -7,7 +7,7 @@ import android.os.Build; import android.util.AttributeSet; import android.view.MotionEvent; import android.widget.ZoomButtonsController; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import javax.microedition.khronos.opengles.GL10; import javax.microedition.khronos.opengles.GL11; @@ -44,13 +44,13 @@ public class CalculatorGraph3dView extends GLView implements GraphView { private float zoomStep = 0; private float currentZoom; - @NotNull + @Nonnull private List graphs = new ArrayList(); - @NotNull + @Nonnull private GraphViewHelper graphViewHelper = GraphViewHelper.newDefaultInstance(); - @NotNull + @Nonnull private Graph2dDimensions dimensions = new Graph2dDimensions(this); /* @@ -136,12 +136,12 @@ public class CalculatorGraph3dView extends GLView implements GraphView { } @Override - public void init(@NotNull PlotViewDef plotViewDef) { + public void init(@Nonnull PlotViewDef plotViewDef) { this.graphViewHelper = GraphViewHelper.newInstance(plotViewDef, Collections.emptyList()); } @Override - public void setPlotFunctions(@NotNull List plotFunctions) { + public void setPlotFunctions(@Nonnull List plotFunctions) { for (PlotFunction plotFunction : plotFunctions) { final int arity = plotFunction.getXyFunction().getArity(); if (arity != 0 && arity != 1 && arity != 2) { @@ -154,7 +154,7 @@ public class CalculatorGraph3dView extends GLView implements GraphView { dirty = true; } - @NotNull + @Nonnull @Override public List getPlotFunctions() { return this.graphViewHelper.getPlotFunctions(); @@ -278,7 +278,7 @@ public class CalculatorGraph3dView extends GLView implements GraphView { } - private void ensureGraphsSize(@NotNull GL11 gl) { + private void ensureGraphsSize(@Nonnull GL11 gl) { while (graphViewHelper.getPlotFunctions().size() > graphs.size()) { graphs.add(new Graph3d(gl, useHighQuality3d)); } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/plot/CalculatorPlotActivity.java b/android-app/src/main/java/org/solovyev/android/calculator/plot/CalculatorPlotActivity.java index 7ba32105..9639c446 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/plot/CalculatorPlotActivity.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/plot/CalculatorPlotActivity.java @@ -3,8 +3,8 @@ package org.solovyev.android.calculator.plot; import android.app.ActionBar; import android.content.Intent; import android.os.Bundle; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.CalculatorFragmentActivity; import org.solovyev.android.calculator.CalculatorFragmentType; import org.solovyev.android.calculator.R; @@ -33,7 +33,7 @@ public class CalculatorPlotActivity extends CalculatorFragmentActivity { getActivityHelper().setFragment(this, getPlotterFragmentType(), arguments, R.id.main_layout); } - @NotNull + @Nonnull public static CalculatorFragmentType getPlotterFragmentType() { return CalculatorFragmentType.plotter; } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/plot/CalculatorPlotFragment.java b/android-app/src/main/java/org/solovyev/android/calculator/plot/CalculatorPlotFragment.java index 9d97104c..42fed508 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/plot/CalculatorPlotFragment.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/plot/CalculatorPlotFragment.java @@ -4,8 +4,8 @@ import android.graphics.Bitmap; import android.graphics.Color; import android.view.View; import android.view.ViewGroup; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.R; /** @@ -29,7 +29,7 @@ public class CalculatorPlotFragment extends AbstractCalculatorPlotFragment { } @Override - protected void createGraphicalView(@NotNull View root, @NotNull PlotData plotData) { + protected void createGraphicalView(@Nonnull View root, @Nonnull PlotData plotData) { // remove old final ViewGroup graphContainer = (ViewGroup) root.findViewById(R.id.main_fragment_layout); @@ -59,7 +59,7 @@ public class CalculatorPlotFragment extends AbstractCalculatorPlotFragment { } @Override - protected void createChart(@NotNull PlotData plotData) { + protected void createChart(@Nonnull PlotData plotData) { } @Override @@ -67,7 +67,7 @@ public class CalculatorPlotFragment extends AbstractCalculatorPlotFragment { return true; } - @NotNull + @Nonnull @Override protected Bitmap getScreehshot() { assert this.graphView != null; diff --git a/android-app/src/main/java/org/solovyev/android/calculator/plot/CalculatorPlotFunctionSettingsActivity.java b/android-app/src/main/java/org/solovyev/android/calculator/plot/CalculatorPlotFunctionSettingsActivity.java index 2bc8d33c..8de69bef 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/plot/CalculatorPlotFunctionSettingsActivity.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/plot/CalculatorPlotFunctionSettingsActivity.java @@ -11,8 +11,8 @@ import android.widget.Button; import android.widget.SeekBar; import android.widget.Spinner; import com.actionbarsherlock.app.SherlockFragmentActivity; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.CalculatorFragment; import org.solovyev.android.calculator.CalculatorFragmentType; import org.solovyev.android.calculator.Locator; @@ -23,7 +23,7 @@ public class CalculatorPlotFunctionSettingsActivity extends SherlockFragmentActi private static final String INPUT_FUNCTION_ID = "plot-function-id"; - public static void startActivity(@NotNull Context context, @NotNull PlotFunction plotFunction) { + public static void startActivity(@Nonnull Context context, @Nonnull PlotFunction plotFunction) { final Intent intent = new Intent(context, CalculatorPlotFunctionSettingsActivity.class); intent.putExtra(INPUT_FUNCTION_ID, plotFunction.getXyFunction().getId()); context.startActivity(intent); @@ -65,7 +65,7 @@ public class CalculatorPlotFunctionSettingsActivity extends SherlockFragmentActi @Nullable private PlotFunction plotFunction; - @NotNull + @Nonnull private final CalculatorPlotter plotter = Locator.getInstance().getPlotter(); public CalculatorPlotFunctionSettingsFragment() { diff --git a/android-app/src/main/java/org/solovyev/android/calculator/plot/CalculatorPlotFunctionsActivity.java b/android-app/src/main/java/org/solovyev/android/calculator/plot/CalculatorPlotFunctionsActivity.java index 51b70b49..4590ef6f 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/plot/CalculatorPlotFunctionsActivity.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/plot/CalculatorPlotFunctionsActivity.java @@ -4,7 +4,7 @@ import android.os.Bundle; import com.actionbarsherlock.app.SherlockFragmentActivity; import com.google.common.base.Function; import com.google.common.collect.Lists; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nullable; import org.solovyev.android.calculator.CalculatorFragmentType; import org.solovyev.android.calculator.CalculatorListFragment; import org.solovyev.android.calculator.Locator; diff --git a/android-app/src/main/java/org/solovyev/android/calculator/plot/CalculatorPlotRangeActivity.java b/android-app/src/main/java/org/solovyev/android/calculator/plot/CalculatorPlotRangeActivity.java index 03e5d430..d4793af5 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/plot/CalculatorPlotRangeActivity.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/plot/CalculatorPlotRangeActivity.java @@ -4,8 +4,8 @@ import android.os.Bundle; import android.view.View; import android.widget.EditText; import com.actionbarsherlock.app.SherlockFragmentActivity; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.CalculatorFragment; import org.solovyev.android.calculator.CalculatorFragmentType; import org.solovyev.android.calculator.Locator; @@ -36,7 +36,7 @@ public class CalculatorPlotRangeActivity extends SherlockFragmentActivity { } @Override - public void onViewCreated(@NotNull View root, Bundle savedInstanceState) { + public void onViewCreated(@Nonnull View root, Bundle savedInstanceState) { super.onViewCreated(root, savedInstanceState); final CalculatorPlotter plotter = Locator.getInstance().getPlotter(); diff --git a/android-app/src/main/java/org/solovyev/android/calculator/plot/GLView.java b/android-app/src/main/java/org/solovyev/android/calculator/plot/GLView.java index 336a382e..dc9e9998 100755 --- a/android-app/src/main/java/org/solovyev/android/calculator/plot/GLView.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/plot/GLView.java @@ -10,7 +10,7 @@ import android.util.AttributeSet; import android.util.Log; import android.view.SurfaceHolder; import android.view.SurfaceView; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import javax.microedition.khronos.egl.*; import javax.microedition.khronos.opengles.GL10; @@ -35,11 +35,15 @@ abstract class GLView extends SurfaceView implements SurfaceHolder.Callback { abstract void onSurfaceCreated(GL10 gl, int width, int height); - @NotNull + @Nonnull public Bitmap captureScreenshot() { - final Bitmap result = getRawPixels(gl, width, height); - bitmapBGRtoRGB(result, width, height); - return result; + if (gl != null) { + final Bitmap result = getRawPixels(gl, width, height); + bitmapBGRtoRGB(result, width, height); + return result; + } else { + return Bitmap.createBitmap(width == 0 ? 1 : width, height == 0 ? 1 : height, Bitmap.Config.RGB_565); + } } private static Bitmap getRawPixels(GL10 gl, int width, int height) { @@ -55,7 +59,7 @@ abstract class GLView extends SurfaceView implements SurfaceHolder.Callback { return bitmap; } - @NotNull + @Nonnull private final Handler uiHandler = new Handler() { public void handleMessage(Message msg) { switch (msg.what) { diff --git a/android-app/src/main/java/org/solovyev/android/calculator/plot/Graph2dDimensions.java b/android-app/src/main/java/org/solovyev/android/calculator/plot/Graph2dDimensions.java index a050440c..d6e9f6a9 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/plot/Graph2dDimensions.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/plot/Graph2dDimensions.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator.plot; import android.view.View; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.common.math.Point2d; /** @@ -40,7 +40,7 @@ public class Graph2dDimensions { * */ - @NotNull + @Nonnull private GraphView graphView; // view width and height in pixels @@ -55,7 +55,7 @@ public class Graph2dDimensions { private float gWidth = 20; private float gHeight = 20; - public Graph2dDimensions(@NotNull GraphView graphView) { + public Graph2dDimensions(@Nonnull GraphView graphView) { this.graphView = graphView; } @@ -67,7 +67,7 @@ public class Graph2dDimensions { ********************************************************************** */ - @NotNull + @Nonnull Point2d toGraphCoordinates(float xPxs, float yPxs) { return new Point2d(scaleXPxs(xPxs) + getXMin(), (getGHeight() - scaleYPxs(yPxs)) + getYMin()); } @@ -193,7 +193,7 @@ public class Graph2dDimensions { this.graphView.invalidateGraphs(); } - public void setViewDimensions(@NotNull View view) { + public void setViewDimensions(@Nonnull View view) { this.vWidthPxs = view.getWidth(); this.vHeightPxs = view.getHeight(); @@ -225,7 +225,7 @@ public class Graph2dDimensions { this.y0 += dy; } - @NotNull + @Nonnull public Graph2dDimensions copy() { final Graph2dDimensions copy = new Graph2dDimensions(this.graphView); diff --git a/android-app/src/main/java/org/solovyev/android/calculator/plot/Graph3d.java b/android-app/src/main/java/org/solovyev/android/calculator/plot/Graph3d.java index f4ae640f..29b8ce13 100755 --- a/android-app/src/main/java/org/solovyev/android/calculator/plot/Graph3d.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/plot/Graph3d.java @@ -3,7 +3,7 @@ package org.solovyev.android.calculator.plot; import android.graphics.Color; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import javax.microedition.khronos.opengles.GL10; import javax.microedition.khronos.opengles.GL11; @@ -91,7 +91,7 @@ class Graph3d { return bb; } - public void update(@NotNull GL11 gl, @NotNull PlotFunction fpd, @NotNull Graph2dDimensions dimensions) { + public void update(@Nonnull GL11 gl, @Nonnull PlotFunction fpd, @Nonnull Graph2dDimensions dimensions) { final XyFunction function = fpd.getXyFunction(); final PlotLineDef lineDef = fpd.getPlotLineDef(); final int NTICK = useHighQuality3d ? 5 : 0; @@ -227,7 +227,7 @@ class Graph3d { } } - private float fillFunctionPolygonVertices(XyFunction function, @NotNull Graph2dDimensions dimensions, float[] vertices) { + private float fillFunctionPolygonVertices(XyFunction function, @Nonnull Graph2dDimensions dimensions, float[] vertices) { final int arity = function.getArity(); final float xMin = dimensions.getXMin(); diff --git a/android-app/src/main/java/org/solovyev/android/calculator/plot/GraphCalculator.java b/android-app/src/main/java/org/solovyev/android/calculator/plot/GraphCalculator.java index 8a85f380..056c3392 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/plot/GraphCalculator.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/plot/GraphCalculator.java @@ -1,6 +1,6 @@ package org.solovyev.android.calculator.plot; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; /** * User: serso @@ -9,10 +9,10 @@ import org.jetbrains.annotations.NotNull; */ public interface GraphCalculator { - void computeGraph(@NotNull XyFunction f, + void computeGraph(@Nonnull XyFunction f, float xMin, float xMax, - @NotNull GraphData graph, - @NotNull GraphsData graphsData, - @NotNull Graph2dDimensions dimensions); + @Nonnull GraphData graph, + @Nonnull GraphsData graphsData, + @Nonnull Graph2dDimensions dimensions); } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/plot/GraphCalculatorImpl.java b/android-app/src/main/java/org/solovyev/android/calculator/plot/GraphCalculatorImpl.java index 334dbede..355ecb7e 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/plot/GraphCalculatorImpl.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/plot/GraphCalculatorImpl.java @@ -1,6 +1,6 @@ package org.solovyev.android.calculator.plot; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; /** * User: serso @@ -10,13 +10,13 @@ import org.jetbrains.annotations.NotNull; public class GraphCalculatorImpl extends AbstractGraphCalculator { @Override - protected void compute(@NotNull XyFunction f, + protected void compute(@Nonnull XyFunction f, float xMin, float xMax, float yMin, float yMax, - @NotNull GraphData graph, - @NotNull Graph2dDimensions dimensions) { + @Nonnull GraphData graph, + @Nonnull Graph2dDimensions dimensions) { graph.push(xMin, (float) f.eval(xMin)); final float xScale = dimensions.getXGraphToViewScale(); diff --git a/android-app/src/main/java/org/solovyev/android/calculator/plot/GraphData.java b/android-app/src/main/java/org/solovyev/android/calculator/plot/GraphData.java index 63af0752..78d29d7c 100755 --- a/android-app/src/main/java/org/solovyev/android/calculator/plot/GraphData.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/plot/GraphData.java @@ -1,6 +1,6 @@ package org.solovyev.android.calculator.plot; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; class GraphData { @@ -13,12 +13,12 @@ class GraphData { private GraphData() { } - @NotNull + @Nonnull static GraphData newEmptyInstance() { return new GraphData(); } - void swap(@NotNull GraphData that) { + void swap(@Nonnull GraphData that) { float savedXs[] = that.xs; float savedYs[] = that.ys; int savedSize = that.size; diff --git a/android-app/src/main/java/org/solovyev/android/calculator/plot/GraphView.java b/android-app/src/main/java/org/solovyev/android/calculator/plot/GraphView.java index aca6504a..aa6fd36a 100755 --- a/android-app/src/main/java/org/solovyev/android/calculator/plot/GraphView.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/plot/GraphView.java @@ -2,17 +2,17 @@ package org.solovyev.android.calculator.plot; import android.graphics.Bitmap; import android.widget.ZoomButtonsController; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.List; public interface GraphView extends ZoomButtonsController.OnZoomListener, TouchHandler.TouchHandlerListener { - public void init(@NotNull PlotViewDef plotViewDef); + public void init(@Nonnull PlotViewDef plotViewDef); - public void setPlotFunctions(@NotNull List plotFunctions); + public void setPlotFunctions(@Nonnull List plotFunctions); - @NotNull + @Nonnull public List getPlotFunctions(); public void onDestroy(); @@ -21,7 +21,7 @@ public interface GraphView extends ZoomButtonsController.OnZoomListener, TouchHa public void onResume(); - @NotNull + @Nonnull public Bitmap captureScreenshot(); void setXRange(float xMin, float xMax); diff --git a/android-app/src/main/java/org/solovyev/android/calculator/plot/GraphViewHelper.java b/android-app/src/main/java/org/solovyev/android/calculator/plot/GraphViewHelper.java index 397841a1..d04d67a8 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/plot/GraphViewHelper.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/plot/GraphViewHelper.java @@ -1,6 +1,6 @@ package org.solovyev.android.calculator.plot; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.Collections; import java.util.List; @@ -12,23 +12,23 @@ import java.util.List; */ public class GraphViewHelper { - @NotNull + @Nonnull private PlotViewDef plotViewDef = PlotViewDef.newDefaultInstance(); - @NotNull + @Nonnull private List plotFunctions = Collections.emptyList(); private GraphViewHelper() { } - @NotNull + @Nonnull public static GraphViewHelper newDefaultInstance() { return new GraphViewHelper(); } - @NotNull - public static GraphViewHelper newInstance(@NotNull PlotViewDef plotViewDef, - @NotNull List plotFunctions) { + @Nonnull + public static GraphViewHelper newInstance(@Nonnull PlotViewDef plotViewDef, + @Nonnull List plotFunctions) { final GraphViewHelper result = new GraphViewHelper(); result.plotViewDef = plotViewDef; @@ -37,8 +37,8 @@ public class GraphViewHelper { return result; } - @NotNull - public GraphViewHelper copy(@NotNull List plotFunctions) { + @Nonnull + public GraphViewHelper copy(@Nonnull List plotFunctions) { final GraphViewHelper result = new GraphViewHelper(); result.plotViewDef = plotViewDef; @@ -47,12 +47,12 @@ public class GraphViewHelper { return result; } - @NotNull + @Nonnull public List getPlotFunctions() { return plotFunctions; } - @NotNull + @Nonnull public PlotViewDef getPlotViewDef() { return plotViewDef; } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/plot/GraphsData.java b/android-app/src/main/java/org/solovyev/android/calculator/plot/GraphsData.java index b715b072..6b2a0030 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/plot/GraphsData.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/plot/GraphsData.java @@ -1,6 +1,6 @@ package org.solovyev.android.calculator.plot; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; @@ -12,10 +12,10 @@ import java.util.List; */ public class GraphsData { - @NotNull + @Nonnull private final GraphView graphView; - @NotNull + @Nonnull private List graphs; private float lastXMin; @@ -25,7 +25,7 @@ public class GraphsData { private float lastYMax; - public GraphsData(@NotNull GraphView graphView) { + public GraphsData(@Nonnull GraphView graphView) { this.graphView = graphView; graphs = new ArrayList(graphView.getPlotFunctions().size()); } @@ -43,7 +43,7 @@ public class GraphsData { lastYMax = 0; } - @NotNull + @Nonnull public List getGraphs() { return graphs; } @@ -81,7 +81,7 @@ public class GraphsData { this.lastXMax = lastXMax; } - @NotNull + @Nonnull public GraphData get(int i) { return this.graphs.get(i); } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/plot/PlotFunctionListItem.java b/android-app/src/main/java/org/solovyev/android/calculator/plot/PlotFunctionListItem.java index fb3e5a4f..aabd57e2 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/plot/PlotFunctionListItem.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/plot/PlotFunctionListItem.java @@ -6,8 +6,8 @@ import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.ImageButton; import android.widget.TextView; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.Locator; import org.solovyev.android.calculator.core.R; import org.solovyev.android.list.ListItem; @@ -18,16 +18,16 @@ public class PlotFunctionListItem implements ListItem { private static final String PREFIX = "plot_function_"; - @NotNull + @Nonnull private PlotFunction plotFunction; - @NotNull + @Nonnull private ViewBuilder viewBuilder; - @NotNull + @Nonnull private String tag; - public PlotFunctionListItem(@NotNull PlotFunction plotFunction) { + public PlotFunctionListItem(@Nonnull PlotFunction plotFunction) { this.plotFunction = plotFunction; this.viewBuilder = ViewFromLayoutBuilder.newInstance(R.layout.cpp_plot_function_list_item); this.tag = PREFIX + plotFunction.getXyFunction().getExpressionString(); @@ -45,9 +45,9 @@ public class PlotFunctionListItem implements ListItem { return null; } - @NotNull + @Nonnull @Override - public View updateView(@NotNull Context context, @NotNull View view) { + public View updateView(@Nonnull Context context, @Nonnull View view) { final Object viewTag = view.getTag(); if (viewTag instanceof String) { if (this.tag.equals(viewTag)) { @@ -63,19 +63,19 @@ public class PlotFunctionListItem implements ListItem { return build(context); } - @NotNull + @Nonnull @Override - public View build(@NotNull Context context) { + public View build(@Nonnull Context context) { final View root = buildView(context); fillView(root, context); return root; } - private View buildView(@NotNull Context context) { + private View buildView(@Nonnull Context context) { return viewBuilder.build(context); } - private void fillView(@NotNull View root, @NotNull final Context context) { + private void fillView(@Nonnull View root, @Nonnull final Context context) { root.setTag(tag); final CalculatorPlotter plotter = Locator.getInstance().getPlotter(); diff --git a/android-app/src/main/java/org/solovyev/android/calculator/plot/PlotViewDef.java b/android-app/src/main/java/org/solovyev/android/calculator/plot/PlotViewDef.java index 484ea30d..7423e50a 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/plot/PlotViewDef.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/plot/PlotViewDef.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator.plot; import android.graphics.Color; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; /** * User: serso @@ -48,12 +48,12 @@ public class PlotViewDef { this.backgroundColor = backgroundColor; } - @NotNull + @Nonnull public static PlotViewDef newDefaultInstance() { return new PlotViewDef(); } - @NotNull + @Nonnull public static PlotViewDef newInstance(int axisColor, int axisLabelColor, int gridColor, int backgroundColor) { return new PlotViewDef(axisColor, axisLabelColor, gridColor, backgroundColor); } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/plot/TouchHandler.java b/android-app/src/main/java/org/solovyev/android/calculator/plot/TouchHandler.java index 4bb5c2c5..d5f48453 100755 --- a/android-app/src/main/java/org/solovyev/android/calculator/plot/TouchHandler.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/plot/TouchHandler.java @@ -4,7 +4,7 @@ package org.solovyev.android.calculator.plot; import android.view.MotionEvent; import android.view.VelocityTracker; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.Views; class TouchHandler { @@ -21,19 +21,19 @@ class TouchHandler { void onTouchZoomMove(float x1, float y1, float x2, float y2); } - @NotNull + @Nonnull private final VelocityTracker velocityTracker = VelocityTracker.obtain(); private boolean afterZoom; - @NotNull + @Nonnull private TouchHandlerListener listener; - TouchHandler(@NotNull TouchHandlerListener listener) { + TouchHandler(@Nonnull TouchHandlerListener listener) { this.listener = listener; } - public boolean handleTouchEvent(@NotNull MotionEvent event) { + public boolean handleTouchEvent(@Nonnull MotionEvent event) { // Calculator.log("touch " + event + ' ' + event.getPointerCount() + event.getPointerId(0)); final int fullAction = event.getAction(); diff --git a/android-app/src/main/java/org/solovyev/android/calculator/preferences/CalculatorPreferencesActivity.java b/android-app/src/main/java/org/solovyev/android/calculator/preferences/CalculatorPreferencesActivity.java index 92060482..ec5f13bc 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/preferences/CalculatorPreferencesActivity.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/preferences/CalculatorPreferencesActivity.java @@ -20,7 +20,7 @@ import net.robotmedia.billing.IBillingObserver; import net.robotmedia.billing.ResponseCode; import net.robotmedia.billing.helper.AbstractBillingObserver; import net.robotmedia.billing.model.Transaction; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.Activities; import org.solovyev.android.App; import org.solovyev.android.ads.AdsController; @@ -82,7 +82,7 @@ public class CalculatorPreferencesActivity extends SherlockPreferenceActivity im } } - public static void removeBillingInformation(@NotNull Context context, @NotNull SharedPreferences preferences) { + public static void removeBillingInformation(@Nonnull Context context, @Nonnull SharedPreferences preferences) { final SharedPreferences.Editor editor = preferences.edit(); editor.putBoolean(AbstractBillingObserver.KEY_TRANSACTIONS_RESTORED, false); editor.commit(); @@ -138,17 +138,17 @@ public class CalculatorPreferencesActivity extends SherlockPreferenceActivity im } @Override - public void onPurchaseIntentOK(@NotNull String productId, @NotNull PendingIntent purchaseIntent) { + public void onPurchaseIntentOK(@Nonnull String productId, @Nonnull PendingIntent purchaseIntent) { // do nothing } @Override - public void onPurchaseIntentFailure(@NotNull String productId, @NotNull ResponseCode responseCode) { + public void onPurchaseIntentFailure(@Nonnull String productId, @Nonnull ResponseCode responseCode) { // do nothing } @Override - public void onPurchaseStateChanged(@NotNull String itemId, @NotNull Transaction.PurchaseState state) { + public void onPurchaseStateChanged(@Nonnull String itemId, @Nonnull Transaction.PurchaseState state) { if (CalculatorApplication.AD_FREE_PRODUCT_ID.equals(itemId)) { final Preference adFreePreference = findPreference(CalculatorApplication.AD_FREE_P_KEY); if (adFreePreference != null) { @@ -171,7 +171,7 @@ public class CalculatorPreferencesActivity extends SherlockPreferenceActivity im } @Override - public void onRequestPurchaseResponse(@NotNull String itemId, @NotNull ResponseCode response) { + public void onRequestPurchaseResponse(@Nonnull String itemId, @Nonnull ResponseCode response) { final Preference adFreePreference = findPreference(CalculatorApplication.AD_FREE_P_KEY); if (adFreePreference != null) { if (response == ResponseCode.RESULT_OK) { @@ -189,7 +189,7 @@ public class CalculatorPreferencesActivity extends SherlockPreferenceActivity im } @Override - public void onErrorRestoreTransactions(@NotNull ResponseCode responseCode) { + public void onErrorRestoreTransactions(@Nonnull ResponseCode responseCode) { // do nothing } } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/preferences/CalculatorPurchaseDialogActivity.java b/android-app/src/main/java/org/solovyev/android/calculator/preferences/CalculatorPurchaseDialogActivity.java index b8c75200..b9f16efc 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/preferences/CalculatorPurchaseDialogActivity.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/preferences/CalculatorPurchaseDialogActivity.java @@ -10,8 +10,8 @@ import android.widget.TextView; import android.widget.Toast; import com.actionbarsherlock.app.SherlockFragmentActivity; import net.robotmedia.billing.BillingController; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.ads.AdsController; import org.solovyev.android.calculator.CalculatorApplication; import org.solovyev.android.calculator.CalculatorFragment; @@ -42,7 +42,7 @@ public class CalculatorPurchaseDialogActivity extends SherlockFragmentActivity { } @Override - public void onViewCreated(@NotNull View root, Bundle savedInstanceState) { + public void onViewCreated(@Nonnull View root, Bundle savedInstanceState) { super.onViewCreated(root, savedInstanceState); ((TextView) root.findViewById(R.id.cpp_purchase_text)).setMovementMethod(ScrollingMovementMethod.getInstance()); diff --git a/android-app/src/main/java/org/solovyev/android/calculator/view/CalculatorAdditionalTitle.java b/android-app/src/main/java/org/solovyev/android/calculator/view/CalculatorAdditionalTitle.java index 59e7206b..ea526202 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/view/CalculatorAdditionalTitle.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/view/CalculatorAdditionalTitle.java @@ -10,8 +10,8 @@ import android.content.Context; import android.content.SharedPreferences; import android.util.AttributeSet; import android.widget.TextView; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.Locator; import org.solovyev.android.calculator.model.AndroidCalculatorEngine; @@ -34,7 +34,7 @@ public class CalculatorAdditionalTitle extends TextView implements SharedPrefere super(context, attrs, defStyle); } - public void init(@NotNull SharedPreferences preferences) { + public void init(@Nonnull SharedPreferences preferences) { onSharedPreferenceChanged(preferences, null); } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/view/OnDragListenerVibrator.java b/android-app/src/main/java/org/solovyev/android/calculator/view/OnDragListenerVibrator.java index b796a35e..d5236724 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/view/OnDragListenerVibrator.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/view/OnDragListenerVibrator.java @@ -2,8 +2,8 @@ package org.solovyev.android.calculator.view; import android.content.SharedPreferences; import android.os.Vibrator; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.view.VibratorContainer; import org.solovyev.android.view.drag.DragButton; import org.solovyev.android.view.drag.OnDragListener; @@ -18,18 +18,18 @@ public class OnDragListenerVibrator extends OnDragListenerWrapper { private static final float VIBRATION_TIME_SCALE = 0.5f; - @NotNull + @Nonnull private final VibratorContainer vibrator; - public OnDragListenerVibrator(@NotNull OnDragListener onDragListener, + public OnDragListenerVibrator(@Nonnull OnDragListener onDragListener, @Nullable Vibrator vibrator, - @NotNull SharedPreferences preferences) { + @Nonnull SharedPreferences preferences) { super(onDragListener); this.vibrator = new VibratorContainer(vibrator, preferences, VIBRATION_TIME_SCALE); } @Override - public boolean onDrag(@NotNull DragButton dragButton, @NotNull org.solovyev.android.view.drag.DragEvent event) { + public boolean onDrag(@Nonnull DragButton dragButton, @Nonnull org.solovyev.android.view.drag.DragEvent event) { boolean result = super.onDrag(dragButton, event); if (result) { diff --git a/android-app/src/main/java/org/solovyev/android/fragments/FragmentUtils.java b/android-app/src/main/java/org/solovyev/android/fragments/FragmentUtils.java index 50aa3fd6..395e1a71 100644 --- a/android-app/src/main/java/org/solovyev/android/fragments/FragmentUtils.java +++ b/android-app/src/main/java/org/solovyev/android/fragments/FragmentUtils.java @@ -6,8 +6,8 @@ import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import com.actionbarsherlock.app.SherlockFragmentActivity; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.common.collections.Collections; import java.util.List; @@ -19,17 +19,17 @@ import java.util.List; */ public class FragmentUtils { - public static void createFragment(@NotNull FragmentActivity activity, - @NotNull Class fragmentClass, + public static void createFragment(@Nonnull FragmentActivity activity, + @Nonnull Class fragmentClass, int parentViewId, - @NotNull String tag) { + @Nonnull String tag) { createFragment(activity, fragmentClass, parentViewId, tag, null); } - public static void createFragment(@NotNull FragmentActivity activity, - @NotNull Class fragmentClass, + public static void createFragment(@Nonnull FragmentActivity activity, + @Nonnull Class fragmentClass, int parentViewId, - @NotNull String tag, + @Nonnull String tag, @Nullable Bundle args) { final FragmentManager fm = activity.getSupportFragmentManager(); @@ -50,27 +50,27 @@ public class FragmentUtils { } } - public static void removeFragments(@NotNull SherlockFragmentActivity activity, @NotNull String... fragmentTags) { + public static void removeFragments(@Nonnull SherlockFragmentActivity activity, @Nonnull String... fragmentTags) { removeFragments(activity, Collections.asList(fragmentTags)); } - public static void removeFragments(@NotNull SherlockFragmentActivity activity, @NotNull List fragmentTags) { + public static void removeFragments(@Nonnull SherlockFragmentActivity activity, @Nonnull List fragmentTags) { for (String fragmentTag : fragmentTags) { removeFragment(activity, fragmentTag); } } - public static void detachFragments(@NotNull SherlockFragmentActivity activity, @NotNull String... fragmentTags) { + public static void detachFragments(@Nonnull SherlockFragmentActivity activity, @Nonnull String... fragmentTags) { detachFragments(activity, Collections.asList(fragmentTags)); } - public static void detachFragments(@NotNull SherlockFragmentActivity activity, @NotNull List fragmentTags) { + public static void detachFragments(@Nonnull SherlockFragmentActivity activity, @Nonnull List fragmentTags) { for (String fragmentTag : fragmentTags) { detachFragment(activity, fragmentTag); } } - public static void detachFragment(@NotNull SherlockFragmentActivity activity, @NotNull String fragmentTag) { + public static void detachFragment(@Nonnull SherlockFragmentActivity activity, @Nonnull String fragmentTag) { final Fragment fragment = activity.getSupportFragmentManager().findFragmentByTag(fragmentTag); if (fragment != null) { if (!fragment.isDetached()) { @@ -81,7 +81,7 @@ public class FragmentUtils { } } - public static void removeFragment(@NotNull SherlockFragmentActivity activity, @NotNull String fragmentTag) { + public static void removeFragment(@Nonnull SherlockFragmentActivity activity, @Nonnull String fragmentTag) { final Fragment fragment = activity.getSupportFragmentManager().findFragmentByTag(fragmentTag); if (fragment != null) { if (fragment.isAdded()) { diff --git a/android-app/src/test/java/org/solovyev/android/AndroidNumeralBaseTest.java b/android-app/src/test/java/org/solovyev/android/AndroidNumeralBaseTest.java index e3c3b16d..8f168b87 100644 --- a/android-app/src/test/java/org/solovyev/android/AndroidNumeralBaseTest.java +++ b/android-app/src/test/java/org/solovyev/android/AndroidNumeralBaseTest.java @@ -1,12 +1,12 @@ package org.solovyev.android; import junit.framework.Assert; -import org.jetbrains.annotations.NotNull; import org.junit.Test; import org.solovyev.android.calculator.units.CalculatorNumeralBase; import org.solovyev.common.units.Unit; import org.solovyev.common.units.UnitConverter; +import javax.annotation.Nonnull; import java.util.Date; import java.util.Random; @@ -17,7 +17,7 @@ import java.util.Random; */ public class AndroidNumeralBaseTest { - @NotNull + @Nonnull private final UnitConverter c = CalculatorNumeralBase.getConverter(); @Test @@ -59,8 +59,8 @@ public class AndroidNumeralBaseTest { } } - @NotNull - private String convertChain(@NotNull String value, @NotNull CalculatorNumeralBase baseAndroid, @NotNull CalculatorNumeralBase... typeAndroids) { + @Nonnull + private String convertChain(@Nonnull String value, @Nonnull CalculatorNumeralBase baseAndroid, @Nonnull CalculatorNumeralBase... typeAndroids) { Unit unit = baseAndroid.createUnit(value); for (CalculatorNumeralBase typeAndroid : typeAndroids) { diff --git a/android-app/src/test/java/org/solovyev/android/calculator/CalculatorTestUtils.java b/android-app/src/test/java/org/solovyev/android/calculator/CalculatorTestUtils.java index d74688ac..1944444f 100644 --- a/android-app/src/test/java/org/solovyev/android/calculator/CalculatorTestUtils.java +++ b/android-app/src/test/java/org/solovyev/android/calculator/CalculatorTestUtils.java @@ -2,13 +2,14 @@ package org.solovyev.android.calculator; import android.content.Context; import jscl.JsclMathEngine; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import org.mockito.Mockito; import org.solovyev.android.calculator.external.CalculatorExternalListenersContainer; import org.solovyev.android.calculator.history.CalculatorHistory; import org.solovyev.android.calculator.plot.CalculatorPlotter; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + /** * User: serso * Date: 10/7/12 @@ -25,7 +26,7 @@ public class CalculatorTestUtils { } } - public static void initViews(@NotNull Context context) { + public static void initViews(@Nonnull Context context) { final AndroidCalculatorEditorView editor = new AndroidCalculatorEditorView(context); editor.init(context); Locator.getInstance().getEditor().setView(editor); @@ -40,7 +41,7 @@ public class CalculatorTestUtils { } - @NotNull + @Nonnull static CalculatorEngineImpl newCalculatorEngine() { final MathEntityDao mathEntityDao = Mockito.mock(MathEntityDao.class); diff --git a/android-app/src/test/java/org/solovyev/android/calculator/CalculatorppTestRunner.java b/android-app/src/test/java/org/solovyev/android/calculator/CalculatorppTestRunner.java index dd8a9201..946a802c 100644 --- a/android-app/src/test/java/org/solovyev/android/calculator/CalculatorppTestRunner.java +++ b/android-app/src/test/java/org/solovyev/android/calculator/CalculatorppTestRunner.java @@ -1,9 +1,10 @@ package org.solovyev.android.calculator; +import com.xtremelabs.robolectric.RobolectricConfig; import com.xtremelabs.robolectric.RobolectricTestRunner; -import org.jetbrains.annotations.NotNull; import org.junit.runners.model.InitializationError; +import javax.annotation.Nonnull; import java.io.File; /** @@ -13,7 +14,17 @@ import java.io.File; */ public class CalculatorppTestRunner extends RobolectricTestRunner { - public CalculatorppTestRunner(@NotNull Class testClass) throws InitializationError { + public CalculatorppTestRunner(@Nonnull Class testClass) throws InitializationError { super(testClass, new File(".")); } + + @Override + public void setupApplicationState(RobolectricConfig robolectricConfig) { + try { + CalculatorTestUtils.staticSetUp(); + } catch (Exception e) { + throw new AssertionError(e); + } + super.setupApplicationState(robolectricConfig); + } } diff --git a/core/pom.xml b/core/pom.xml index d056fca0..3f35e58a 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -48,8 +48,8 @@ - com.intellij - annotations + com.google.guava + guava diff --git a/core/src/main/java/org/solovyev/acraanalyzer/AcraAnalyzer.java b/core/src/main/java/org/solovyev/acraanalyzer/AcraAnalyzer.java index 6ac3f1fb..2cd4e928 100644 --- a/core/src/main/java/org/solovyev/acraanalyzer/AcraAnalyzer.java +++ b/core/src/main/java/org/solovyev/acraanalyzer/AcraAnalyzer.java @@ -3,6 +3,8 @@ package org.solovyev.acraanalyzer; import org.apache.commons.cli.*; import org.solovyev.common.text.Strings; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.io.File; import java.io.FileNotFoundException; import java.util.*; @@ -21,16 +23,20 @@ public final class AcraAnalyzer { public static void main(String[] args) throws ParseException { final Options options = new Options(); options.addOption("path", true, "Path to the ACRA reports"); + options.addOption("version", true, "Version of the app"); final CommandLineParser parser = new GnuParser(); final CommandLine cmd = parser.parse(options, args); final String path = cmd.getOptionValue("path"); + final String version = cmd.getOptionValue("version"); + if (Strings.isEmpty(path)) { throw new IllegalArgumentException("Path should be specified"); } else { final Map> reports = new HashMap>(); - scanFiles(path, reports); + scanFiles(path, reports, version); + final List> sortedReports = new ArrayList>(reports.size()); for (Map.Entry> entry : reports.entrySet()) { sortedReports.add(entry.getValue()); @@ -58,29 +64,29 @@ public final class AcraAnalyzer { } } - private static void scanFiles(String path, Map> reports) { + private static void scanFiles(@Nonnull String path, @Nonnull Map> reports, @Nullable String version) { final File directory = new File(path); if (directory.isDirectory()) { - scanFiles(directory, reports); + scanFiles(directory, reports, version); } } - private static void scanFiles(File directory, Map> reports) { + private static void scanFiles(@Nonnull File directory, @Nonnull Map> reports, @Nullable String version) { final File[] files = directory.listFiles(); if (files != null) { for (File file : files) { if (file.isDirectory()) { - scanFiles(file, reports); + scanFiles(file, reports, version); } else { - analyzeFile(file, reports); + analyzeFile(file, reports, version); } } } } - private static void analyzeFile(File file, Map> reports) { + private static void analyzeFile(File file, Map> reports, @Nullable String version) { final AcraReport report = readReport(file); - if (!Strings.isEmpty(report.stackTrace)) { + if (!Strings.isEmpty(report.stackTrace) && (version == null || version.equals(report.appVersion))) { List acraReports = reports.get(report.stackTrace); if (acraReports == null) { acraReports = new ArrayList(); diff --git a/core/src/main/java/org/solovyev/android/calculator/AbstractCalculatorMathRegistry.java b/core/src/main/java/org/solovyev/android/calculator/AbstractCalculatorMathRegistry.java index b758499a..42263f35 100644 --- a/core/src/main/java/org/solovyev/android/calculator/AbstractCalculatorMathRegistry.java +++ b/core/src/main/java/org/solovyev/android/calculator/AbstractCalculatorMathRegistry.java @@ -6,8 +6,8 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.common.JBuilder; import org.solovyev.common.math.MathEntity; import org.solovyev.common.math.MathRegistry; @@ -23,30 +23,30 @@ import java.util.Map; */ public abstract class AbstractCalculatorMathRegistry implements CalculatorMathRegistry { - @NotNull + @Nonnull private final MathRegistry mathRegistry; - @NotNull + @Nonnull private final String prefix; - @NotNull + @Nonnull private final MathEntityDao

mathEntityDao; - protected AbstractCalculatorMathRegistry(@NotNull MathRegistry mathRegistry, - @NotNull String prefix, - @NotNull MathEntityDao

mathEntityDao) { + protected AbstractCalculatorMathRegistry(@Nonnull MathRegistry mathRegistry, + @Nonnull String prefix, + @Nonnull MathEntityDao

mathEntityDao) { this.mathRegistry = mathRegistry; this.prefix = prefix; this.mathEntityDao = mathEntityDao; } - @NotNull + @Nonnull protected abstract Map getSubstitutes(); @Nullable @Override - public String getDescription(@NotNull String mathEntityName) { + public String getDescription(@Nonnull String mathEntityName) { final String stringName; final Map substitutes = getSubstitutes(); @@ -94,8 +94,8 @@ public abstract class AbstractCalculatorMathRegistry createBuilder(@NotNull P entity); + @Nonnull + protected abstract JBuilder createBuilder(@Nonnull P entity); @Override public synchronized void save() { @@ -114,51 +114,51 @@ public abstract class AbstractCalculatorMathRegistry createPersistenceContainer(); - @NotNull + @Nonnull @Override public List getEntities() { return mathRegistry.getEntities(); } - @NotNull + @Nonnull @Override public List getSystemEntities() { return mathRegistry.getSystemEntities(); } @Override - public T add(@NotNull JBuilder JBuilder) { + public T add(@Nonnull JBuilder JBuilder) { return mathRegistry.add(JBuilder); } @Override - public void remove(@NotNull T var) { + public void remove(@Nonnull T var) { mathRegistry.remove(var); } - @NotNull + @Nonnull @Override public List getNames() { return mathRegistry.getNames(); } @Override - public boolean contains(@NotNull String name) { + public boolean contains(@Nonnull String name) { return mathRegistry.contains(name); } @Override - public T get(@NotNull String name) { + public T get(@Nonnull String name) { return mathRegistry.get(name); } @Override - public T getById(@NotNull Integer id) { + public T getById(@Nonnull Integer id) { return mathRegistry.getById(id); } } diff --git a/core/src/main/java/org/solovyev/android/calculator/AbstractFixableError.java b/core/src/main/java/org/solovyev/android/calculator/AbstractFixableError.java index 8e21930b..28385db8 100644 --- a/core/src/main/java/org/solovyev/android/calculator/AbstractFixableError.java +++ b/core/src/main/java/org/solovyev/android/calculator/AbstractFixableError.java @@ -1,6 +1,6 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nullable; public abstract class AbstractFixableError implements FixableError { diff --git a/core/src/main/java/org/solovyev/android/calculator/AbstractNumberBuilder.java b/core/src/main/java/org/solovyev/android/calculator/AbstractNumberBuilder.java index 93c87df2..ebc8e4fb 100644 --- a/core/src/main/java/org/solovyev/android/calculator/AbstractNumberBuilder.java +++ b/core/src/main/java/org/solovyev/android/calculator/AbstractNumberBuilder.java @@ -7,8 +7,8 @@ package org.solovyev.android.calculator; import jscl.NumeralBase; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.math.MathType; import org.solovyev.common.text.Strings; @@ -19,7 +19,7 @@ import org.solovyev.common.text.Strings; */ public abstract class AbstractNumberBuilder { - @NotNull + @Nonnull protected final CalculatorEngine engine; @Nullable @@ -28,7 +28,7 @@ public abstract class AbstractNumberBuilder { @Nullable protected NumeralBase nb; - protected AbstractNumberBuilder(@NotNull CalculatorEngine engine) { + protected AbstractNumberBuilder(@Nonnull CalculatorEngine engine) { this.engine = engine; this.nb = engine.getNumeralBase(); } @@ -39,7 +39,7 @@ public abstract class AbstractNumberBuilder { * @param mathTypeResult current math type result * @return true if we can continue of processing of current number, if false - new number should be constructed */ - protected boolean canContinue(@NotNull MathType.Result mathTypeResult) { + protected boolean canContinue(@Nonnull MathType.Result mathTypeResult) { boolean result = mathTypeResult.getMathType().getGroupType() == MathType.MathGroupType.number && !spaceBefore(mathTypeResult) && numeralBaseCheck(mathTypeResult) && @@ -47,19 +47,19 @@ public abstract class AbstractNumberBuilder { return result; } - private boolean spaceBefore(@NotNull MathType.Result mathTypeResult) { + private boolean spaceBefore(@Nonnull MathType.Result mathTypeResult) { return numberBuilder == null && Strings.isEmpty(mathTypeResult.getMatch().trim()); } - private boolean numeralBaseInTheStart(@NotNull MathType mathType) { + private boolean numeralBaseInTheStart(@Nonnull MathType mathType) { return mathType != MathType.numeral_base || numberBuilder == null; } - private boolean numeralBaseCheck(@NotNull MathType.Result mathType) { + private boolean numeralBaseCheck(@Nonnull MathType.Result mathType) { return mathType.getMathType() != MathType.digit || getNumeralBase().getAcceptableCharacters().contains(mathType.getMatch().charAt(0)); } - private boolean isSignAfterE(@NotNull MathType.Result mathTypeResult) { + private boolean isSignAfterE(@Nonnull MathType.Result mathTypeResult) { if (!isHexMode()) { if ("-".equals(mathTypeResult.getMatch()) || "+".equals(mathTypeResult.getMatch())) { final StringBuilder localNb = numberBuilder; @@ -77,7 +77,7 @@ public abstract class AbstractNumberBuilder { return nb == NumeralBase.hex || (nb == null && engine.getNumeralBase() == NumeralBase.hex); } - @NotNull + @Nonnull protected NumeralBase getNumeralBase() { return nb == null ? engine.getNumeralBase() : nb; } diff --git a/core/src/main/java/org/solovyev/android/calculator/Calculator.java b/core/src/main/java/org/solovyev/android/calculator/Calculator.java index ebc85549..5790ef02 100644 --- a/core/src/main/java/org/solovyev/android/calculator/Calculator.java +++ b/core/src/main/java/org/solovyev/android/calculator/Calculator.java @@ -2,8 +2,8 @@ package org.solovyev.android.calculator; import jscl.NumeralBase; import jscl.math.Generic; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.history.CalculatorHistoryState; import org.solovyev.android.calculator.jscl.JsclOperation; import org.solovyev.common.history.HistoryControl; @@ -27,18 +27,18 @@ public interface Calculator extends CalculatorEventContainer, HistoryControl 0) { @@ -144,7 +144,7 @@ public class CalculatorEditorImpl implements CalculatorEditor { } } - @NotNull + @Nonnull public CalculatorEditorViewState moveCursorRight() { synchronized (viewLock) { if (this.lastViewState.getSelection() < this.lastViewState.getText().length()) { @@ -155,7 +155,7 @@ public class CalculatorEditorImpl implements CalculatorEditor { } } - @NotNull + @Nonnull @Override public CursorControl asCursorControl() { return cursorControlAdapter; @@ -169,7 +169,7 @@ public class CalculatorEditorImpl implements CalculatorEditor { ********************************************************************** */ - @NotNull + @Nonnull @Override public CalculatorEditorViewState erase() { synchronized (viewLock) { @@ -188,7 +188,7 @@ public class CalculatorEditorImpl implements CalculatorEditor { } } - @NotNull + @Nonnull @Override public CalculatorEditorViewState clear() { synchronized (viewLock) { @@ -196,9 +196,9 @@ public class CalculatorEditorImpl implements CalculatorEditor { } } - @NotNull + @Nonnull @Override - public CalculatorEditorViewState setText(@NotNull String text) { + public CalculatorEditorViewState setText(@Nonnull String text) { synchronized (viewLock) { final CalculatorEditorViewState result = CalculatorEditorViewStateImpl.newInstance(text, text.length()); setViewState(result); @@ -206,9 +206,9 @@ public class CalculatorEditorImpl implements CalculatorEditor { } } - @NotNull + @Nonnull @Override - public CalculatorEditorViewState setText(@NotNull String text, int selection) { + public CalculatorEditorViewState setText(@Nonnull String text, int selection) { synchronized (viewLock) { selection = correctSelection(selection, text); @@ -218,17 +218,17 @@ public class CalculatorEditorImpl implements CalculatorEditor { } } - @NotNull + @Nonnull @Override - public CalculatorEditorViewState insert(@NotNull String text) { + public CalculatorEditorViewState insert(@Nonnull String text) { synchronized (viewLock) { return insert(text, 0); } } - @NotNull + @Nonnull @Override - public CalculatorEditorViewState insert(@NotNull String text, int selectionOffset) { + public CalculatorEditorViewState insert(@Nonnull String text, int selectionOffset) { synchronized (viewLock) { final int selection = this.lastViewState.getSelection(); final String oldText = this.lastViewState.getText(); @@ -247,7 +247,7 @@ public class CalculatorEditorImpl implements CalculatorEditor { } } - @NotNull + @Nonnull @Override public CalculatorEditorViewState moveSelection(int offset) { synchronized (viewLock) { @@ -257,7 +257,7 @@ public class CalculatorEditorImpl implements CalculatorEditor { } } - @NotNull + @Nonnull @Override public CalculatorEditorViewState setSelection(int selection) { synchronized (viewLock) { @@ -269,7 +269,7 @@ public class CalculatorEditorImpl implements CalculatorEditor { } } - public static int correctSelection(int selection, @NotNull CharSequence text) { + public static int correctSelection(int selection, @Nonnull CharSequence text) { return correctSelection(selection, text.length()); } @@ -281,10 +281,10 @@ public class CalculatorEditorImpl implements CalculatorEditor { private static final class CursorControlAdapter implements CursorControl { - @NotNull + @Nonnull private final CalculatorEditor calculatorEditor; - private CursorControlAdapter(@NotNull CalculatorEditor calculatorEditor) { + private CursorControlAdapter(@Nonnull CalculatorEditor calculatorEditor) { this.calculatorEditor = calculatorEditor; } diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorEditorView.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorEditorView.java index 5a930d01..e0d62899 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorEditorView.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorEditorView.java @@ -1,6 +1,6 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; /** * User: Solovyev_S @@ -9,5 +9,5 @@ import org.jetbrains.annotations.NotNull; */ public interface CalculatorEditorView { - void setState(@NotNull CalculatorEditorViewState viewState); + void setState(@Nonnull CalculatorEditorViewState viewState); } diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorEditorViewState.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorEditorViewState.java index 35fc7add..ca33b7dd 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorEditorViewState.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorEditorViewState.java @@ -1,6 +1,6 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.io.Serializable; @@ -11,7 +11,7 @@ import java.io.Serializable; */ public interface CalculatorEditorViewState extends Serializable { - @NotNull + @Nonnull String getText(); int getSelection(); diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorEditorViewStateImpl.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorEditorViewStateImpl.java index aca0b502..8392f5fd 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorEditorViewStateImpl.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorEditorViewStateImpl.java @@ -1,6 +1,6 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; /** * User: Solovyev_S @@ -9,7 +9,7 @@ import org.jetbrains.annotations.NotNull; */ public class CalculatorEditorViewStateImpl implements CalculatorEditorViewState { - @NotNull + @Nonnull private String text = ""; private int selection = 0; @@ -17,12 +17,12 @@ public class CalculatorEditorViewStateImpl implements CalculatorEditorViewState private CalculatorEditorViewStateImpl() { } - public CalculatorEditorViewStateImpl(@NotNull CalculatorEditorViewState viewState) { + public CalculatorEditorViewStateImpl(@Nonnull CalculatorEditorViewState viewState) { this.text = viewState.getText(); this.selection = viewState.getSelection(); } - @NotNull + @Nonnull @Override public String getText() { return this.text; @@ -33,13 +33,13 @@ public class CalculatorEditorViewStateImpl implements CalculatorEditorViewState return this.selection; } - @NotNull + @Nonnull public static CalculatorEditorViewState newDefaultInstance() { return new CalculatorEditorViewStateImpl(); } - @NotNull - public static CalculatorEditorViewState newSelection(@NotNull CalculatorEditorViewState viewState, int newSelection) { + @Nonnull + public static CalculatorEditorViewState newSelection(@Nonnull CalculatorEditorViewState viewState, int newSelection) { final CalculatorEditorViewStateImpl result = new CalculatorEditorViewStateImpl(viewState); result.selection = newSelection; @@ -47,8 +47,8 @@ public class CalculatorEditorViewStateImpl implements CalculatorEditorViewState return result; } - @NotNull - public static CalculatorEditorViewState newInstance(@NotNull String text, int selection) { + @Nonnull + public static CalculatorEditorViewState newInstance(@Nonnull String text, int selection) { final CalculatorEditorViewStateImpl result = new CalculatorEditorViewStateImpl(); result.text = text; result.selection = selection; diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorEngine.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorEngine.java index 7721b777..4f97d9ec 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorEngine.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorEngine.java @@ -6,7 +6,7 @@ import jscl.NumeralBase; import jscl.math.function.Function; import jscl.math.function.IConstant; import jscl.math.operator.Operator; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.text.DecimalFormatSymbols; @@ -39,23 +39,23 @@ public interface CalculatorEngine { ********************************************************************** */ - @NotNull + @Nonnull CalculatorMathRegistry getVarsRegistry(); - @NotNull + @Nonnull CalculatorMathRegistry getFunctionsRegistry(); - @NotNull + @Nonnull CalculatorMathRegistry getOperatorsRegistry(); - @NotNull + @Nonnull CalculatorMathRegistry getPostfixFunctionsRegistry(); - @NotNull + @Nonnull CalculatorMathEngine getMathEngine(); @Deprecated - @NotNull + @Nonnull MathEngine getMathEngine0(); /* @@ -66,32 +66,32 @@ public interface CalculatorEngine { ********************************************************************** */ - @NotNull + @Nonnull String getMultiplicationSign(); void setUseGroupingSeparator(boolean useGroupingSeparator); void setGroupingSeparator(char groupingSeparator); - void setPrecision(@NotNull Integer precision); + void setPrecision(@Nonnull Integer precision); - void setRoundResult(@NotNull Boolean round); + void setRoundResult(@Nonnull Boolean round); - @NotNull + @Nonnull AngleUnit getAngleUnits(); - void setAngleUnits(@NotNull AngleUnit angleUnits); + void setAngleUnits(@Nonnull AngleUnit angleUnits); - @NotNull + @Nonnull NumeralBase getNumeralBase(); - void setNumeralBase(@NotNull NumeralBase numeralBase); + void setNumeralBase(@Nonnull NumeralBase numeralBase); - void setMultiplicationSign(@NotNull String multiplicationSign); + void setMultiplicationSign(@Nonnull String multiplicationSign); - void setScienceNotation(@NotNull Boolean scienceNotation); + void setScienceNotation(@Nonnull Boolean scienceNotation); - void setTimeout(@NotNull Integer timeout); + void setTimeout(@Nonnull Integer timeout); - void setDecimalGroupSymbols(@NotNull DecimalFormatSymbols decimalGroupSymbols); + void setDecimalGroupSymbols(@Nonnull DecimalFormatSymbols decimalGroupSymbols); } diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorEngineImpl.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorEngineImpl.java index 2eacce0c..9660ab9c 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorEngineImpl.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorEngineImpl.java @@ -9,8 +9,8 @@ import jscl.math.function.Function; import jscl.math.function.IConstant; import jscl.math.operator.Operator; import jscl.text.ParseException; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.text.DecimalFormatSymbols; @@ -40,25 +40,25 @@ public class CalculatorEngineImpl implements CalculatorEngine { * ********************************************************************** */ - @NotNull + @Nonnull private final MathEngine engine; - @NotNull + @Nonnull private final CalculatorMathEngine mathEngine; - @NotNull + @Nonnull private final CalculatorMathRegistry varsRegistry; - @NotNull + @Nonnull private final CalculatorMathRegistry functionsRegistry; - @NotNull + @Nonnull private final CalculatorMathRegistry operatorsRegistry; - @NotNull + @Nonnull private final CalculatorMathRegistry postfixFunctionsRegistry; - @NotNull + @Nonnull private final Object lock; /* @@ -72,14 +72,14 @@ public class CalculatorEngineImpl implements CalculatorEngine { private int timeout = Integer.valueOf(MAX_CALCULATION_TIME_DEFAULT); - @NotNull + @Nonnull private String multiplicationSign = MULTIPLICATION_SIGN_DEFAULT; - public CalculatorEngineImpl(@NotNull JsclMathEngine engine, - @NotNull CalculatorMathRegistry varsRegistry, - @NotNull CalculatorMathRegistry functionsRegistry, - @NotNull CalculatorMathRegistry operatorsRegistry, - @NotNull CalculatorMathRegistry postfixFunctionsRegistry, + public CalculatorEngineImpl(@Nonnull JsclMathEngine engine, + @Nonnull CalculatorMathRegistry varsRegistry, + @Nonnull CalculatorMathRegistry functionsRegistry, + @Nonnull CalculatorMathRegistry operatorsRegistry, + @Nonnull CalculatorMathRegistry postfixFunctionsRegistry, @Nullable Object lock) { this.engine = engine; @@ -102,37 +102,37 @@ public class CalculatorEngineImpl implements CalculatorEngine { * ********************************************************************** */ - @NotNull + @Nonnull @Override public CalculatorMathRegistry getVarsRegistry() { return this.varsRegistry; } - @NotNull + @Nonnull @Override public CalculatorMathRegistry getFunctionsRegistry() { return this.functionsRegistry; } - @NotNull + @Nonnull @Override public CalculatorMathRegistry getOperatorsRegistry() { return this.operatorsRegistry; } - @NotNull + @Nonnull @Override public CalculatorMathRegistry getPostfixFunctionsRegistry() { return this.postfixFunctionsRegistry; } - @NotNull + @Nonnull @Override public CalculatorMathEngine getMathEngine() { return this.mathEngine; } - @NotNull + @Nonnull @Override public MathEngine getMathEngine0() { return this.engine; @@ -176,7 +176,7 @@ public class CalculatorEngineImpl implements CalculatorEngine { ********************************************************************** */ - @NotNull + @Nonnull @Override public String getMultiplicationSign() { return this.multiplicationSign; @@ -197,20 +197,20 @@ public class CalculatorEngineImpl implements CalculatorEngine { } @Override - public void setPrecision(@NotNull Integer precision) { + public void setPrecision(@Nonnull Integer precision) { synchronized (lock) { this.engine.setPrecision(precision); } } @Override - public void setRoundResult(@NotNull Boolean round) { + public void setRoundResult(@Nonnull Boolean round) { synchronized (lock) { this.engine.setRoundResult(round); } } - @NotNull + @Nonnull @Override public AngleUnit getAngleUnits() { synchronized (lock) { @@ -219,13 +219,13 @@ public class CalculatorEngineImpl implements CalculatorEngine { } @Override - public void setAngleUnits(@NotNull AngleUnit angleUnits) { + public void setAngleUnits(@Nonnull AngleUnit angleUnits) { synchronized (lock) { this.engine.setAngleUnits(angleUnits); } } - @NotNull + @Nonnull @Override public NumeralBase getNumeralBase() { synchronized (lock) { @@ -234,31 +234,31 @@ public class CalculatorEngineImpl implements CalculatorEngine { } @Override - public void setNumeralBase(@NotNull NumeralBase numeralBase) { + public void setNumeralBase(@Nonnull NumeralBase numeralBase) { synchronized (lock) { this.engine.setNumeralBase(numeralBase); } } @Override - public void setMultiplicationSign(@NotNull String multiplicationSign) { + public void setMultiplicationSign(@Nonnull String multiplicationSign) { this.multiplicationSign = multiplicationSign; } @Override - public void setScienceNotation(@NotNull Boolean scienceNotation) { + public void setScienceNotation(@Nonnull Boolean scienceNotation) { synchronized (lock) { this.engine.setScienceNotation(scienceNotation); } } @Override - public void setTimeout(@NotNull Integer timeout) { + public void setTimeout(@Nonnull Integer timeout) { this.timeout = timeout; } @Override - public void setDecimalGroupSymbols(@NotNull DecimalFormatSymbols decimalGroupSymbols) { + public void setDecimalGroupSymbols(@Nonnull DecimalFormatSymbols decimalGroupSymbols) { synchronized (lock) { this.engine.setDecimalGroupSymbols(decimalGroupSymbols); } @@ -274,46 +274,46 @@ public class CalculatorEngineImpl implements CalculatorEngine { private static final class JsclCalculatorMathEngine implements CalculatorMathEngine { - @NotNull + @Nonnull private final MathEngine mathEngine; - private JsclCalculatorMathEngine(@NotNull MathEngine mathEngine) { + private JsclCalculatorMathEngine(@Nonnull MathEngine mathEngine) { this.mathEngine = mathEngine; } - @NotNull + @Nonnull @Override - public String evaluate(@NotNull String expression) throws ParseException { + public String evaluate(@Nonnull String expression) throws ParseException { return this.mathEngine.evaluate(expression); } - @NotNull + @Nonnull @Override - public String simplify(@NotNull String expression) throws ParseException { + public String simplify(@Nonnull String expression) throws ParseException { return this.mathEngine.simplify(expression); } - @NotNull + @Nonnull @Override - public String elementary(@NotNull String expression) throws ParseException { + public String elementary(@Nonnull String expression) throws ParseException { return this.mathEngine.elementary(expression); } - @NotNull + @Nonnull @Override - public Generic evaluateGeneric(@NotNull String expression) throws ParseException { + public Generic evaluateGeneric(@Nonnull String expression) throws ParseException { return this.mathEngine.evaluateGeneric(expression); } - @NotNull + @Nonnull @Override - public Generic simplifyGeneric(@NotNull String expression) throws ParseException { + public Generic simplifyGeneric(@Nonnull String expression) throws ParseException { return this.mathEngine.simplifyGeneric(expression); } - @NotNull + @Nonnull @Override - public Generic elementaryGeneric(@NotNull String expression) throws ParseException { + public Generic elementaryGeneric(@Nonnull String expression) throws ParseException { return this.mathEngine.elementaryGeneric(expression); } } diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorEvalException.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorEvalException.java index 61de9694..e4c0a2d6 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorEvalException.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorEvalException.java @@ -6,7 +6,7 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.common.msg.Message; import org.solovyev.common.msg.MessageLevel; @@ -20,51 +20,51 @@ import java.util.Locale; */ public class CalculatorEvalException extends Exception implements Message { - @NotNull + @Nonnull private final Message message; - @NotNull + @Nonnull private final String expression; - public CalculatorEvalException(@NotNull Message message, @NotNull Throwable cause, String expression) { + public CalculatorEvalException(@Nonnull Message message, @Nonnull Throwable cause, String expression) { super(cause); this.message = message; this.expression = expression; } - @NotNull + @Nonnull public String getExpression() { return expression; } - @NotNull + @Nonnull @Override public String getMessageCode() { return this.message.getMessageCode(); } - @NotNull + @Nonnull @Override public List getParameters() { return this.message.getParameters(); } - @NotNull + @Nonnull @Override public MessageLevel getMessageLevel() { return this.message.getMessageLevel(); } @Override - @NotNull + @Nonnull public String getLocalizedMessage() { return this.message.getLocalizedMessage(Locale.getDefault()); } - @NotNull + @Nonnull @Override - public String getLocalizedMessage(@NotNull Locale locale) { + public String getLocalizedMessage(@Nonnull Locale locale) { return this.message.getLocalizedMessage(locale); } } diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorEvaluationEventData.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorEvaluationEventData.java index ad2de514..1596e821 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorEvaluationEventData.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorEvaluationEventData.java @@ -1,6 +1,6 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.calculator.jscl.JsclOperation; /** @@ -10,9 +10,9 @@ import org.solovyev.android.calculator.jscl.JsclOperation; */ public interface CalculatorEvaluationEventData extends CalculatorEventData { - @NotNull + @Nonnull JsclOperation getOperation(); - @NotNull + @Nonnull String getExpression(); } diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorEvaluationEventDataImpl.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorEvaluationEventDataImpl.java index 3c1e2513..059b1689 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorEvaluationEventDataImpl.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorEvaluationEventDataImpl.java @@ -1,6 +1,6 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.calculator.jscl.JsclOperation; /** @@ -10,30 +10,30 @@ import org.solovyev.android.calculator.jscl.JsclOperation; */ public class CalculatorEvaluationEventDataImpl implements CalculatorEvaluationEventData { - @NotNull + @Nonnull private final CalculatorEventData calculatorEventData; - @NotNull + @Nonnull private final JsclOperation operation; - @NotNull + @Nonnull private final String expression; - public CalculatorEvaluationEventDataImpl(@NotNull CalculatorEventData calculatorEventData, - @NotNull JsclOperation operation, - @NotNull String expression) { + public CalculatorEvaluationEventDataImpl(@Nonnull CalculatorEventData calculatorEventData, + @Nonnull JsclOperation operation, + @Nonnull String expression) { this.calculatorEventData = calculatorEventData; this.operation = operation; this.expression = expression; } - @NotNull + @Nonnull @Override public JsclOperation getOperation() { return this.operation; } - @NotNull + @Nonnull @Override public String getExpression() { return this.expression; @@ -44,7 +44,7 @@ public class CalculatorEvaluationEventDataImpl implements CalculatorEvaluationEv return calculatorEventData.getEventId(); } - @NotNull + @Nonnull @Override public Long getSequenceId() { return calculatorEventData.getSequenceId(); @@ -56,17 +56,17 @@ public class CalculatorEvaluationEventDataImpl implements CalculatorEvaluationEv } @Override - public boolean isAfter(@NotNull CalculatorEventData that) { + public boolean isAfter(@Nonnull CalculatorEventData that) { return calculatorEventData.isAfter(that); } @Override - public boolean isSameSequence(@NotNull CalculatorEventData that) { + public boolean isSameSequence(@Nonnull CalculatorEventData that) { return this.calculatorEventData.isSameSequence(that); } @Override - public boolean isAfterSequence(@NotNull CalculatorEventData that) { + public boolean isAfterSequence(@Nonnull CalculatorEventData that) { return this.calculatorEventData.isAfterSequence(that); } } diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorEventContainer.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorEventContainer.java index d08e87ae..7437a44a 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorEventContainer.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorEventContainer.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.List; @@ -12,39 +12,39 @@ import java.util.List; */ public interface CalculatorEventContainer { - void addCalculatorEventListener(@NotNull CalculatorEventListener calculatorEventListener); + void addCalculatorEventListener(@Nonnull CalculatorEventListener calculatorEventListener); - void removeCalculatorEventListener(@NotNull CalculatorEventListener calculatorEventListener); + void removeCalculatorEventListener(@Nonnull CalculatorEventListener calculatorEventListener); - void fireCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data); + void fireCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data); - void fireCalculatorEvents(@NotNull List calculatorEvents); + void fireCalculatorEvents(@Nonnull List calculatorEvents); public static class CalculatorEvent { - @NotNull + @Nonnull private CalculatorEventData calculatorEventData; - @NotNull + @Nonnull private CalculatorEventType calculatorEventType; @Nullable private Object data; - public CalculatorEvent(@NotNull CalculatorEventData calculatorEventData, - @NotNull CalculatorEventType calculatorEventType, + public CalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, + @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) { this.calculatorEventData = calculatorEventData; this.calculatorEventType = calculatorEventType; this.data = data; } - @NotNull + @Nonnull public CalculatorEventData getCalculatorEventData() { return calculatorEventData; } - @NotNull + @Nonnull public CalculatorEventType getCalculatorEventType() { return calculatorEventType; } diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorEventData.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorEventData.java index d59a484a..dd130a9e 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorEventData.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorEventData.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; /** * User: Solovyev_S @@ -14,15 +14,15 @@ public interface CalculatorEventData { long getEventId(); // the higher id => the later event - @NotNull + @Nonnull Long getSequenceId(); @Nullable Object getSource(); - boolean isAfter(@NotNull CalculatorEventData that); + boolean isAfter(@Nonnull CalculatorEventData that); - boolean isSameSequence(@NotNull CalculatorEventData that); + boolean isSameSequence(@Nonnull CalculatorEventData that); - boolean isAfterSequence(@NotNull CalculatorEventData that); + boolean isAfterSequence(@Nonnull CalculatorEventData that); } diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorEventDataImpl.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorEventDataImpl.java index f936f2ea..5be2624e 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorEventDataImpl.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorEventDataImpl.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; /** * User: Solovyev_S @@ -14,24 +14,24 @@ class CalculatorEventDataImpl implements CalculatorEventData { private final long eventId; - @NotNull + @Nonnull private Long sequenceId = NO_SEQUENCE; private final Object source; - private CalculatorEventDataImpl(long id, @NotNull Long sequenceId, @Nullable Object source) { + private CalculatorEventDataImpl(long id, @Nonnull Long sequenceId, @Nullable Object source) { this.eventId = id; this.sequenceId = sequenceId; this.source = source; } - @NotNull - static CalculatorEventData newInstance(long id, @NotNull Long sequenceId) { + @Nonnull + static CalculatorEventData newInstance(long id, @Nonnull Long sequenceId) { return new CalculatorEventDataImpl(id, sequenceId, null); } - @NotNull - static CalculatorEventData newInstance(long id, @NotNull Long sequenceId, @NotNull Object source) { + @Nonnull + static CalculatorEventData newInstance(long id, @Nonnull Long sequenceId, @Nonnull Object source) { return new CalculatorEventDataImpl(id, sequenceId, source); } @@ -40,7 +40,7 @@ class CalculatorEventDataImpl implements CalculatorEventData { return this.eventId; } - @NotNull + @Nonnull @Override public Long getSequenceId() { return this.sequenceId; @@ -52,17 +52,17 @@ class CalculatorEventDataImpl implements CalculatorEventData { } @Override - public boolean isAfter(@NotNull CalculatorEventData that) { + public boolean isAfter(@Nonnull CalculatorEventData that) { return this.eventId > that.getEventId(); } @Override - public boolean isSameSequence(@NotNull CalculatorEventData that) { + public boolean isSameSequence(@Nonnull CalculatorEventData that) { return !this.sequenceId.equals(NO_SEQUENCE) && this.sequenceId.equals(that.getSequenceId()); } @Override - public boolean isAfterSequence(@NotNull CalculatorEventData that) { + public boolean isAfterSequence(@Nonnull CalculatorEventData that) { return !this.sequenceId.equals(NO_SEQUENCE) && this.sequenceId > that.getSequenceId(); } diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorEventHolder.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorEventHolder.java index ad8c93a6..592ebac2 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorEventHolder.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorEventHolder.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; /** * User: serso @@ -10,20 +10,20 @@ import org.jetbrains.annotations.Nullable; */ public class CalculatorEventHolder { - @NotNull + @Nonnull private volatile CalculatorEventData lastEventData; - public CalculatorEventHolder(@NotNull CalculatorEventData lastEventData) { + public CalculatorEventHolder(@Nonnull CalculatorEventData lastEventData) { this.lastEventData = lastEventData; } - @NotNull + @Nonnull public synchronized CalculatorEventData getLastEventData() { return lastEventData; } - @NotNull - public synchronized Result apply(@NotNull CalculatorEventData newEventData) { + @Nonnull + public synchronized Result apply(@Nonnull CalculatorEventData newEventData) { final Result result = new Result(lastEventData, newEventData); if (result.isNewAfter()) { @@ -35,10 +35,10 @@ public class CalculatorEventHolder { public static class Result { - @NotNull + @Nonnull private final CalculatorEventData lastEventData; - @NotNull + @Nonnull private final CalculatorEventData newEventData; @Nullable @@ -47,8 +47,8 @@ public class CalculatorEventHolder { @Nullable private Boolean sameSequence = null; - public Result(@NotNull CalculatorEventData lastEventData, - @NotNull CalculatorEventData newEventData) { + public Result(@Nonnull CalculatorEventData lastEventData, + @Nonnull CalculatorEventData newEventData) { this.lastEventData = lastEventData; this.newEventData = newEventData; } diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorEventListener.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorEventListener.java index a2056c1f..f62e482a 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorEventListener.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorEventListener.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.EventListener; @@ -12,6 +12,6 @@ import java.util.EventListener; */ public interface CalculatorEventListener extends EventListener { - void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data); + void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data); } diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorEventType.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorEventType.java index 3b804881..20482f62 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorEventType.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorEventType.java @@ -1,6 +1,6 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; /** * User: Solovyev_S @@ -19,15 +19,15 @@ public enum CalculatorEventType { */ - // @NotNull CalculatorEditorViewState + // @Nonnull CalculatorEditorViewState manual_calculation_requested, - // @NotNull org.solovyev.android.calculator.CalculatorOutput + // @Nonnull org.solovyev.android.calculator.CalculatorOutput calculation_result, calculation_cancelled, - // @NotNull org.solovyev.android.calculator.CalculatorFailure + // @Nonnull org.solovyev.android.calculator.CalculatorFailure calculation_failed, /* @@ -40,10 +40,10 @@ public enum CalculatorEventType { */ conversion_started, - // @NotNull String conversion result + // @Nonnull String conversion result conversion_result, - // @NotNull ConversionFailure + // @Nonnull ConversionFailure conversion_failed, conversion_finished, @@ -56,11 +56,11 @@ public enum CalculatorEventType { ********************************************************************** */ - // @NotNull org.solovyev.android.calculator.CalculatorEditorChangeEventData + // @Nonnull org.solovyev.android.calculator.CalculatorEditorChangeEventData editor_state_changed, editor_state_changed_light, - // @NotNull CalculatorDisplayChangeEventData + // @Nonnull CalculatorDisplayChangeEventData display_state_changed, /* @@ -81,10 +81,10 @@ public enum CalculatorEventType { ********************************************************************** */ - // @NotNull CalculatorHistoryState + // @Nonnull CalculatorHistoryState history_state_added, - // @NotNull CalculatorHistoryState + // @Nonnull CalculatorHistoryState use_history_state, clear_history_requested, @@ -97,32 +97,32 @@ public enum CalculatorEventType { ********************************************************************** */ - // @NotNull IConstant + // @Nonnull IConstant use_constant, - // @NotNull Function + // @Nonnull Function use_function, - // @NotNull Operator + // @Nonnull Operator use_operator, - // @NotNull IConstant + // @Nonnull IConstant constant_added, - // @NotNull Change + // @Nonnull Change constant_changed, - // @NotNull IConstant + // @Nonnull IConstant constant_removed, - // @NotNull Function + // @Nonnull Function function_removed, - // @NotNull Function + // @Nonnull Function function_added, - // @NotNull Change + // @Nonnull Change function_changed, /* @@ -174,7 +174,7 @@ public enum CalculatorEventType { //String show_evaluation_error; - public boolean isOfType(@NotNull CalculatorEventType... types) { + public boolean isOfType(@Nonnull CalculatorEventType... types) { for (CalculatorEventType type : types) { if (this == type) { return true; diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorFailure.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorFailure.java index ebddbb06..d70f0075 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorFailure.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorFailure.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; /** * User: serso @@ -10,7 +10,7 @@ import org.jetbrains.annotations.Nullable; */ public interface CalculatorFailure { - @NotNull + @Nonnull Exception getException(); @Nullable diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorFailureImpl.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorFailureImpl.java index acef6de8..b6754c94 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorFailureImpl.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorFailureImpl.java @@ -1,6 +1,6 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; /** * User: serso @@ -9,14 +9,14 @@ import org.jetbrains.annotations.NotNull; */ public class CalculatorFailureImpl implements CalculatorFailure { - @NotNull + @Nonnull private Exception exception; - public CalculatorFailureImpl(@NotNull Exception exception) { + public CalculatorFailureImpl(@Nonnull Exception exception) { this.exception = exception; } - @NotNull + @Nonnull @Override public Exception getException() { return this.exception; diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorFixableError.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorFixableError.java index d6005fb0..aad3d425 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorFixableError.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorFixableError.java @@ -2,8 +2,8 @@ package org.solovyev.android.calculator; import jscl.AngleUnit; import jscl.text.msg.Messages; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.common.collections.Collections; import java.util.List; @@ -36,7 +36,7 @@ public enum CalculatorFixableError implements FixableError { } }; - @NotNull + @Nonnull private final List messageCodes; CalculatorFixableError(@Nullable String... messageCodes) { @@ -44,7 +44,7 @@ public enum CalculatorFixableError implements FixableError { } @Nullable - public static CalculatorFixableError getErrorByMessageCode(@NotNull String messageCode) { + public static CalculatorFixableError getErrorByMessageCode(@Nonnull String messageCode) { for (CalculatorFixableError fixableError : values()) { if (fixableError.messageCodes.contains(messageCode)) { return fixableError; diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorFunctionsMathRegistry.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorFunctionsMathRegistry.java index d8efe5bb..dad15c00 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorFunctionsMathRegistry.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorFunctionsMathRegistry.java @@ -10,8 +10,8 @@ import jscl.CustomFunctionCalculationException; import jscl.math.function.CustomFunction; import jscl.math.function.Function; import jscl.math.function.IFunction; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.function.FunctionBuilderAdapter; import org.solovyev.android.calculator.model.AFunction; import org.solovyev.android.calculator.model.Functions; @@ -31,18 +31,18 @@ import java.util.Map; */ public class CalculatorFunctionsMathRegistry extends AbstractCalculatorMathRegistry { - @NotNull + @Nonnull private static final Map substitutes = new HashMap(); static { substitutes.put("√", "sqrt"); } - @NotNull + @Nonnull private static final String FUNCTION_DESCRIPTION_PREFIX = "c_fun_description_"; - public CalculatorFunctionsMathRegistry(@NotNull MathRegistry functionsRegistry, - @NotNull MathEntityDao mathEntityDao) { + public CalculatorFunctionsMathRegistry(@Nonnull MathRegistry functionsRegistry, + @Nonnull MathEntityDao mathEntityDao) { super(functionsRegistry, FUNCTION_DESCRIPTION_PREFIX, mathEntityDao); } @@ -58,10 +58,10 @@ public class CalculatorFunctionsMathRegistry extends AbstractCalculatorMathRegis super.load(); } - public static void saveFunction(@NotNull CalculatorMathRegistry registry, - @NotNull MathEntityBuilder builder, + public static void saveFunction(@Nonnull CalculatorMathRegistry registry, + @Nonnull MathEntityBuilder builder, @Nullable IFunction editedInstance, - @NotNull Object source, boolean save) throws CustomFunctionCalculationException, AFunction.Builder.CreationException { + @Nonnull Object source, boolean save) throws CustomFunctionCalculationException, AFunction.Builder.CreationException { final Function addedFunction = registry.add(builder); if (save) { @@ -75,14 +75,14 @@ public class CalculatorFunctionsMathRegistry extends AbstractCalculatorMathRegis } } - @NotNull + @Nonnull @Override protected Map getSubstitutes() { return substitutes; } @Override - public String getCategory(@NotNull Function function) { + public String getCategory(@Nonnull Function function) { for (FunctionCategory category : FunctionCategory.values()) { if (category.isInCategory(function)) { return category.name(); @@ -94,7 +94,7 @@ public class CalculatorFunctionsMathRegistry extends AbstractCalculatorMathRegis @Nullable @Override - public String getDescription(@NotNull String functionName) { + public String getDescription(@Nonnull String functionName) { final Function function = get(functionName); String result = null; @@ -110,14 +110,14 @@ public class CalculatorFunctionsMathRegistry extends AbstractCalculatorMathRegis } - @NotNull + @Nonnull @Override - protected JBuilder createBuilder(@NotNull AFunction function) { + protected JBuilder createBuilder(@Nonnull AFunction function) { return new FunctionBuilderAdapter(new AFunction.Builder(function)); } @Override - protected AFunction transform(@NotNull Function function) { + protected AFunction transform(@Nonnull Function function) { if (function instanceof CustomFunction) { return AFunction.fromIFunction((CustomFunction) function); } else { @@ -125,7 +125,7 @@ public class CalculatorFunctionsMathRegistry extends AbstractCalculatorMathRegis } } - @NotNull + @Nonnull @Override protected MathEntityPersistenceContainer createPersistenceContainer() { return new Functions(); diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorImpl.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorImpl.java index 9ad47065..8f0770de 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorImpl.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorImpl.java @@ -8,8 +8,8 @@ import jscl.math.function.Function; import jscl.math.function.IConstant; import jscl.math.operator.Operator; import jscl.text.ParseInterruptedException; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.history.CalculatorHistory; import org.solovyev.android.calculator.history.CalculatorHistoryState; import org.solovyev.android.calculator.jscl.JsclOperation; @@ -57,20 +57,20 @@ public class CalculatorImpl implements Calculator, CalculatorEventListener { ********************************************************************** */ - @NotNull + @Nonnull private final CalculatorEventContainer calculatorEventContainer = new ListCalculatorEventContainer(); - @NotNull + @Nonnull private final AtomicLong counter = new AtomicLong(CalculatorUtils.FIRST_ID); - @NotNull + @Nonnull private final TextProcessor preprocessor = ToJsclTextProcessor.getInstance(); - @NotNull + @Nonnull private final Executor calculationsExecutor = Executors.newFixedThreadPool(10); // NOTE: only one thread is responsible for events as all events must be done in order of their creating - @NotNull + @Nonnull private final Executor eventExecutor = Executors.newFixedThreadPool(1); private volatile boolean calculateOnFly = true; @@ -98,20 +98,20 @@ public class CalculatorImpl implements Calculator, CalculatorEventListener { ********************************************************************** */ - @NotNull + @Nonnull private CalculatorEventData nextEventData() { long eventId = counter.incrementAndGet(); return CalculatorEventDataImpl.newInstance(eventId, eventId); } - @NotNull - private CalculatorEventData nextEventData(@NotNull Object source) { + @Nonnull + private CalculatorEventData nextEventData(@Nonnull Object source) { long eventId = counter.incrementAndGet(); return CalculatorEventDataImpl.newInstance(eventId, eventId, source); } - @NotNull - private CalculatorEventData nextEventData(@NotNull Long sequenceId) { + @Nonnull + private CalculatorEventData nextEventData(@Nonnull Long sequenceId) { long eventId = counter.incrementAndGet(); return CalculatorEventDataImpl.newInstance(eventId, sequenceId); } @@ -132,7 +132,7 @@ public class CalculatorImpl implements Calculator, CalculatorEventListener { } @Override - public void evaluate(@NotNull Long sequenceId) { + public void evaluate(@Nonnull Long sequenceId) { final CalculatorEditorViewState viewState = getEditor().getViewState(); fireCalculatorEvent(CalculatorEventType.manual_calculation_requested, viewState, sequenceId); this.evaluate(JsclOperation.numeric, viewState.getText(), sequenceId); @@ -145,10 +145,10 @@ public class CalculatorImpl implements Calculator, CalculatorEventListener { this.evaluate(JsclOperation.simplify, viewState.getText(), eventData.getSequenceId()); } - @NotNull + @Nonnull @Override - public CalculatorEventData evaluate(@NotNull final JsclOperation operation, - @NotNull final String expression) { + public CalculatorEventData evaluate(@Nonnull final JsclOperation operation, + @Nonnull final String expression) { final CalculatorEventData eventDataId = nextEventData(); @@ -162,9 +162,9 @@ public class CalculatorImpl implements Calculator, CalculatorEventListener { return eventDataId; } - @NotNull + @Nonnull @Override - public CalculatorEventData evaluate(@NotNull final JsclOperation operation, @NotNull final String expression, @NotNull Long sequenceId) { + public CalculatorEventData evaluate(@Nonnull final JsclOperation operation, @Nonnull final String expression, @Nonnull Long sequenceId) { final CalculatorEventData eventDataId = nextEventData(sequenceId); calculationsExecutor.execute(new Runnable() { @@ -187,18 +187,18 @@ public class CalculatorImpl implements Calculator, CalculatorEventListener { this.calculateOnFly = calculateOnFly; } - @NotNull - private CalculatorConversionEventData newConversionEventData(@NotNull Long sequenceId, - @NotNull Generic value, - @NotNull NumeralBase from, - @NotNull NumeralBase to, - @NotNull CalculatorDisplayViewState displayViewState) { + @Nonnull + private CalculatorConversionEventData newConversionEventData(@Nonnull Long sequenceId, + @Nonnull Generic value, + @Nonnull NumeralBase from, + @Nonnull NumeralBase to, + @Nonnull CalculatorDisplayViewState displayViewState) { return CalculatorConversionEventDataImpl.newInstance(nextEventData(sequenceId), value, from, to, displayViewState); } - private void evaluate(@NotNull Long sequenceId, - @NotNull JsclOperation operation, - @NotNull String expression, + private void evaluate(@Nonnull Long sequenceId, + @Nonnull JsclOperation operation, + @Nonnull String expression, @Nullable MessageRegistry mr) { checkPreferredPreferences(); @@ -277,25 +277,25 @@ public class CalculatorImpl implements Calculator, CalculatorEventListener { } } - @NotNull + @Nonnull @Override - public PreparedExpression prepareExpression(@NotNull String expression) throws CalculatorParseException { + public PreparedExpression prepareExpression(@Nonnull String expression) throws CalculatorParseException { return preprocessor.process(expression); } - @NotNull - private CalculatorEventData newCalculationEventData(@NotNull JsclOperation operation, - @NotNull String expression, - @NotNull Long calculationId) { + @Nonnull + private CalculatorEventData newCalculationEventData(@Nonnull JsclOperation operation, + @Nonnull String expression, + @Nonnull Long calculationId) { return new CalculatorEvaluationEventDataImpl(nextEventData(calculationId), operation, expression); } - private void handleException(@NotNull Long sequenceId, - @NotNull JsclOperation operation, - @NotNull String expression, + private void handleException(@Nonnull Long sequenceId, + @Nonnull JsclOperation operation, + @Nonnull String expression, @Nullable MessageRegistry mr, @Nullable PreparedExpression preparedExpression, - @NotNull CalculatorParseException parseException) { + @Nonnull CalculatorParseException parseException) { if (operation == JsclOperation.numeric && preparedExpression != null @@ -308,11 +308,11 @@ public class CalculatorImpl implements Calculator, CalculatorEventListener { } } - private void handleException(@NotNull Long calculationId, - @NotNull JsclOperation operation, - @NotNull String expression, + private void handleException(@Nonnull Long calculationId, + @Nonnull JsclOperation operation, + @Nonnull String expression, @Nullable MessageRegistry mr, - @NotNull CalculatorEvalException evalException) { + @Nonnull CalculatorEvalException evalException) { if (operation == JsclOperation.numeric && evalException.getCause() instanceof NumeralBaseException) { evaluate(calculationId, JsclOperation.simplify, expression, mr); @@ -329,10 +329,10 @@ public class CalculatorImpl implements Calculator, CalculatorEventListener { ********************************************************************** */ - @NotNull + @Nonnull @Override - public CalculatorEventData convert(@NotNull final Generic value, - @NotNull final NumeralBase to) { + public CalculatorEventData convert(@Nonnull final Generic value, + @Nonnull final NumeralBase to) { final CalculatorEventData eventDataId = nextEventData(); final CalculatorDisplayViewState displayViewState = Locator.getInstance().getDisplay().getViewState(); @@ -359,10 +359,10 @@ public class CalculatorImpl implements Calculator, CalculatorEventListener { return eventDataId; } - @NotNull - private static String doConversion(@NotNull Generic generic, - @NotNull NumeralBase from, - @NotNull NumeralBase to) throws ConversionException { + @Nonnull + private static String doConversion(@Nonnull Generic generic, + @Nonnull NumeralBase from, + @Nonnull NumeralBase to) throws ConversionException { final String result; if (from != to) { @@ -385,7 +385,7 @@ public class CalculatorImpl implements Calculator, CalculatorEventListener { } @Override - public boolean isConversionPossible(@NotNull Generic generic, NumeralBase from, @NotNull NumeralBase to) { + public boolean isConversionPossible(@Nonnull Generic generic, NumeralBase from, @Nonnull NumeralBase to) { try { doConversion(generic, from, to); return true; @@ -403,17 +403,17 @@ public class CalculatorImpl implements Calculator, CalculatorEventListener { */ @Override - public void addCalculatorEventListener(@NotNull CalculatorEventListener calculatorEventListener) { + public void addCalculatorEventListener(@Nonnull CalculatorEventListener calculatorEventListener) { calculatorEventContainer.addCalculatorEventListener(calculatorEventListener); } @Override - public void removeCalculatorEventListener(@NotNull CalculatorEventListener calculatorEventListener) { + public void removeCalculatorEventListener(@Nonnull CalculatorEventListener calculatorEventListener) { calculatorEventContainer.removeCalculatorEventListener(calculatorEventListener); } @Override - public void fireCalculatorEvent(@NotNull final CalculatorEventData calculatorEventData, @NotNull final CalculatorEventType calculatorEventType, @Nullable final Object data) { + public void fireCalculatorEvent(@Nonnull final CalculatorEventData calculatorEventData, @Nonnull final CalculatorEventType calculatorEventType, @Nullable final Object data) { eventExecutor.execute(new Runnable() { @Override public void run() { @@ -423,7 +423,7 @@ public class CalculatorImpl implements Calculator, CalculatorEventListener { } @Override - public void fireCalculatorEvents(@NotNull final List calculatorEvents) { + public void fireCalculatorEvents(@Nonnull final List calculatorEvents) { eventExecutor.execute(new Runnable() { @Override public void run() { @@ -432,9 +432,9 @@ public class CalculatorImpl implements Calculator, CalculatorEventListener { }); } - @NotNull + @Nonnull @Override - public CalculatorEventData fireCalculatorEvent(@NotNull final CalculatorEventType calculatorEventType, @Nullable final Object data) { + public CalculatorEventData fireCalculatorEvent(@Nonnull final CalculatorEventType calculatorEventType, @Nullable final Object data) { final CalculatorEventData eventData = nextEventData(); fireCalculatorEvent(eventData, calculatorEventType, data); @@ -442,9 +442,9 @@ public class CalculatorImpl implements Calculator, CalculatorEventListener { return eventData; } - @NotNull + @Nonnull @Override - public CalculatorEventData fireCalculatorEvent(@NotNull final CalculatorEventType calculatorEventType, @Nullable final Object data, @NotNull Object source) { + public CalculatorEventData fireCalculatorEvent(@Nonnull final CalculatorEventType calculatorEventType, @Nullable final Object data, @Nonnull Object source) { final CalculatorEventData eventData = nextEventData(source); fireCalculatorEvent(eventData, calculatorEventType, data); @@ -452,9 +452,9 @@ public class CalculatorImpl implements Calculator, CalculatorEventListener { return eventData; } - @NotNull + @Nonnull @Override - public CalculatorEventData fireCalculatorEvent(@NotNull final CalculatorEventType calculatorEventType, @Nullable final Object data, @NotNull Long sequenceId) { + public CalculatorEventData fireCalculatorEvent(@Nonnull final CalculatorEventType calculatorEventType, @Nullable final Object data, @Nonnull Long sequenceId) { final CalculatorEventData eventData = nextEventData(sequenceId); fireCalculatorEvent(eventData, calculatorEventType, data); @@ -471,7 +471,7 @@ public class CalculatorImpl implements Calculator, CalculatorEventListener { */ @Override - public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) { + public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) { switch (calculatorEventType) { case editor_state_changed: @@ -528,7 +528,7 @@ public class CalculatorImpl implements Calculator, CalculatorEventListener { } } - private void onDisplayStateChanged(@NotNull CalculatorDisplayChangeEventData displayChangeEventData) { + private void onDisplayStateChanged(@Nonnull CalculatorDisplayChangeEventData displayChangeEventData) { final CalculatorDisplayViewState newState = displayChangeEventData.getNewValue(); if (newState.isValid()) { final String result = newState.getStringResult(); @@ -561,7 +561,7 @@ public class CalculatorImpl implements Calculator, CalculatorEventListener { */ @Override - public void doHistoryAction(@NotNull HistoryAction historyAction) { + public void doHistoryAction(@Nonnull HistoryAction historyAction) { final CalculatorHistory history = Locator.getInstance().getHistory(); if (history.isActionAvailable(historyAction)) { final CalculatorHistoryState newState = history.doAction(historyAction, getCurrentHistoryState()); @@ -572,11 +572,11 @@ public class CalculatorImpl implements Calculator, CalculatorEventListener { } @Override - public void setCurrentHistoryState(@NotNull CalculatorHistoryState editorHistoryState) { + public void setCurrentHistoryState(@Nonnull CalculatorHistoryState editorHistoryState) { editorHistoryState.setValuesFromHistory(getEditor(), getDisplay()); } - @NotNull + @Nonnull @Override public CalculatorHistoryState getCurrentHistoryState() { return CalculatorHistoryState.newInstance(getEditor(), getDisplay()); @@ -590,12 +590,12 @@ public class CalculatorImpl implements Calculator, CalculatorEventListener { ********************************************************************** */ - @NotNull + @Nonnull private CalculatorEditor getEditor() { return Locator.getInstance().getEditor(); } - @NotNull + @Nonnull private CalculatorDisplay getDisplay() { return Locator.getInstance().getDisplay(); } diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorInput.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorInput.java index 4d2962c5..59e248fc 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorInput.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorInput.java @@ -1,6 +1,6 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.calculator.jscl.JsclOperation; /** @@ -10,9 +10,9 @@ import org.solovyev.android.calculator.jscl.JsclOperation; */ public interface CalculatorInput { - @NotNull + @Nonnull String getExpression(); - @NotNull + @Nonnull JsclOperation getOperation(); } diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorInputImpl.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorInputImpl.java index 318a9f07..75532b64 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorInputImpl.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorInputImpl.java @@ -1,6 +1,6 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.calculator.jscl.JsclOperation; /** @@ -10,25 +10,25 @@ import org.solovyev.android.calculator.jscl.JsclOperation; */ public class CalculatorInputImpl implements CalculatorInput { - @NotNull + @Nonnull private String expression; - @NotNull + @Nonnull private JsclOperation operation; - public CalculatorInputImpl(@NotNull String expression, @NotNull JsclOperation operation) { + public CalculatorInputImpl(@Nonnull String expression, @Nonnull JsclOperation operation) { this.expression = expression; this.operation = operation; } @Override - @NotNull + @Nonnull public String getExpression() { return expression; } @Override - @NotNull + @Nonnull public JsclOperation getOperation() { return operation; } diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorKeyboard.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorKeyboard.java index 58a96097..3add59b9 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorKeyboard.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorKeyboard.java @@ -1,6 +1,6 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nullable; /** * User: serso diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorKeyboardImpl.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorKeyboardImpl.java index e6db8f20..b5e881d7 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorKeyboardImpl.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorKeyboardImpl.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.math.MathType; import org.solovyev.common.text.Strings; @@ -12,10 +12,10 @@ import org.solovyev.common.text.Strings; */ public class CalculatorKeyboardImpl implements CalculatorKeyboard { - @NotNull + @Nonnull private final Calculator calculator; - public CalculatorKeyboardImpl(@NotNull Calculator calculator) { + public CalculatorKeyboardImpl(@Nonnull Calculator calculator) { this.calculator = calculator; } @@ -59,7 +59,7 @@ public class CalculatorKeyboardImpl implements CalculatorKeyboard { } } - private boolean processSpecialButtons(@NotNull String text) { + private boolean processSpecialButtons(@Nonnull String text) { boolean result = false; final CalculatorSpecialButton button = CalculatorSpecialButton.getByActionCode(text); diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorLocator.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorLocator.java index 20ff66b5..dae3e845 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorLocator.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorLocator.java @@ -1,6 +1,6 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.calculator.external.CalculatorExternalListenersContainer; import org.solovyev.android.calculator.history.CalculatorHistory; import org.solovyev.android.calculator.plot.CalculatorPlotter; @@ -12,50 +12,50 @@ import org.solovyev.android.calculator.plot.CalculatorPlotter; */ public interface CalculatorLocator { - void init(@NotNull Calculator calculator, - @NotNull CalculatorEngine engine, - @NotNull CalculatorClipboard clipboard, - @NotNull CalculatorNotifier notifier, - @NotNull CalculatorHistory history, - @NotNull CalculatorLogger logger, - @NotNull CalculatorPreferenceService preferenceService, - @NotNull CalculatorKeyboard keyboard, - @NotNull CalculatorExternalListenersContainer externalListenersContainer, - @NotNull CalculatorPlotter plotter); + void init(@Nonnull Calculator calculator, + @Nonnull CalculatorEngine engine, + @Nonnull CalculatorClipboard clipboard, + @Nonnull CalculatorNotifier notifier, + @Nonnull CalculatorHistory history, + @Nonnull CalculatorLogger logger, + @Nonnull CalculatorPreferenceService preferenceService, + @Nonnull CalculatorKeyboard keyboard, + @Nonnull CalculatorExternalListenersContainer externalListenersContainer, + @Nonnull CalculatorPlotter plotter); - @NotNull + @Nonnull Calculator getCalculator(); - @NotNull + @Nonnull CalculatorEngine getEngine(); - @NotNull + @Nonnull CalculatorDisplay getDisplay(); - @NotNull + @Nonnull CalculatorEditor getEditor(); - @NotNull + @Nonnull CalculatorKeyboard getKeyboard(); - @NotNull + @Nonnull CalculatorClipboard getClipboard(); - @NotNull + @Nonnull CalculatorNotifier getNotifier(); - @NotNull + @Nonnull CalculatorHistory getHistory(); - @NotNull + @Nonnull CalculatorLogger getLogger(); - @NotNull + @Nonnull CalculatorPlotter getPlotter(); - @NotNull + @Nonnull CalculatorPreferenceService getPreferenceService(); - @NotNull + @Nonnull CalculatorExternalListenersContainer getExternalListenersContainer(); } diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorLogger.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorLogger.java index 5679026f..2d38b8fe 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorLogger.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorLogger.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; /** * User: serso @@ -10,11 +10,11 @@ import org.jetbrains.annotations.Nullable; */ public interface CalculatorLogger { - void debug(@Nullable String tag, @NotNull String message); + void debug(@Nullable String tag, @Nonnull String message); - void debug(@Nullable String tag, @Nullable String message, @NotNull Throwable e); + void debug(@Nullable String tag, @Nullable String message, @Nonnull Throwable e); - void error(@Nullable String tag, @Nullable String message, @NotNull Throwable e); + void error(@Nullable String tag, @Nullable String message, @Nonnull Throwable e); void error(@Nullable String tag, @Nullable String message); diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorMathEngine.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorMathEngine.java index 72fbd478..4bb11a8c 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorMathEngine.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorMathEngine.java @@ -2,7 +2,7 @@ package org.solovyev.android.calculator; import jscl.math.Generic; import jscl.text.ParseException; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; /** * User: serso @@ -11,21 +11,21 @@ import org.jetbrains.annotations.NotNull; */ public interface CalculatorMathEngine { - @NotNull - String evaluate(@NotNull String expression) throws ParseException; + @Nonnull + String evaluate(@Nonnull String expression) throws ParseException; - @NotNull - String simplify(@NotNull String expression) throws ParseException; + @Nonnull + String simplify(@Nonnull String expression) throws ParseException; - @NotNull - String elementary(@NotNull String expression) throws ParseException; + @Nonnull + String elementary(@Nonnull String expression) throws ParseException; - @NotNull - Generic evaluateGeneric(@NotNull String expression) throws ParseException; + @Nonnull + Generic evaluateGeneric(@Nonnull String expression) throws ParseException; - @NotNull - Generic simplifyGeneric(@NotNull String expression) throws ParseException; + @Nonnull + Generic simplifyGeneric(@Nonnull String expression) throws ParseException; - @NotNull - Generic elementaryGeneric(@NotNull String expression) throws ParseException; + @Nonnull + Generic elementaryGeneric(@Nonnull String expression) throws ParseException; } diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorMathRegistry.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorMathRegistry.java index 5c7f5949..01f1ab6d 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorMathRegistry.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorMathRegistry.java @@ -6,8 +6,8 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.common.math.MathEntity; import org.solovyev.common.math.MathRegistry; @@ -19,10 +19,10 @@ import org.solovyev.common.math.MathRegistry; public interface CalculatorMathRegistry extends MathRegistry { @Nullable - String getDescription(@NotNull String mathEntityName); + String getDescription(@Nonnull String mathEntityName); @Nullable - String getCategory(@NotNull T mathEntity); + String getCategory(@Nonnull T mathEntity); void load(); diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorMessage.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorMessage.java index eebe9fd5..211587de 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorMessage.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorMessage.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.common.msg.AbstractMessage; import org.solovyev.common.msg.Message; import org.solovyev.common.msg.MessageType; @@ -17,31 +17,31 @@ import java.util.ResourceBundle; */ public class CalculatorMessage extends AbstractMessage { - public CalculatorMessage(@NotNull String messageCode, @NotNull MessageType messageType, @Nullable Object... parameters) { + public CalculatorMessage(@Nonnull String messageCode, @Nonnull MessageType messageType, @Nullable Object... parameters) { super(messageCode, messageType, parameters); } - public CalculatorMessage(@NotNull String messageCode, @NotNull MessageType messageType, @NotNull List parameters) { + public CalculatorMessage(@Nonnull String messageCode, @Nonnull MessageType messageType, @Nonnull List parameters) { super(messageCode, messageType, parameters); } - @NotNull - public static Message newInfoMessage(@NotNull String messageCode, @Nullable Object... parameters) { + @Nonnull + public static Message newInfoMessage(@Nonnull String messageCode, @Nullable Object... parameters) { return new CalculatorMessage(messageCode, MessageType.info, parameters); } - @NotNull - public static Message newWarningMessage(@NotNull String messageCode, @Nullable Object... parameters) { + @Nonnull + public static Message newWarningMessage(@Nonnull String messageCode, @Nullable Object... parameters) { return new CalculatorMessage(messageCode, MessageType.warning, parameters); } - @NotNull - public static Message newErrorMessage(@NotNull String messageCode, @Nullable Object... parameters) { + @Nonnull + public static Message newErrorMessage(@Nonnull String messageCode, @Nullable Object... parameters) { return new CalculatorMessage(messageCode, MessageType.error, parameters); } @Override - protected String getMessagePattern(@NotNull Locale locale) { + protected String getMessagePattern(@Nonnull Locale locale) { final ResourceBundle rb = CalculatorMessages.getBundle(locale); return rb.getString(getMessageCode()); } diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorMessages.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorMessages.java index e1519834..66bcde71 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorMessages.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorMessages.java @@ -1,10 +1,11 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import org.solovyev.common.msg.MessageType; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.Locale; +import java.util.MissingResourceException; import java.util.ResourceBundle; /** @@ -19,14 +20,18 @@ public final class CalculatorMessages { throw new AssertionError(); } - @NotNull + @Nonnull public static ResourceBundle getBundle() { return getBundle(Locale.getDefault()); } - @NotNull - public static ResourceBundle getBundle(@NotNull Locale locale) { - return ResourceBundle.getBundle("org/solovyev/android/calculator/messages", locale); + @Nonnull + public static ResourceBundle getBundle(@Nonnull Locale locale) { + try { + return ResourceBundle.getBundle("org/solovyev/android/calculator/messages", locale); + } catch (MissingResourceException e) { + return ResourceBundle.getBundle("org/solovyev/android/calculator/messages", Locale.ENGLISH); + } } /* Arithmetic error occurred: {0} */ @@ -64,8 +69,8 @@ public final class CalculatorMessages { /* Last calculated value */ public static final String ans_description = "ans_description"; - @NotNull - public static CalculatorMessage newErrorMessage(@NotNull String messageCode, @Nullable Object... parameters) { + @Nonnull + public static CalculatorMessage newErrorMessage(@Nonnull String messageCode, @Nullable Object... parameters) { return new CalculatorMessage(messageCode, MessageType.error, parameters); } } diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorNotifier.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorNotifier.java index 5fcfbeb9..ed007e17 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorNotifier.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorNotifier.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.common.msg.Message; import org.solovyev.common.msg.MessageType; @@ -14,11 +14,11 @@ import java.util.List; */ public interface CalculatorNotifier { - void showMessage(@NotNull Message message); + void showMessage(@Nonnull Message message); - void showMessage(@NotNull Integer messageCode, @NotNull MessageType messageType, @NotNull List parameters); + void showMessage(@Nonnull Integer messageCode, @Nonnull MessageType messageType, @Nonnull List parameters); - void showMessage(@NotNull Integer messageCode, @NotNull MessageType messageType, @Nullable Object... parameters); + void showMessage(@Nonnull Integer messageCode, @Nonnull MessageType messageType, @Nullable Object... parameters); - void showDebugMessage(@Nullable String tag, @NotNull String message); + void showDebugMessage(@Nullable String tag, @Nonnull String message); } diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorOperatorsMathRegistry.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorOperatorsMathRegistry.java index efe40b43..945cf5f9 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorOperatorsMathRegistry.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorOperatorsMathRegistry.java @@ -7,7 +7,7 @@ package org.solovyev.android.calculator; import jscl.math.operator.Operator; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.common.JBuilder; import org.solovyev.common.math.MathRegistry; @@ -21,7 +21,7 @@ import java.util.Map; */ public class CalculatorOperatorsMathRegistry extends AbstractCalculatorMathRegistry { - @NotNull + @Nonnull private static final Map substitutes = new HashMap(); static { @@ -33,22 +33,22 @@ public class CalculatorOperatorsMathRegistry extends AbstractCalculatorMathRegis substitutes.put("Σ", "sum"); } - @NotNull + @Nonnull private static final String OPERATOR_DESCRIPTION_PREFIX = "c_op_description_"; - public CalculatorOperatorsMathRegistry(@NotNull MathRegistry functionsRegistry, - @NotNull MathEntityDao mathEntityDao) { + public CalculatorOperatorsMathRegistry(@Nonnull MathRegistry functionsRegistry, + @Nonnull MathEntityDao mathEntityDao) { super(functionsRegistry, OPERATOR_DESCRIPTION_PREFIX, mathEntityDao); } - @NotNull + @Nonnull @Override protected Map getSubstitutes() { return substitutes; } @Override - public String getCategory(@NotNull Operator operator) { + public String getCategory(@Nonnull Operator operator) { for (OperatorCategory category : OperatorCategory.values()) { if (category.isInCategory(operator)) { return category.name(); @@ -62,9 +62,9 @@ public class CalculatorOperatorsMathRegistry extends AbstractCalculatorMathRegis // not supported yet } - @NotNull + @Nonnull @Override - protected JBuilder createBuilder(@NotNull MathPersistenceEntity entity) { + protected JBuilder createBuilder(@Nonnull MathPersistenceEntity entity) { return null; //To change body of implemented methods use File | Settings | File Templates. } @@ -74,11 +74,11 @@ public class CalculatorOperatorsMathRegistry extends AbstractCalculatorMathRegis } @Override - protected MathPersistenceEntity transform(@NotNull Operator entity) { + protected MathPersistenceEntity transform(@Nonnull Operator entity) { return null; //To change body of implemented methods use File | Settings | File Templates. } - @NotNull + @Nonnull @Override protected MathEntityPersistenceContainer createPersistenceContainer() { return null; //To change body of implemented methods use File | Settings | File Templates. diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorOutput.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorOutput.java index 5883c73a..5e60d2ed 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorOutput.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorOutput.java @@ -1,8 +1,8 @@ package org.solovyev.android.calculator; import jscl.math.Generic; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.jscl.JsclOperation; /** @@ -12,10 +12,10 @@ import org.solovyev.android.calculator.jscl.JsclOperation; */ public interface CalculatorOutput { - @NotNull + @Nonnull String getStringResult(); - @NotNull + @Nonnull JsclOperation getOperation(); diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorOutputImpl.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorOutputImpl.java index 4c9adc13..5a6e3817 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorOutputImpl.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorOutputImpl.java @@ -1,8 +1,8 @@ package org.solovyev.android.calculator; import jscl.math.Generic; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.jscl.JsclOperation; /** @@ -15,40 +15,40 @@ public class CalculatorOutputImpl implements CalculatorOutput { @Nullable private Generic result; - @NotNull + @Nonnull private String stringResult; - @NotNull + @Nonnull private JsclOperation operation; - private CalculatorOutputImpl(@NotNull String stringResult, - @NotNull JsclOperation operation, + private CalculatorOutputImpl(@Nonnull String stringResult, + @Nonnull JsclOperation operation, @Nullable Generic result) { this.stringResult = stringResult; this.operation = operation; this.result = result; } - @NotNull - public static CalculatorOutput newOutput(@NotNull String stringResult, - @NotNull JsclOperation operation, - @NotNull Generic result) { + @Nonnull + public static CalculatorOutput newOutput(@Nonnull String stringResult, + @Nonnull JsclOperation operation, + @Nonnull Generic result) { return new CalculatorOutputImpl(stringResult, operation, result); } - @NotNull - public static CalculatorOutput newEmptyOutput(@NotNull JsclOperation operation) { + @Nonnull + public static CalculatorOutput newEmptyOutput(@Nonnull JsclOperation operation) { return new CalculatorOutputImpl("", operation, null); } @Override - @NotNull + @Nonnull public String getStringResult() { return stringResult; } @Override - @NotNull + @Nonnull public JsclOperation getOperation() { return operation; } diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorParseException.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorParseException.java index 7ee61d54..46498dad 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorParseException.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorParseException.java @@ -6,8 +6,8 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.common.msg.Message; import org.solovyev.common.msg.MessageLevel; @@ -21,35 +21,35 @@ import java.util.Locale; */ public class CalculatorParseException extends Exception implements Message { - @NotNull + @Nonnull private final Message message; - @NotNull + @Nonnull private final String expression; @Nullable private final Integer position; - public CalculatorParseException(@NotNull jscl.text.ParseException jsclParseException) { + public CalculatorParseException(@Nonnull jscl.text.ParseException jsclParseException) { this.message = jsclParseException; this.expression = jsclParseException.getExpression(); this.position = jsclParseException.getPosition(); } public CalculatorParseException(@Nullable Integer position, - @NotNull String expression, - @NotNull Message message) { + @Nonnull String expression, + @Nonnull Message message) { this.message = message; this.expression = expression; this.position = position; } - public CalculatorParseException(@NotNull String expression, - @NotNull Message message) { + public CalculatorParseException(@Nonnull String expression, + @Nonnull Message message) { this(null, expression, message); } - @NotNull + @Nonnull public String getExpression() { return expression; } @@ -59,33 +59,33 @@ public class CalculatorParseException extends Exception implements Message { return position; } - @NotNull + @Nonnull @Override public String getMessageCode() { return this.message.getMessageCode(); } - @NotNull + @Nonnull @Override public List getParameters() { return this.message.getParameters(); } - @NotNull + @Nonnull @Override public MessageLevel getMessageLevel() { return this.message.getMessageLevel(); } @Override - @NotNull + @Nonnull public String getLocalizedMessage() { return this.message.getLocalizedMessage(Locale.getDefault()); } - @NotNull + @Nonnull @Override - public String getLocalizedMessage(@NotNull Locale locale) { + public String getLocalizedMessage(@Nonnull Locale locale) { return this.message.getLocalizedMessage(locale); } } diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorPostfixFunctionsRegistry.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorPostfixFunctionsRegistry.java index 86ae1076..ad478ee0 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorPostfixFunctionsRegistry.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorPostfixFunctionsRegistry.java @@ -7,7 +7,7 @@ package org.solovyev.android.calculator; import jscl.math.operator.Operator; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.common.JBuilder; import org.solovyev.common.math.MathRegistry; @@ -21,7 +21,7 @@ import java.util.Map; */ public class CalculatorPostfixFunctionsRegistry extends AbstractCalculatorMathRegistry { - @NotNull + @Nonnull private static final Map substitutes = new HashMap(); static { @@ -31,23 +31,23 @@ public class CalculatorPostfixFunctionsRegistry extends AbstractCalculatorMathRe substitutes.put("°", "degree"); } - @NotNull + @Nonnull private static final String POSTFIX_FUNCTION_DESCRIPTION_PREFIX = "c_pf_description_"; - public CalculatorPostfixFunctionsRegistry(@NotNull MathRegistry functionsRegistry, - @NotNull MathEntityDao mathEntityDao) { + public CalculatorPostfixFunctionsRegistry(@Nonnull MathRegistry functionsRegistry, + @Nonnull MathEntityDao mathEntityDao) { super(functionsRegistry, POSTFIX_FUNCTION_DESCRIPTION_PREFIX, mathEntityDao); } - @NotNull + @Nonnull @Override protected Map getSubstitutes() { return substitutes; } @Override - public String getCategory(@NotNull Operator operator) { + public String getCategory(@Nonnull Operator operator) { for (OperatorCategory category : OperatorCategory.values()) { if (category.isInCategory(operator)) { return category.name(); @@ -61,9 +61,9 @@ public class CalculatorPostfixFunctionsRegistry extends AbstractCalculatorMathRe // not supported yet } - @NotNull + @Nonnull @Override - protected JBuilder createBuilder(@NotNull MathPersistenceEntity entity) { + protected JBuilder createBuilder(@Nonnull MathPersistenceEntity entity) { return null; //To change body of implemented methods use File | Settings | File Templates. } @@ -73,11 +73,11 @@ public class CalculatorPostfixFunctionsRegistry extends AbstractCalculatorMathRe } @Override - protected MathPersistenceEntity transform(@NotNull Operator entity) { + protected MathPersistenceEntity transform(@Nonnull Operator entity) { return null; //To change body of implemented methods use File | Settings | File Templates. } - @NotNull + @Nonnull @Override protected MathEntityPersistenceContainer createPersistenceContainer() { return null; //To change body of implemented methods use File | Settings | File Templates. diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorPreferenceService.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorPreferenceService.java index 7185d314..0c7f21e5 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorPreferenceService.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorPreferenceService.java @@ -2,7 +2,7 @@ package org.solovyev.android.calculator; import jscl.AngleUnit; import jscl.NumeralBase; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; /** * User: serso @@ -13,11 +13,11 @@ public interface CalculatorPreferenceService { void setPreferredAngleUnits(); - void setAngleUnits(@NotNull AngleUnit angleUnit); + void setAngleUnits(@Nonnull AngleUnit angleUnit); void setPreferredNumeralBase(); - void setNumeralBase(@NotNull NumeralBase numeralBase); + void setNumeralBase(@Nonnull NumeralBase numeralBase); void checkPreferredPreferences(boolean force); } diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorSpecialButton.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorSpecialButton.java index 64de222c..2141e616 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorSpecialButton.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorSpecialButton.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.HashMap; import java.util.Map; @@ -15,144 +15,144 @@ public enum CalculatorSpecialButton { history("history") { @Override - public void onClick(@NotNull CalculatorKeyboard keyboard) { + public void onClick(@Nonnull CalculatorKeyboard keyboard) { Locator.getInstance().getCalculator().fireCalculatorEvent(CalculatorEventType.show_history, null); } }, history_detached("history_detached") { @Override - public void onClick(@NotNull CalculatorKeyboard keyboard) { + public void onClick(@Nonnull CalculatorKeyboard keyboard) { Locator.getInstance().getCalculator().fireCalculatorEvent(CalculatorEventType.show_history_detached, null); } }, cursor_right("▶") { @Override - public void onClick(@NotNull CalculatorKeyboard keyboard) { + public void onClick(@Nonnull CalculatorKeyboard keyboard) { keyboard.moveCursorRight(); } }, cursor_left("◀") { @Override - public void onClick(@NotNull CalculatorKeyboard keyboard) { + public void onClick(@Nonnull CalculatorKeyboard keyboard) { keyboard.moveCursorLeft(); } }, settings("settings") { @Override - public void onClick(@NotNull CalculatorKeyboard keyboard) { + public void onClick(@Nonnull CalculatorKeyboard keyboard) { Locator.getInstance().getCalculator().fireCalculatorEvent(CalculatorEventType.show_settings, null); } }, settings_detached("settings_detached") { @Override - public void onClick(@NotNull CalculatorKeyboard keyboard) { + public void onClick(@Nonnull CalculatorKeyboard keyboard) { Locator.getInstance().getCalculator().fireCalculatorEvent(CalculatorEventType.show_settings_detached, null); } }, like("like") { @Override - public void onClick(@NotNull CalculatorKeyboard keyboard) { + public void onClick(@Nonnull CalculatorKeyboard keyboard) { Locator.getInstance().getCalculator().fireCalculatorEvent(CalculatorEventType.show_like_dialog, null); } }, erase("erase") { @Override - public void onClick(@NotNull CalculatorKeyboard keyboard) { + public void onClick(@Nonnull CalculatorKeyboard keyboard) { Locator.getInstance().getEditor().erase(); } }, paste("paste") { @Override - public void onClick(@NotNull CalculatorKeyboard keyboard) { + public void onClick(@Nonnull CalculatorKeyboard keyboard) { keyboard.pasteButtonPressed(); } }, copy("copy") { @Override - public void onClick(@NotNull CalculatorKeyboard keyboard) { + public void onClick(@Nonnull CalculatorKeyboard keyboard) { keyboard.copyButtonPressed(); } }, equals("=") { @Override - public void onClick(@NotNull CalculatorKeyboard keyboard) { + public void onClick(@Nonnull CalculatorKeyboard keyboard) { Locator.getInstance().getCalculator().evaluate(); } }, clear("clear") { @Override - public void onClick(@NotNull CalculatorKeyboard keyboard) { + public void onClick(@Nonnull CalculatorKeyboard keyboard) { keyboard.clearButtonPressed(); } }, functions("functions") { @Override - public void onClick(@NotNull CalculatorKeyboard keyboard) { + public void onClick(@Nonnull CalculatorKeyboard keyboard) { Locator.getInstance().getCalculator().fireCalculatorEvent(CalculatorEventType.show_functions, null); } }, functions_detached("functions_detached") { @Override - public void onClick(@NotNull CalculatorKeyboard keyboard) { + public void onClick(@Nonnull CalculatorKeyboard keyboard) { Locator.getInstance().getCalculator().fireCalculatorEvent(CalculatorEventType.show_functions_detached, null); } }, open_app("open_app") { @Override - public void onClick(@NotNull CalculatorKeyboard keyboard) { + public void onClick(@Nonnull CalculatorKeyboard keyboard) { Locator.getInstance().getCalculator().fireCalculatorEvent(CalculatorEventType.open_app, null); } }, vars("vars") { @Override - public void onClick(@NotNull CalculatorKeyboard keyboard) { + public void onClick(@Nonnull CalculatorKeyboard keyboard) { Locator.getInstance().getCalculator().fireCalculatorEvent(CalculatorEventType.show_vars, null); } }, vars_detached("vars_detached") { @Override - public void onClick(@NotNull CalculatorKeyboard keyboard) { + public void onClick(@Nonnull CalculatorKeyboard keyboard) { Locator.getInstance().getCalculator().fireCalculatorEvent(CalculatorEventType.show_vars_detached, null); } }, operators("operators") { @Override - public void onClick(@NotNull CalculatorKeyboard keyboard) { + public void onClick(@Nonnull CalculatorKeyboard keyboard) { Locator.getInstance().getCalculator().fireCalculatorEvent(CalculatorEventType.show_operators, null); } }, operators_detached("operators_detached") { @Override - public void onClick(@NotNull CalculatorKeyboard keyboard) { + public void onClick(@Nonnull CalculatorKeyboard keyboard) { Locator.getInstance().getCalculator().fireCalculatorEvent(CalculatorEventType.show_operators_detached, null); } }; - @NotNull + @Nonnull private static Map buttonsByActionCodes = new HashMap(); - @NotNull + @Nonnull private final String actionCode; - CalculatorSpecialButton(@NotNull String actionCode) { + CalculatorSpecialButton(@Nonnull String actionCode) { this.actionCode = actionCode; } - @NotNull + @Nonnull public String getActionCode() { return actionCode; } @Nullable - public static CalculatorSpecialButton getByActionCode(@NotNull String actionCode) { + public static CalculatorSpecialButton getByActionCode(@Nonnull String actionCode) { initButtonsByActionCodesMap(); return buttonsByActionCodes.get(actionCode); } - public abstract void onClick(@NotNull CalculatorKeyboard keyboard); + public abstract void onClick(@Nonnull CalculatorKeyboard keyboard); private static void initButtonsByActionCodesMap() { if (buttonsByActionCodes.isEmpty()) { diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorUtils.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorUtils.java index 78f2627e..4e3e03e8 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorUtils.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorUtils.java @@ -3,7 +3,7 @@ package org.solovyev.android.calculator; import jscl.math.Generic; import jscl.math.function.Constant; import jscl.math.function.IConstant; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.HashSet; import java.util.Set; @@ -21,13 +21,13 @@ public final class CalculatorUtils { throw new AssertionError(); } - @NotNull + @Nonnull public static CalculatorEventData createFirstEventDataId() { return CalculatorEventDataImpl.newInstance(FIRST_ID, FIRST_ID); } - @NotNull - public static Set getNotSystemConstants(@NotNull Generic expression) { + @Nonnull + public static Set getNotSystemConstants(@Nonnull Generic expression) { final Set notSystemConstants = new HashSet(); for (Constant constant : expression.getConstants()) { diff --git a/core/src/main/java/org/solovyev/android/calculator/CalculatorVarsRegistry.java b/core/src/main/java/org/solovyev/android/calculator/CalculatorVarsRegistry.java index 6e1f9a55..eb03e71b 100644 --- a/core/src/main/java/org/solovyev/android/calculator/CalculatorVarsRegistry.java +++ b/core/src/main/java/org/solovyev/android/calculator/CalculatorVarsRegistry.java @@ -7,8 +7,8 @@ package org.solovyev.android.calculator; import jscl.math.function.IConstant; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.model.MathEntityBuilder; import org.solovyev.android.calculator.model.Var; import org.solovyev.android.calculator.model.Vars; @@ -26,10 +26,10 @@ import java.util.Map; */ public class CalculatorVarsRegistry extends AbstractCalculatorMathRegistry { - @NotNull + @Nonnull public static final String ANS = "ans"; - @NotNull + @Nonnull private static final Map substitutes = new HashMap(); static { @@ -40,15 +40,15 @@ public class CalculatorVarsRegistry extends AbstractCalculatorMathRegistry mathRegistry, - @NotNull MathEntityDao mathEntityDao) { + public CalculatorVarsRegistry(@Nonnull MathRegistry mathRegistry, + @Nonnull MathEntityDao mathEntityDao) { super(mathRegistry, "c_var_description_", mathEntityDao); } - public static void saveVariable(@NotNull CalculatorMathRegistry registry, - @NotNull MathEntityBuilder builder, + public static void saveVariable(@Nonnull CalculatorMathRegistry registry, + @Nonnull MathEntityBuilder builder, @Nullable T editedInstance, - @NotNull Object source, boolean save) { + @Nonnull Object source, boolean save) { final T addedVar = registry.add(builder); if (save) { @@ -62,7 +62,7 @@ public class CalculatorVarsRegistry extends AbstractCalculatorMathRegistry getSubstitutes() { return substitutes; @@ -84,27 +84,27 @@ public class CalculatorVarsRegistry extends AbstractCalculatorMathRegistry createBuilder(@NotNull Var entity) { + protected JBuilder createBuilder(@Nonnull Var entity) { return new Var.Builder(entity); } - @NotNull + @Nonnull @Override protected MathEntityPersistenceContainer createPersistenceContainer() { return new Vars(); } - private void tryToAddAuxVar(@NotNull String name) { + private void tryToAddAuxVar(@Nonnull String name) { if (!contains(name)) { add(new Var.Builder(name, (String) null)); } } - @NotNull + @Nonnull @Override - protected Var transform(@NotNull IConstant entity) { + protected Var transform(@Nonnull IConstant entity) { if (entity instanceof Var) { return (Var) entity; } else { @@ -113,7 +113,7 @@ public class CalculatorVarsRegistry extends AbstractCalculatorMathRegistry { - @NotNull + @Nonnull T getOldValue(); - @NotNull + @Nonnull T getNewValue(); } diff --git a/core/src/main/java/org/solovyev/android/calculator/ChangeImpl.java b/core/src/main/java/org/solovyev/android/calculator/ChangeImpl.java index e368e535..2a39fbf3 100644 --- a/core/src/main/java/org/solovyev/android/calculator/ChangeImpl.java +++ b/core/src/main/java/org/solovyev/android/calculator/ChangeImpl.java @@ -1,6 +1,6 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; /** * User: serso @@ -9,17 +9,17 @@ import org.jetbrains.annotations.NotNull; */ public class ChangeImpl implements Change { - @NotNull + @Nonnull private T oldValue; - @NotNull + @Nonnull private T newValue; private ChangeImpl() { } - @NotNull - public static Change newInstance(@NotNull T oldValue, @NotNull T newValue) { + @Nonnull + public static Change newInstance(@Nonnull T oldValue, @Nonnull T newValue) { final ChangeImpl result = new ChangeImpl(); result.oldValue = oldValue; @@ -28,13 +28,13 @@ public class ChangeImpl implements Change { return result; } - @NotNull + @Nonnull @Override public T getOldValue() { return this.oldValue; } - @NotNull + @Nonnull @Override public T getNewValue() { return this.newValue; diff --git a/core/src/main/java/org/solovyev/android/calculator/ConversionFailure.java b/core/src/main/java/org/solovyev/android/calculator/ConversionFailure.java index c1ce8803..b081487f 100644 --- a/core/src/main/java/org/solovyev/android/calculator/ConversionFailure.java +++ b/core/src/main/java/org/solovyev/android/calculator/ConversionFailure.java @@ -1,6 +1,6 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; /** * User: Solovyev_S @@ -9,6 +9,6 @@ import org.jetbrains.annotations.NotNull; */ public interface ConversionFailure { - @NotNull + @Nonnull Exception getException(); } diff --git a/core/src/main/java/org/solovyev/android/calculator/ConversionFailureImpl.java b/core/src/main/java/org/solovyev/android/calculator/ConversionFailureImpl.java index 01b205bc..ad4baeba 100644 --- a/core/src/main/java/org/solovyev/android/calculator/ConversionFailureImpl.java +++ b/core/src/main/java/org/solovyev/android/calculator/ConversionFailureImpl.java @@ -1,6 +1,6 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; /** * User: Solovyev_S @@ -9,14 +9,14 @@ import org.jetbrains.annotations.NotNull; */ public class ConversionFailureImpl implements ConversionFailure { - @NotNull + @Nonnull private Exception exception; - public ConversionFailureImpl(@NotNull Exception exception) { + public ConversionFailureImpl(@Nonnull Exception exception) { this.exception = exception; } - @NotNull + @Nonnull @Override public Exception getException() { return this.exception; diff --git a/core/src/main/java/org/solovyev/android/calculator/DialogData.java b/core/src/main/java/org/solovyev/android/calculator/DialogData.java index 8725ddaf..3b1877ae 100644 --- a/core/src/main/java/org/solovyev/android/calculator/DialogData.java +++ b/core/src/main/java/org/solovyev/android/calculator/DialogData.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.common.msg.MessageLevel; /** @@ -11,10 +11,10 @@ import org.solovyev.common.msg.MessageLevel; */ public interface DialogData { - @NotNull + @Nonnull String getMessage(); - @NotNull + @Nonnull MessageLevel getMessageLevel(); @Nullable diff --git a/core/src/main/java/org/solovyev/android/calculator/DummyCalculatorClipboard.java b/core/src/main/java/org/solovyev/android/calculator/DummyCalculatorClipboard.java index eb48d375..35b6f20c 100644 --- a/core/src/main/java/org/solovyev/android/calculator/DummyCalculatorClipboard.java +++ b/core/src/main/java/org/solovyev/android/calculator/DummyCalculatorClipboard.java @@ -1,6 +1,6 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; /** * User: serso @@ -15,10 +15,10 @@ public class DummyCalculatorClipboard implements CalculatorClipboard { } @Override - public void setText(@NotNull String text) { + public void setText(@Nonnull String text) { } @Override - public void setText(@NotNull CharSequence text) { + public void setText(@Nonnull CharSequence text) { } } diff --git a/core/src/main/java/org/solovyev/android/calculator/DummyCalculatorNotifier.java b/core/src/main/java/org/solovyev/android/calculator/DummyCalculatorNotifier.java index 9d2d520a..118c8a32 100644 --- a/core/src/main/java/org/solovyev/android/calculator/DummyCalculatorNotifier.java +++ b/core/src/main/java/org/solovyev/android/calculator/DummyCalculatorNotifier.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.common.msg.Message; import org.solovyev.common.msg.MessageType; @@ -15,18 +15,18 @@ import java.util.List; public class DummyCalculatorNotifier implements CalculatorNotifier { @Override - public void showMessage(@NotNull Message message) { + public void showMessage(@Nonnull Message message) { } @Override - public void showMessage(@NotNull Integer messageCode, @NotNull MessageType messageType, @NotNull List parameters) { + public void showMessage(@Nonnull Integer messageCode, @Nonnull MessageType messageType, @Nonnull List parameters) { } @Override - public void showMessage(@NotNull Integer messageCode, @NotNull MessageType messageType, @Nullable Object... parameters) { + public void showMessage(@Nonnull Integer messageCode, @Nonnull MessageType messageType, @Nullable Object... parameters) { } @Override - public void showDebugMessage(@Nullable String tag, @NotNull String message) { + public void showDebugMessage(@Nullable String tag, @Nonnull String message) { } } diff --git a/core/src/main/java/org/solovyev/android/calculator/Editor.java b/core/src/main/java/org/solovyev/android/calculator/Editor.java index 24cc22c9..26861169 100644 --- a/core/src/main/java/org/solovyev/android/calculator/Editor.java +++ b/core/src/main/java/org/solovyev/android/calculator/Editor.java @@ -6,7 +6,7 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nullable; /** * User: serso diff --git a/core/src/main/java/org/solovyev/android/calculator/FixableError.java b/core/src/main/java/org/solovyev/android/calculator/FixableError.java index cf3c4e00..78a22ea6 100644 --- a/core/src/main/java/org/solovyev/android/calculator/FixableError.java +++ b/core/src/main/java/org/solovyev/android/calculator/FixableError.java @@ -1,6 +1,6 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nullable; import java.io.Serializable; diff --git a/core/src/main/java/org/solovyev/android/calculator/FunctionCategory.java b/core/src/main/java/org/solovyev/android/calculator/FunctionCategory.java index 9a185842..d203f626 100644 --- a/core/src/main/java/org/solovyev/android/calculator/FunctionCategory.java +++ b/core/src/main/java/org/solovyev/android/calculator/FunctionCategory.java @@ -4,7 +4,7 @@ import jscl.math.function.ArcTrigonometric; import jscl.math.function.Comparison; import jscl.math.function.Function; import jscl.math.function.Trigonometric; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.common.collections.Collections; import java.util.Arrays; @@ -20,7 +20,7 @@ public enum FunctionCategory { trigonometric(100) { @Override - public boolean isInCategory(@NotNull Function function) { + public boolean isInCategory(@Nonnull Function function) { return (function instanceof Trigonometric || function instanceof ArcTrigonometric) && !hyperbolic_trigonometric.isInCategory(function); } }, @@ -30,28 +30,28 @@ public enum FunctionCategory { private final List names = Arrays.asList("sinh", "cosh", "tanh", "coth", "asinh", "acosh", "atanh", "acoth"); @Override - public boolean isInCategory(@NotNull Function function) { + public boolean isInCategory(@Nonnull Function function) { return names.contains(function.getName()); } }, comparison(200) { @Override - public boolean isInCategory(@NotNull Function function) { + public boolean isInCategory(@Nonnull Function function) { return function instanceof Comparison; } }, my(0) { @Override - public boolean isInCategory(@NotNull Function function) { + public boolean isInCategory(@Nonnull Function function) { return !function.isSystem(); } }, common(50) { @Override - public boolean isInCategory(@NotNull Function function) { + public boolean isInCategory(@Nonnull Function function) { for (FunctionCategory category : values()) { if (category != this) { if (category.isInCategory(function)) { @@ -70,9 +70,9 @@ public enum FunctionCategory { this.tabOrder = tabOrder; } - public abstract boolean isInCategory(@NotNull Function function); + public abstract boolean isInCategory(@Nonnull Function function); - @NotNull + @Nonnull public static List getCategoriesByTabOrder() { final List result = Collections.asList(FunctionCategory.values()); diff --git a/core/src/main/java/org/solovyev/android/calculator/ListCalculatorEventContainer.java b/core/src/main/java/org/solovyev/android/calculator/ListCalculatorEventContainer.java index 67f1ff2d..882d1003 100644 --- a/core/src/main/java/org/solovyev/android/calculator/ListCalculatorEventContainer.java +++ b/core/src/main/java/org/solovyev/android/calculator/ListCalculatorEventContainer.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.common.listeners.JListeners; import org.solovyev.common.listeners.Listeners; @@ -16,29 +16,29 @@ import java.util.List; */ public class ListCalculatorEventContainer implements CalculatorEventContainer { - @NotNull + @Nonnull private static final String TAG = "CalculatorEventData"; - @NotNull + @Nonnull private final JListeners listeners = Listeners.newWeakRefListeners(); @Override - public void addCalculatorEventListener(@NotNull CalculatorEventListener calculatorEventListener) { + public void addCalculatorEventListener(@Nonnull CalculatorEventListener calculatorEventListener) { listeners.addListener(calculatorEventListener); } @Override - public void removeCalculatorEventListener(@NotNull CalculatorEventListener calculatorEventListener) { + public void removeCalculatorEventListener(@Nonnull CalculatorEventListener calculatorEventListener) { listeners.removeListener(calculatorEventListener); } @Override - public void fireCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) { + public void fireCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) { fireCalculatorEvents(Arrays.asList(new CalculatorEvent(calculatorEventData, calculatorEventType, data))); } @Override - public void fireCalculatorEvents(@NotNull List calculatorEvents) { + public void fireCalculatorEvents(@Nonnull List calculatorEvents) { final Collection listeners = this.listeners.getListeners(); //final CalculatorLogger logger = Locator.getInstance().getLogger(); diff --git a/core/src/main/java/org/solovyev/android/calculator/LiteNumberBuilder.java b/core/src/main/java/org/solovyev/android/calculator/LiteNumberBuilder.java index 1277c0c8..91cb6129 100644 --- a/core/src/main/java/org/solovyev/android/calculator/LiteNumberBuilder.java +++ b/core/src/main/java/org/solovyev/android/calculator/LiteNumberBuilder.java @@ -7,7 +7,7 @@ package org.solovyev.android.calculator; import jscl.NumeralBase; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.calculator.math.MathType; /** @@ -18,12 +18,12 @@ import org.solovyev.android.calculator.math.MathType; public class LiteNumberBuilder extends AbstractNumberBuilder { - public LiteNumberBuilder(@NotNull CalculatorEngine engine) { + public LiteNumberBuilder(@Nonnull CalculatorEngine engine) { super(engine); this.nb = engine.getNumeralBase(); } - public void process(@NotNull MathType.Result mathTypeResult) { + public void process(@Nonnull MathType.Result mathTypeResult) { if (canContinue(mathTypeResult)) { // let's continue building number if (numberBuilder == null) { diff --git a/core/src/main/java/org/solovyev/android/calculator/Locator.java b/core/src/main/java/org/solovyev/android/calculator/Locator.java index 5db9d1bc..42dd2c03 100644 --- a/core/src/main/java/org/solovyev/android/calculator/Locator.java +++ b/core/src/main/java/org/solovyev/android/calculator/Locator.java @@ -1,10 +1,11 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; import org.solovyev.android.calculator.external.CalculatorExternalListenersContainer; import org.solovyev.android.calculator.history.CalculatorHistory; import org.solovyev.android.calculator.plot.CalculatorPlotter; +import javax.annotation.Nonnull; + /** * User: Solovyev_S * Date: 20.09.12 @@ -12,59 +13,59 @@ import org.solovyev.android.calculator.plot.CalculatorPlotter; */ public class Locator implements CalculatorLocator { - @NotNull + @Nonnull private CalculatorEngine calculatorEngine; - @NotNull + @Nonnull private Calculator calculator; - @NotNull + @Nonnull private CalculatorEditor calculatorEditor; - @NotNull + @Nonnull private CalculatorDisplay calculatorDisplay; - @NotNull + @Nonnull private CalculatorKeyboard calculatorKeyboard; - @NotNull + @Nonnull private CalculatorHistory calculatorHistory; - @NotNull + @Nonnull private CalculatorNotifier calculatorNotifier = new DummyCalculatorNotifier(); - @NotNull + @Nonnull private CalculatorLogger calculatorLogger = new SystemOutCalculatorLogger(); - @NotNull + @Nonnull private CalculatorClipboard calculatorClipboard = new DummyCalculatorClipboard(); - @NotNull + @Nonnull private static final CalculatorLocator instance = new Locator(); - @NotNull + @Nonnull private CalculatorPreferenceService calculatorPreferenceService; - @NotNull + @Nonnull private CalculatorExternalListenersContainer calculatorExternalListenersContainer; - @NotNull + @Nonnull private CalculatorPlotter calculatorPlotter; public Locator() { } @Override - public void init(@NotNull Calculator calculator, - @NotNull CalculatorEngine engine, - @NotNull CalculatorClipboard clipboard, - @NotNull CalculatorNotifier notifier, - @NotNull CalculatorHistory history, - @NotNull CalculatorLogger logger, - @NotNull CalculatorPreferenceService preferenceService, - @NotNull CalculatorKeyboard keyboard, - @NotNull CalculatorExternalListenersContainer externalListenersContainer, - @NotNull CalculatorPlotter plotter) { + public void init(@Nonnull Calculator calculator, + @Nonnull CalculatorEngine engine, + @Nonnull CalculatorClipboard clipboard, + @Nonnull CalculatorNotifier notifier, + @Nonnull CalculatorHistory history, + @Nonnull CalculatorLogger logger, + @Nonnull CalculatorPreferenceService preferenceService, + @Nonnull CalculatorKeyboard keyboard, + @Nonnull CalculatorExternalListenersContainer externalListenersContainer, + @Nonnull CalculatorPlotter plotter) { this.calculator = calculator; this.calculatorEngine = engine; @@ -81,79 +82,79 @@ public class Locator implements CalculatorLocator { calculatorKeyboard = keyboard; } - @NotNull + @Nonnull public static CalculatorLocator getInstance() { return instance; } - @NotNull + @Nonnull @Override public CalculatorEngine getEngine() { return calculatorEngine; } - @NotNull + @Nonnull @Override public Calculator getCalculator() { return this.calculator; } @Override - @NotNull + @Nonnull public CalculatorDisplay getDisplay() { return calculatorDisplay; } - @NotNull + @Nonnull @Override public CalculatorEditor getEditor() { return calculatorEditor; } @Override - @NotNull + @Nonnull public CalculatorKeyboard getKeyboard() { return calculatorKeyboard; } @Override - @NotNull + @Nonnull public CalculatorClipboard getClipboard() { return calculatorClipboard; } @Override - @NotNull + @Nonnull public CalculatorNotifier getNotifier() { return calculatorNotifier; } @Override - @NotNull + @Nonnull public CalculatorHistory getHistory() { return calculatorHistory; } @Override - @NotNull + @Nonnull public CalculatorLogger getLogger() { return calculatorLogger; } - @NotNull + @Nonnull @Override public CalculatorPlotter getPlotter() { return calculatorPlotter; } - @NotNull + @Nonnull @Override public CalculatorPreferenceService getPreferenceService() { return this.calculatorPreferenceService; } @Override - @NotNull + @Nonnull public CalculatorExternalListenersContainer getExternalListenersContainer() { return calculatorExternalListenersContainer; } diff --git a/core/src/main/java/org/solovyev/android/calculator/MathEntityDao.java b/core/src/main/java/org/solovyev/android/calculator/MathEntityDao.java index 506dbe8a..8cd9d414 100644 --- a/core/src/main/java/org/solovyev/android/calculator/MathEntityDao.java +++ b/core/src/main/java/org/solovyev/android/calculator/MathEntityDao.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; /** * User: serso @@ -10,11 +10,11 @@ import org.jetbrains.annotations.Nullable; */ public interface MathEntityDao { - void save(@NotNull MathEntityPersistenceContainer container); + void save(@Nonnull MathEntityPersistenceContainer container); @Nullable MathEntityPersistenceContainer load(); @Nullable - String getDescription(@NotNull String descriptionId); + String getDescription(@Nonnull String descriptionId); } diff --git a/core/src/main/java/org/solovyev/android/calculator/MathPersistenceEntity.java b/core/src/main/java/org/solovyev/android/calculator/MathPersistenceEntity.java index 40aa08cd..c252f9aa 100644 --- a/core/src/main/java/org/solovyev/android/calculator/MathPersistenceEntity.java +++ b/core/src/main/java/org/solovyev/android/calculator/MathPersistenceEntity.java @@ -6,7 +6,7 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; /** * User: serso @@ -15,6 +15,6 @@ import org.jetbrains.annotations.NotNull; */ public interface MathPersistenceEntity { - @NotNull + @Nonnull String getName(); } diff --git a/core/src/main/java/org/solovyev/android/calculator/MessageDialogData.java b/core/src/main/java/org/solovyev/android/calculator/MessageDialogData.java index 76f2c979..095b1540 100644 --- a/core/src/main/java/org/solovyev/android/calculator/MessageDialogData.java +++ b/core/src/main/java/org/solovyev/android/calculator/MessageDialogData.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.common.msg.Message; import org.solovyev.common.msg.MessageLevel; @@ -12,29 +12,29 @@ import org.solovyev.common.msg.MessageLevel; */ public class MessageDialogData implements DialogData { - @NotNull + @Nonnull private Message message; @Nullable private String title; - private MessageDialogData(@NotNull Message message, @Nullable String title) { + private MessageDialogData(@Nonnull Message message, @Nullable String title) { this.message = message; this.title = title; } - @NotNull - public static DialogData newInstance(@NotNull Message message, @Nullable String title) { + @Nonnull + public static DialogData newInstance(@Nonnull Message message, @Nullable String title) { return new MessageDialogData(message, title); } @Override - @NotNull + @Nonnull public String getMessage() { return message.getLocalizedMessage(); } - @NotNull + @Nonnull @Override public MessageLevel getMessageLevel() { return message.getMessageLevel(); diff --git a/core/src/main/java/org/solovyev/android/calculator/NumberBuilder.java b/core/src/main/java/org/solovyev/android/calculator/NumberBuilder.java index 2a68b084..7252b809 100644 --- a/core/src/main/java/org/solovyev/android/calculator/NumberBuilder.java +++ b/core/src/main/java/org/solovyev/android/calculator/NumberBuilder.java @@ -11,8 +11,8 @@ import jscl.MathEngine; import jscl.NumeralBase; import jscl.math.numeric.Real; import jscl.text.*; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.math.MathType; import org.solovyev.common.MutableObject; @@ -26,7 +26,7 @@ import java.util.List; */ public class NumberBuilder extends AbstractNumberBuilder { - public NumberBuilder(@NotNull CalculatorEngine engine) { + public NumberBuilder(@Nonnull CalculatorEngine engine) { super(engine); } @@ -38,8 +38,8 @@ public class NumberBuilder extends AbstractNumberBuilder { * @param offset offset between new number length and old number length (newNumberLength - oldNumberLength) * @return new math type result (as one can be changed due to substituting of number with constant) */ - @NotNull - public MathType.Result process(@NotNull StringBuilder text, @NotNull MathType.Result mathTypeResult, @Nullable MutableObject offset) { + @Nonnull + public MathType.Result process(@Nonnull StringBuilder text, @Nonnull MathType.Result mathTypeResult, @Nullable MutableObject offset) { final MathType.Result possibleResult; if (canContinue(mathTypeResult)) { // let's continue building number @@ -73,7 +73,7 @@ public class NumberBuilder extends AbstractNumberBuilder { * @return new math type result (as one can be changed due to substituting of number with constant) */ @Nullable - public MathType.Result processNumber(@NotNull StringBuilder text, @Nullable MutableObject offset) { + public MathType.Result processNumber(@Nonnull StringBuilder text, @Nullable MutableObject offset) { // total number of trimmed chars int trimmedChars = 0; @@ -115,12 +115,12 @@ public class NumberBuilder extends AbstractNumberBuilder { } @Nullable - private static MathType.Result replaceNumberInText(@NotNull StringBuilder text, + private static MathType.Result replaceNumberInText(@Nonnull StringBuilder text, @Nullable String number, int trimmedChars, @Nullable MutableObject offset, - @NotNull NumeralBase nb, - @NotNull final MathEngine engine) { + @Nonnull NumeralBase nb, + @Nonnull final MathEngine engine) { MathType.Result result = null; if (number != null) { @@ -139,8 +139,8 @@ public class NumberBuilder extends AbstractNumberBuilder { return result; } - @NotNull - private static String formatNumber(@NotNull String number, @NotNull NumeralBase nb, @NotNull MathEngine engine) { + @Nonnull + private static String formatNumber(@Nonnull String number, @Nonnull NumeralBase nb, @Nonnull MathEngine engine) { String result; int indexOfDot = number.indexOf('.'); @@ -176,8 +176,8 @@ public class NumberBuilder extends AbstractNumberBuilder { return result; } - @NotNull - private static Double toDouble(@NotNull String s, @NotNull NumeralBase nb, @NotNull final MathContext mc) throws NumberFormatException { + @Nonnull + private static Double toDouble(@Nonnull String s, @Nonnull NumeralBase nb, @Nonnull final MathContext mc) throws NumberFormatException { final NumeralBase defaultNb = mc.getNumeralBase(); try { mc.setNumeralBase(nb); diff --git a/core/src/main/java/org/solovyev/android/calculator/OperatorCategory.java b/core/src/main/java/org/solovyev/android/calculator/OperatorCategory.java index 7408accb..a78cd63e 100644 --- a/core/src/main/java/org/solovyev/android/calculator/OperatorCategory.java +++ b/core/src/main/java/org/solovyev/android/calculator/OperatorCategory.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator; import jscl.math.operator.*; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.common.collections.Collections; import java.util.Comparator; @@ -16,28 +16,28 @@ public enum OperatorCategory { derivatives(100) { @Override - public boolean isInCategory(@NotNull Operator operator) { + public boolean isInCategory(@Nonnull Operator operator) { return operator instanceof Derivative || operator instanceof Integral || operator instanceof IndefiniteIntegral; } }, other(200) { @Override - public boolean isInCategory(@NotNull Operator operator) { + public boolean isInCategory(@Nonnull Operator operator) { return operator instanceof Sum || operator instanceof Product; } }, my(0) { @Override - public boolean isInCategory(@NotNull Operator operator) { + public boolean isInCategory(@Nonnull Operator operator) { return !operator.isSystem(); } }, common(50) { @Override - public boolean isInCategory(@NotNull Operator operator) { + public boolean isInCategory(@Nonnull Operator operator) { for (OperatorCategory category : values()) { if (category != this) { if (category.isInCategory(operator)) { @@ -56,9 +56,9 @@ public enum OperatorCategory { this.tabOrder = tabOrder; } - public abstract boolean isInCategory(@NotNull Operator operator); + public abstract boolean isInCategory(@Nonnull Operator operator); - @NotNull + @Nonnull public static List getCategoriesByTabOrder() { final List result = Collections.asList(OperatorCategory.values()); diff --git a/core/src/main/java/org/solovyev/android/calculator/PreparedExpression.java b/core/src/main/java/org/solovyev/android/calculator/PreparedExpression.java index 0155de71..35c8ded9 100644 --- a/core/src/main/java/org/solovyev/android/calculator/PreparedExpression.java +++ b/core/src/main/java/org/solovyev/android/calculator/PreparedExpression.java @@ -7,7 +7,7 @@ package org.solovyev.android.calculator; import jscl.math.function.IConstant; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.List; @@ -18,18 +18,18 @@ import java.util.List; */ public class PreparedExpression implements CharSequence { - @NotNull + @Nonnull private String expression; - @NotNull + @Nonnull private List undefinedVars; - public PreparedExpression(@NotNull String expression, @NotNull List undefinedVars) { + public PreparedExpression(@Nonnull String expression, @Nonnull List undefinedVars) { this.expression = expression; this.undefinedVars = undefinedVars; } - @NotNull + @Nonnull public String getExpression() { return expression; } @@ -38,7 +38,7 @@ public class PreparedExpression implements CharSequence { return !this.undefinedVars.isEmpty(); } - @NotNull + @Nonnull public List getUndefinedVars() { return undefinedVars; } diff --git a/core/src/main/java/org/solovyev/android/calculator/StringDialogData.java b/core/src/main/java/org/solovyev/android/calculator/StringDialogData.java index 82a07370..1d953c23 100644 --- a/core/src/main/java/org/solovyev/android/calculator/StringDialogData.java +++ b/core/src/main/java/org/solovyev/android/calculator/StringDialogData.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.common.msg.MessageType; /** @@ -11,33 +11,33 @@ import org.solovyev.common.msg.MessageType; */ public class StringDialogData implements DialogData { - @NotNull + @Nonnull private final String message; - @NotNull + @Nonnull private final MessageType messageType; @Nullable private final String title; - private StringDialogData(@NotNull String message, @NotNull MessageType messageType, @Nullable String title) { + private StringDialogData(@Nonnull String message, @Nonnull MessageType messageType, @Nullable String title) { this.message = message; this.messageType = messageType; this.title = title; } - @NotNull - public static DialogData newInstance(@NotNull String message, @NotNull MessageType messageType, @Nullable String title) { + @Nonnull + public static DialogData newInstance(@Nonnull String message, @Nonnull MessageType messageType, @Nullable String title) { return new StringDialogData(message, messageType, title); } - @NotNull + @Nonnull @Override public String getMessage() { return message; } - @NotNull + @Nonnull @Override public MessageType getMessageLevel() { return messageType; diff --git a/core/src/main/java/org/solovyev/android/calculator/SystemOutCalculatorLogger.java b/core/src/main/java/org/solovyev/android/calculator/SystemOutCalculatorLogger.java index 6e25b565..d33b164d 100644 --- a/core/src/main/java/org/solovyev/android/calculator/SystemOutCalculatorLogger.java +++ b/core/src/main/java/org/solovyev/android/calculator/SystemOutCalculatorLogger.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; /** * User: serso @@ -10,7 +10,7 @@ import org.jetbrains.annotations.Nullable; */ public class SystemOutCalculatorLogger implements CalculatorLogger { - @NotNull + @Nonnull private static final String TAG = SystemOutCalculatorLogger.class.getSimpleName(); @Override @@ -18,19 +18,19 @@ public class SystemOutCalculatorLogger implements CalculatorLogger { System.out.println(getTag(tag) + ": " + message); } - @NotNull + @Nonnull private String getTag(@Nullable String tag) { return tag != null ? tag : TAG; } @Override - public void debug(@Nullable String tag, @Nullable String message, @NotNull Throwable e) { + public void debug(@Nullable String tag, @Nullable String message, @Nonnull Throwable e) { debug(tag, message); e.printStackTrace(System.out); } @Override - public void error(@Nullable String tag, @Nullable String message, @NotNull Throwable e) { + public void error(@Nullable String tag, @Nullable String message, @Nonnull Throwable e) { System.out.println(getTag(tag) + ": " + message); e.printStackTrace(System.out); } diff --git a/core/src/main/java/org/solovyev/android/calculator/ToJsclTextProcessor.java b/core/src/main/java/org/solovyev/android/calculator/ToJsclTextProcessor.java index a7364246..d8ad9527 100644 --- a/core/src/main/java/org/solovyev/android/calculator/ToJsclTextProcessor.java +++ b/core/src/main/java/org/solovyev/android/calculator/ToJsclTextProcessor.java @@ -8,7 +8,7 @@ package org.solovyev.android.calculator; import jscl.math.function.Function; import jscl.math.function.IConstant; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.calculator.math.MathType; import org.solovyev.android.calculator.text.TextProcessor; import org.solovyev.common.collections.Collections; @@ -20,33 +20,33 @@ import java.util.List; public class ToJsclTextProcessor implements TextProcessor { - @NotNull + @Nonnull private static final Integer MAX_DEPTH = 20; - @NotNull + @Nonnull private static final TextProcessor instance = new ToJsclTextProcessor(); private ToJsclTextProcessor() { } - @NotNull + @Nonnull public static TextProcessor getInstance() { return instance; } @Override - @NotNull - public PreparedExpression process(@NotNull String s) throws CalculatorParseException { + @Nonnull + public PreparedExpression process(@Nonnull String s) throws CalculatorParseException { return processWithDepth(s, 0, new ArrayList()); } - private static PreparedExpression processWithDepth(@NotNull String s, int depth, @NotNull List undefinedVars) throws CalculatorParseException { + private static PreparedExpression processWithDepth(@Nonnull String s, int depth, @Nonnull List undefinedVars) throws CalculatorParseException { return replaceVariables(processExpression(s).toString(), depth, undefinedVars); } - @NotNull - private static StringBuilder processExpression(@NotNull String s) throws CalculatorParseException { + @Nonnull + private static StringBuilder processExpression(@Nonnull String s) throws CalculatorParseException { final StartsWithFinder startsWithFinder = StartsWithFinder.newInstance(s); final StringBuilder result = new StringBuilder(); @@ -88,8 +88,8 @@ public class ToJsclTextProcessor implements TextProcessor undefinedVars) throws CalculatorParseException { + @Nonnull + private static PreparedExpression replaceVariables(@Nonnull final String s, int depth, @Nonnull List undefinedVars) throws CalculatorParseException { if (depth >= MAX_DEPTH) { throw new CalculatorParseException(s, new CalculatorMessage(CalculatorMessages.msg_006, MessageType.error)); } else { diff --git a/core/src/main/java/org/solovyev/android/calculator/VarCategory.java b/core/src/main/java/org/solovyev/android/calculator/VarCategory.java index 3d363a2a..6b397975 100644 --- a/core/src/main/java/org/solovyev/android/calculator/VarCategory.java +++ b/core/src/main/java/org/solovyev/android/calculator/VarCategory.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator; import jscl.math.function.IConstant; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.common.collections.Collections; import java.util.Comparator; @@ -16,14 +16,14 @@ public enum VarCategory { system(100) { @Override - public boolean isInCategory(@NotNull IConstant var) { + public boolean isInCategory(@Nonnull IConstant var) { return var.isSystem(); } }, my(0) { @Override - public boolean isInCategory(@NotNull IConstant var) { + public boolean isInCategory(@Nonnull IConstant var) { return !var.isSystem(); } }; @@ -34,9 +34,9 @@ public enum VarCategory { this.tabOrder = tabOrder; } - public abstract boolean isInCategory(@NotNull IConstant var); + public abstract boolean isInCategory(@Nonnull IConstant var); - @NotNull + @Nonnull public static List getCategoriesByTabOrder() { final List result = Collections.asList(VarCategory.values()); diff --git a/core/src/main/java/org/solovyev/android/calculator/external/CalculatorExternalListenersContainer.java b/core/src/main/java/org/solovyev/android/calculator/external/CalculatorExternalListenersContainer.java index b2a87669..14d79383 100644 --- a/core/src/main/java/org/solovyev/android/calculator/external/CalculatorExternalListenersContainer.java +++ b/core/src/main/java/org/solovyev/android/calculator/external/CalculatorExternalListenersContainer.java @@ -1,10 +1,10 @@ package org.solovyev.android.calculator.external; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; public interface CalculatorExternalListenersContainer { - void addExternalListener(@NotNull Class externalCalculatorClass); + void addExternalListener(@Nonnull Class externalCalculatorClass); - boolean removeExternalListener(@NotNull Class externalCalculatorClass); + boolean removeExternalListener(@Nonnull Class externalCalculatorClass); } diff --git a/core/src/main/java/org/solovyev/android/calculator/function/FunctionBuilderAdapter.java b/core/src/main/java/org/solovyev/android/calculator/function/FunctionBuilderAdapter.java index 144c1447..e7ba2e88 100644 --- a/core/src/main/java/org/solovyev/android/calculator/function/FunctionBuilderAdapter.java +++ b/core/src/main/java/org/solovyev/android/calculator/function/FunctionBuilderAdapter.java @@ -3,8 +3,8 @@ package org.solovyev.android.calculator.function; import jscl.CustomFunctionCalculationException; import jscl.math.function.CustomFunction; import jscl.math.function.Function; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.model.AFunction; import org.solovyev.android.calculator.model.MathEntityBuilder; @@ -15,35 +15,35 @@ import org.solovyev.android.calculator.model.MathEntityBuilder; */ public final class FunctionBuilderAdapter implements MathEntityBuilder { - @NotNull + @Nonnull private final AFunction.Builder nestedBuilder; - public FunctionBuilderAdapter(@NotNull AFunction.Builder nestedBuilder) { + public FunctionBuilderAdapter(@Nonnull AFunction.Builder nestedBuilder) { this.nestedBuilder = nestedBuilder; } - @NotNull + @Nonnull @Override - public MathEntityBuilder setName(@NotNull String name) { + public MathEntityBuilder setName(@Nonnull String name) { nestedBuilder.setName(name); return this; } - @NotNull + @Nonnull @Override public MathEntityBuilder setDescription(@Nullable String description) { nestedBuilder.setDescription(description); return this; } - @NotNull + @Nonnull @Override public MathEntityBuilder setValue(@Nullable String value) { nestedBuilder.setValue(value); return this; } - @NotNull + @Nonnull @Override public Function create() throws CustomFunctionCalculationException, AFunction.Builder.CreationException { final AFunction function = nestedBuilder.create(); diff --git a/core/src/main/java/org/solovyev/android/calculator/history/AbstractHistoryState.java b/core/src/main/java/org/solovyev/android/calculator/history/AbstractHistoryState.java index 87e03229..4d75d2df 100644 --- a/core/src/main/java/org/solovyev/android/calculator/history/AbstractHistoryState.java +++ b/core/src/main/java/org/solovyev/android/calculator/history/AbstractHistoryState.java @@ -6,7 +6,7 @@ package org.solovyev.android.calculator.history; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nullable; import org.simpleframework.xml.Element; import org.simpleframework.xml.Transient; diff --git a/core/src/main/java/org/solovyev/android/calculator/history/CalculatorDisplayHistoryState.java b/core/src/main/java/org/solovyev/android/calculator/history/CalculatorDisplayHistoryState.java index 4535c876..c9574de8 100644 --- a/core/src/main/java/org/solovyev/android/calculator/history/CalculatorDisplayHistoryState.java +++ b/core/src/main/java/org/solovyev/android/calculator/history/CalculatorDisplayHistoryState.java @@ -6,8 +6,8 @@ package org.solovyev.android.calculator.history; import jscl.math.Generic; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.simpleframework.xml.Element; import org.simpleframework.xml.Root; import org.simpleframework.xml.Transient; @@ -34,11 +34,11 @@ public class CalculatorDisplayHistoryState implements Cloneable { private String errorMessage = null; @Element - @NotNull + @Nonnull private EditorHistoryState editorState; @Element - @NotNull + @Nonnull private JsclOperation jsclOperation; @Transient @@ -49,8 +49,8 @@ public class CalculatorDisplayHistoryState implements Cloneable { // for xml } - @NotNull - public static CalculatorDisplayHistoryState newInstance(@NotNull CalculatorDisplayViewState viewState) { + @Nonnull + public static CalculatorDisplayHistoryState newInstance(@Nonnull CalculatorDisplayViewState viewState) { final CalculatorDisplayHistoryState result = new CalculatorDisplayHistoryState(); result.editorState = EditorHistoryState.newInstance(viewState); @@ -63,7 +63,7 @@ public class CalculatorDisplayHistoryState implements Cloneable { return result; } - public void setValuesFromHistory(@NotNull CalculatorDisplay display) { + public void setValuesFromHistory(@Nonnull CalculatorDisplay display) { if (this.isValid()) { display.setViewState(CalculatorDisplayViewStateImpl.newValidState(this.getJsclOperation(), this.getGenericResult(), Strings.getNotEmpty(this.getEditorState().getText(), ""), this.getEditorState().getCursorPosition())); } else { @@ -76,12 +76,12 @@ public class CalculatorDisplayHistoryState implements Cloneable { return valid; } - @NotNull + @Nonnull public EditorHistoryState getEditorState() { return editorState; } - @NotNull + @Nonnull public JsclOperation getJsclOperation() { return jsclOperation; } diff --git a/core/src/main/java/org/solovyev/android/calculator/history/CalculatorHistory.java b/core/src/main/java/org/solovyev/android/calculator/history/CalculatorHistory.java index c07e432a..b4f9aa6e 100644 --- a/core/src/main/java/org/solovyev/android/calculator/history/CalculatorHistory.java +++ b/core/src/main/java/org/solovyev/android/calculator/history/CalculatorHistory.java @@ -1,6 +1,6 @@ package org.solovyev.android.calculator.history; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.calculator.CalculatorEventListener; import org.solovyev.common.history.HistoryHelper; @@ -17,24 +17,24 @@ public interface CalculatorHistory extends HistoryHelper void save(); - void fromXml(@NotNull String xml); + void fromXml(@Nonnull String xml); String toXml(); void clearSavedHistory(); - void removeSavedHistory(@NotNull CalculatorHistoryState historyState); + void removeSavedHistory(@Nonnull CalculatorHistoryState historyState); - @NotNull + @Nonnull List getSavedHistory(); - @NotNull - CalculatorHistoryState addSavedState(@NotNull CalculatorHistoryState historyState); + @Nonnull + CalculatorHistoryState addSavedState(@Nonnull CalculatorHistoryState historyState); - @NotNull + @Nonnull List getStates(); - @NotNull + @Nonnull List getStates(boolean includeIntermediateStates); } diff --git a/core/src/main/java/org/solovyev/android/calculator/history/CalculatorHistoryImpl.java b/core/src/main/java/org/solovyev/android/calculator/history/CalculatorHistoryImpl.java index 056b8af2..68355d9f 100644 --- a/core/src/main/java/org/solovyev/android/calculator/history/CalculatorHistoryImpl.java +++ b/core/src/main/java/org/solovyev/android/calculator/history/CalculatorHistoryImpl.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator.history; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.*; import org.solovyev.common.history.HistoryAction; import org.solovyev.common.history.HistoryHelper; @@ -24,19 +24,19 @@ public class CalculatorHistoryImpl implements CalculatorHistory { private final AtomicInteger counter = new AtomicInteger(0); - @NotNull + @Nonnull private final HistoryHelper history = SimpleHistoryHelper.newInstance(); - @NotNull + @Nonnull private final List savedHistory = new ArrayList(); - @NotNull + @Nonnull private final CalculatorEventHolder lastEventData = new CalculatorEventHolder(CalculatorUtils.createFirstEventDataId()); @Nullable private volatile CalculatorEditorViewState lastEditorViewState; - public CalculatorHistoryImpl(@NotNull Calculator calculator) { + public CalculatorHistoryImpl(@Nonnull Calculator calculator) { calculator.addCalculatorEventListener(this); } @@ -81,14 +81,14 @@ public class CalculatorHistoryImpl implements CalculatorHistory { } @Override - public boolean isActionAvailable(@NotNull HistoryAction historyAction) { + public boolean isActionAvailable(@Nonnull HistoryAction historyAction) { synchronized (history) { return history.isActionAvailable(historyAction); } } @Override - public CalculatorHistoryState doAction(@NotNull HistoryAction historyAction, @Nullable CalculatorHistoryState currentState) { + public CalculatorHistoryState doAction(@Nonnull HistoryAction historyAction, @Nullable CalculatorHistoryState currentState) { synchronized (history) { return history.doAction(historyAction, currentState); } @@ -102,7 +102,7 @@ public class CalculatorHistoryImpl implements CalculatorHistory { } } - @NotNull + @Nonnull @Override public List getStates() { synchronized (history) { @@ -110,7 +110,7 @@ public class CalculatorHistoryImpl implements CalculatorHistory { } } - @NotNull + @Nonnull @Override public List getStates(boolean includeIntermediateStates) { synchronized (history) { @@ -143,8 +143,8 @@ public class CalculatorHistoryImpl implements CalculatorHistory { } } - private boolean isIntermediate(@NotNull String laterEditorText, - @NotNull String editorText) { + private boolean isIntermediate(@Nonnull String laterEditorText, + @Nonnull String editorText) { if (Math.abs(laterEditorText.length() - editorText.length()) <= 1) { if (laterEditorText.length() > editorText.length()) { return laterEditorText.startsWith(editorText); @@ -164,14 +164,14 @@ public class CalculatorHistoryImpl implements CalculatorHistory { } @Override - @NotNull + @Nonnull public List getSavedHistory() { return Collections.unmodifiableList(savedHistory); } @Override - @NotNull - public CalculatorHistoryState addSavedState(@NotNull CalculatorHistoryState historyState) { + @Nonnull + public CalculatorHistoryState addSavedState(@Nonnull CalculatorHistoryState historyState) { if (historyState.isSaved()) { return historyState; } else { @@ -197,7 +197,7 @@ public class CalculatorHistoryImpl implements CalculatorHistory { } @Override - public void fromXml(@NotNull String xml) { + public void fromXml(@Nonnull String xml) { clearSavedHistory(); HistoryUtils.fromXml(xml, this.savedHistory); @@ -218,13 +218,13 @@ public class CalculatorHistoryImpl implements CalculatorHistory { } @Override - public void removeSavedHistory(@NotNull CalculatorHistoryState historyState) { + public void removeSavedHistory(@Nonnull CalculatorHistoryState historyState) { this.savedHistory.remove(historyState); } @Override - public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, - @NotNull CalculatorEventType calculatorEventType, + public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, + @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) { if (calculatorEventType.isOfType(editor_state_changed, display_state_changed, manual_calculation_requested)) { diff --git a/core/src/main/java/org/solovyev/android/calculator/history/CalculatorHistoryState.java b/core/src/main/java/org/solovyev/android/calculator/history/CalculatorHistoryState.java index a43b67d2..4f6170bf 100644 --- a/core/src/main/java/org/solovyev/android/calculator/history/CalculatorHistoryState.java +++ b/core/src/main/java/org/solovyev/android/calculator/history/CalculatorHistoryState.java @@ -5,7 +5,7 @@ package org.solovyev.android.calculator.history; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.simpleframework.xml.Element; import org.simpleframework.xml.Root; import org.solovyev.android.calculator.CalculatorDisplay; @@ -23,35 +23,35 @@ import org.solovyev.android.calculator.CalculatorEditorViewState; public class CalculatorHistoryState extends AbstractHistoryState { @Element - @NotNull + @Nonnull private EditorHistoryState editorState; @Element - @NotNull + @Nonnull private CalculatorDisplayHistoryState displayState; private CalculatorHistoryState() { // for xml } - private CalculatorHistoryState(@NotNull EditorHistoryState editorState, - @NotNull CalculatorDisplayHistoryState displayState) { + private CalculatorHistoryState(@Nonnull EditorHistoryState editorState, + @Nonnull CalculatorDisplayHistoryState displayState) { this.editorState = editorState; this.displayState = displayState; } - @NotNull - public static CalculatorHistoryState newInstance(@NotNull CalculatorEditor editor, - @NotNull CalculatorDisplay display) { + @Nonnull + public static CalculatorHistoryState newInstance(@Nonnull CalculatorEditor editor, + @Nonnull CalculatorDisplay display) { final CalculatorEditorViewState editorViewState = editor.getViewState(); final CalculatorDisplayViewState displayViewState = display.getViewState(); return newInstance(editorViewState, displayViewState); } - @NotNull - public static CalculatorHistoryState newInstance(@NotNull CalculatorEditorViewState editorViewState, - @NotNull CalculatorDisplayViewState displayViewState) { + @Nonnull + public static CalculatorHistoryState newInstance(@Nonnull CalculatorEditorViewState editorViewState, + @Nonnull CalculatorDisplayViewState displayViewState) { final EditorHistoryState editorHistoryState = EditorHistoryState.newInstance(editorViewState); final CalculatorDisplayHistoryState displayHistoryState = CalculatorDisplayHistoryState.newInstance(displayViewState); @@ -59,21 +59,21 @@ public class CalculatorHistoryState extends AbstractHistoryState { return new CalculatorHistoryState(editorHistoryState, displayHistoryState); } - @NotNull + @Nonnull public EditorHistoryState getEditorState() { return editorState; } - public void setEditorState(@NotNull EditorHistoryState editorState) { + public void setEditorState(@Nonnull EditorHistoryState editorState) { this.editorState = editorState; } - @NotNull + @Nonnull public CalculatorDisplayHistoryState getDisplayState() { return displayState; } - public void setDisplayState(@NotNull CalculatorDisplayHistoryState displayState) { + public void setDisplayState(@Nonnull CalculatorDisplayHistoryState displayState) { this.displayState = displayState; } @@ -109,7 +109,7 @@ public class CalculatorHistoryState extends AbstractHistoryState { return result; } - public void setValuesFromHistory(@NotNull CalculatorEditor editor, @NotNull CalculatorDisplay display) { + public void setValuesFromHistory(@Nonnull CalculatorEditor editor, @Nonnull CalculatorDisplay display) { this.getEditorState().setValuesFromHistory(editor); this.getDisplayState().setValuesFromHistory(display); } diff --git a/core/src/main/java/org/solovyev/android/calculator/history/EditorHistoryState.java b/core/src/main/java/org/solovyev/android/calculator/history/EditorHistoryState.java index 4f058f23..bb1cdeeb 100644 --- a/core/src/main/java/org/solovyev/android/calculator/history/EditorHistoryState.java +++ b/core/src/main/java/org/solovyev/android/calculator/history/EditorHistoryState.java @@ -5,8 +5,8 @@ package org.solovyev.android.calculator.history; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.simpleframework.xml.Element; import org.simpleframework.xml.Root; import org.solovyev.android.calculator.CalculatorDisplayViewState; @@ -28,8 +28,8 @@ public class EditorHistoryState implements Cloneable { // for xml } - @NotNull - public static EditorHistoryState newInstance(@NotNull CalculatorEditorViewState viewState) { + @Nonnull + public static EditorHistoryState newInstance(@Nonnull CalculatorEditorViewState viewState) { final EditorHistoryState result = new EditorHistoryState(); result.text = String.valueOf(viewState.getText()); @@ -38,8 +38,8 @@ public class EditorHistoryState implements Cloneable { return result; } - @NotNull - public static EditorHistoryState newInstance(@NotNull CalculatorDisplayViewState viewState) { + @Nonnull + public static EditorHistoryState newInstance(@Nonnull CalculatorDisplayViewState viewState) { final EditorHistoryState result = new EditorHistoryState(); result.text = viewState.getText(); @@ -48,7 +48,7 @@ public class EditorHistoryState implements Cloneable { return result; } - public void setValuesFromHistory(@NotNull CalculatorEditor editor) { + public void setValuesFromHistory(@Nonnull CalculatorEditor editor) { editor.setText(Strings.getNotEmpty(this.getText(), "")); editor.setSelection(this.getCursorPosition()); } diff --git a/core/src/main/java/org/solovyev/android/calculator/history/HistoryUtils.java b/core/src/main/java/org/solovyev/android/calculator/history/HistoryUtils.java index bda4ca11..4a5e01f8 100644 --- a/core/src/main/java/org/solovyev/android/calculator/history/HistoryUtils.java +++ b/core/src/main/java/org/solovyev/android/calculator/history/HistoryUtils.java @@ -6,8 +6,8 @@ package org.solovyev.android.calculator.history; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.simpleframework.xml.Serializer; import org.simpleframework.xml.core.Persister; @@ -26,7 +26,7 @@ class HistoryUtils { throw new AssertionError(); } - public static void fromXml(@Nullable String xml, @NotNull List historyItems) { + public static void fromXml(@Nullable String xml, @Nonnull List historyItems) { if (xml != null) { final Serializer serializer = new Persister(); try { @@ -40,8 +40,8 @@ class HistoryUtils { } } - @NotNull - public static String toXml(@NotNull List historyItems) { + @Nonnull + public static String toXml(@Nonnull List historyItems) { final History history = new History(); for (CalculatorHistoryState historyState : historyItems) { if (historyState.isSaved()) { diff --git a/core/src/main/java/org/solovyev/android/calculator/jscl/FromJsclNumericTextProcessor.java b/core/src/main/java/org/solovyev/android/calculator/jscl/FromJsclNumericTextProcessor.java index 2251e5b8..f45b4c92 100644 --- a/core/src/main/java/org/solovyev/android/calculator/jscl/FromJsclNumericTextProcessor.java +++ b/core/src/main/java/org/solovyev/android/calculator/jscl/FromJsclNumericTextProcessor.java @@ -7,7 +7,7 @@ package org.solovyev.android.calculator.jscl; import jscl.math.Generic; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.calculator.CalculatorParseException; import org.solovyev.android.calculator.text.TextProcessor; @@ -20,9 +20,9 @@ class FromJsclNumericTextProcessor implements TextProcessor { public static final FromJsclNumericTextProcessor instance = new FromJsclNumericTextProcessor(); - @NotNull + @Nonnull @Override - public String process(@NotNull Generic numeric) throws CalculatorParseException { + public String process(@Nonnull Generic numeric) throws CalculatorParseException { return numeric.toString().replace("*", ""); } } diff --git a/core/src/main/java/org/solovyev/android/calculator/jscl/JsclOperation.java b/core/src/main/java/org/solovyev/android/calculator/jscl/JsclOperation.java index 38a69a58..d01866ac 100644 --- a/core/src/main/java/org/solovyev/android/calculator/jscl/JsclOperation.java +++ b/core/src/main/java/org/solovyev/android/calculator/jscl/JsclOperation.java @@ -8,7 +8,7 @@ package org.solovyev.android.calculator.jscl; import jscl.math.Generic; import jscl.text.ParseException; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.calculator.CalculatorMathEngine; import org.solovyev.android.calculator.text.DummyTextProcessor; import org.solovyev.android.calculator.text.FromJsclSimplifyTextProcessor; @@ -24,7 +24,7 @@ public enum JsclOperation { } - @NotNull + @Nonnull public TextProcessor getFromProcessor() { switch (this) { case simplify: @@ -38,8 +38,8 @@ public enum JsclOperation { } } - @NotNull - public final String evaluate(@NotNull String expression, @NotNull CalculatorMathEngine engine) throws ParseException { + @Nonnull + public final String evaluate(@Nonnull String expression, @Nonnull CalculatorMathEngine engine) throws ParseException { switch (this) { case simplify: return engine.simplify(expression); @@ -52,8 +52,8 @@ public enum JsclOperation { } } - @NotNull - public final Generic evaluateGeneric(@NotNull String expression, @NotNull CalculatorMathEngine engine) throws ParseException { + @Nonnull + public final Generic evaluateGeneric(@Nonnull String expression, @Nonnull CalculatorMathEngine engine) throws ParseException { switch (this) { case simplify: return engine.simplifyGeneric(expression); diff --git a/core/src/main/java/org/solovyev/android/calculator/math/MathType.java b/core/src/main/java/org/solovyev/android/calculator/math/MathType.java index 2d73094b..9945eb4c 100644 --- a/core/src/main/java/org/solovyev/android/calculator/math/MathType.java +++ b/core/src/main/java/org/solovyev/android/calculator/math/MathType.java @@ -8,8 +8,8 @@ package org.solovyev.android.calculator.math; import jscl.JsclMathEngine; import jscl.NumeralBase; import jscl.math.function.Constants; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.CalculatorParseException; import org.solovyev.android.calculator.Locator; import org.solovyev.common.JPredicate; @@ -32,7 +32,7 @@ public enum MathType { } } - @NotNull + @Nonnull @Override public List getTokens() { return tokens; @@ -41,14 +41,14 @@ public enum MathType { dot(200, true, true, MathGroupType.number, ".") { @Override - public boolean isNeedMultiplicationSignBefore(@NotNull MathType mathTypeBefore) { + public boolean isNeedMultiplicationSignBefore(@Nonnull MathType mathTypeBefore) { return super.isNeedMultiplicationSignBefore(mathTypeBefore) && mathTypeBefore != digit; } }, grouping_separator(250, false, false, MathGroupType.number, "'", " ") { @Override - public int processToJscl(@NotNull StringBuilder result, int i, @NotNull String match) throws CalculatorParseException { + public int processToJscl(@Nonnull StringBuilder result, int i, @Nonnull String match) throws CalculatorParseException { return i; } }, @@ -56,7 +56,7 @@ public enum MathType { power_10(300, false, false, MathGroupType.number, "E"), postfix_function(400, false, true, MathGroupType.function) { - @NotNull + @Nonnull @Override public List getTokens() { return Locator.getInstance().getEngine().getPostfixFunctionsRegistry().getNames(); @@ -66,7 +66,7 @@ public enum MathType { unary_operation(500, false, false, MathGroupType.operation, "-", "="), binary_operation(600, false, false, MathGroupType.operation, "-", "+", "*", "×", "∙", "/", "^") { @Override - protected String getSubstituteToJscl(@NotNull String match) { + protected String getSubstituteToJscl(@Nonnull String match) { if (match.equals("×") || match.equals("∙")) { return "*"; } else { @@ -77,30 +77,30 @@ public enum MathType { open_group_symbol(800, true, false, MathGroupType.other, "[", "(", "{") { @Override - public boolean isNeedMultiplicationSignBefore(@NotNull MathType mathTypeBefore) { + public boolean isNeedMultiplicationSignBefore(@Nonnull MathType mathTypeBefore) { return super.isNeedMultiplicationSignBefore(mathTypeBefore) && mathTypeBefore != function && mathTypeBefore != operator; } @Override - protected String getSubstituteToJscl(@NotNull String match) { + protected String getSubstituteToJscl(@Nonnull String match) { return "("; } }, close_group_symbol(900, false, true, MathGroupType.other, "]", ")", "}") { @Override - public boolean isNeedMultiplicationSignBefore(@NotNull MathType mathTypeBefore) { + public boolean isNeedMultiplicationSignBefore(@Nonnull MathType mathTypeBefore) { return false; } @Override - protected String getSubstituteToJscl(@NotNull String match) { + protected String getSubstituteToJscl(@Nonnull String match) { return ")"; } }, function(1000, true, true, MathGroupType.function) { - @NotNull + @Nonnull @Override public List getTokens() { return Locator.getInstance().getEngine().getFunctionsRegistry().getNames(); @@ -108,7 +108,7 @@ public enum MathType { }, operator(1050, true, true, MathGroupType.function) { - @NotNull + @Nonnull @Override public List getTokens() { return Locator.getInstance().getEngine().getOperatorsRegistry().getNames(); @@ -116,14 +116,14 @@ public enum MathType { }, constant(1100, true, true, MathGroupType.other) { - @NotNull + @Nonnull @Override public List getTokens() { return Locator.getInstance().getEngine().getVarsRegistry().getNames(); } @Override - protected String getSubstituteFromJscl(@NotNull String match) { + protected String getSubstituteFromJscl(@Nonnull String match) { return Constants.INF_2.getName().equals(match) ? MathType.INFINITY : super.getSubstituteFromJscl(match); } }, @@ -138,11 +138,11 @@ public enum MathType { } @Override - public boolean isNeedMultiplicationSignBefore(@NotNull MathType mathTypeBefore) { + public boolean isNeedMultiplicationSignBefore(@Nonnull MathType mathTypeBefore) { return super.isNeedMultiplicationSignBefore(mathTypeBefore) && mathTypeBefore != digit && mathTypeBefore != dot /*&& mathTypeBefore != numeral_base*/; } - @NotNull + @Nonnull @Override public List getTokens() { return tokens; @@ -153,7 +153,7 @@ public enum MathType { text(1200, false, false, MathGroupType.other) { @Override - public int processToJscl(@NotNull StringBuilder result, int i, @NotNull String match) { + public int processToJscl(@Nonnull StringBuilder result, int i, @Nonnull String match) { if (match.length() > 0) { result.append(match.charAt(0)); } @@ -161,7 +161,7 @@ public enum MathType { } @Override - public int processFromJscl(@NotNull StringBuilder result, int i, @NotNull String match) { + public int processFromJscl(@Nonnull StringBuilder result, int i, @Nonnull String match) { if (match.length() > 0) { result.append(match.charAt(0)); } @@ -176,32 +176,32 @@ public enum MathType { other } - @NotNull + @Nonnull private final List tokens; - @NotNull + @Nonnull private final Integer priority; private final boolean needMultiplicationSignBefore; private final boolean needMultiplicationSignAfter; - @NotNull + @Nonnull private final MathGroupType groupType; - MathType(@NotNull Integer priority, + MathType(@Nonnull Integer priority, boolean needMultiplicationSignBefore, boolean needMultiplicationSignAfter, - @NotNull MathGroupType groupType, - @NotNull String... tokens) { + @Nonnull MathGroupType groupType, + @Nonnull String... tokens) { this(priority, needMultiplicationSignBefore, needMultiplicationSignAfter, groupType, Collections.asList(tokens)); } - MathType(@NotNull Integer priority, + MathType(@Nonnull Integer priority, boolean needMultiplicationSignBefore, boolean needMultiplicationSignAfter, - @NotNull MathGroupType groupType, - @NotNull List tokens) { + @Nonnull MathGroupType groupType, + @Nonnull List tokens) { this.priority = priority; this.needMultiplicationSignBefore = needMultiplicationSignBefore; this.needMultiplicationSignAfter = needMultiplicationSignAfter; @@ -209,12 +209,12 @@ public enum MathType { this.tokens = java.util.Collections.unmodifiableList(tokens); } - @NotNull + @Nonnull public MathGroupType getGroupType() { return groupType; } - /* public static int getPostfixFunctionStart(@NotNull CharSequence s, int position) throws ParseException { + /* public static int getPostfixFunctionStart(@Nonnull CharSequence s, int position) throws ParseException { assert s.length() > position; int numberOfOpenGroups = 0; @@ -264,7 +264,7 @@ public enum MathType { return false; }*/ - @NotNull + @Nonnull public List getTokens() { return tokens; } @@ -277,17 +277,17 @@ public enum MathType { return needMultiplicationSignAfter; } - public boolean isNeedMultiplicationSignBefore(@NotNull MathType mathTypeBefore) { + public boolean isNeedMultiplicationSignBefore(@Nonnull MathType mathTypeBefore) { return needMultiplicationSignBefore && mathTypeBefore.isNeedMultiplicationSignAfter(); } - public int processToJscl(@NotNull StringBuilder result, int i, @NotNull String match) throws CalculatorParseException { + public int processToJscl(@Nonnull StringBuilder result, int i, @Nonnull String match) throws CalculatorParseException { final String substitute = getSubstituteToJscl(match); result.append(substitute == null ? match : substitute); return returnI(i, match); } - protected int returnI(int i, @NotNull String match) { + protected int returnI(int i, @Nonnull String match) { if (match.length() > 1) { return i + match.length() - 1; } else { @@ -295,19 +295,19 @@ public enum MathType { } } - public int processFromJscl(@NotNull StringBuilder result, int i, @NotNull String match) { + public int processFromJscl(@Nonnull StringBuilder result, int i, @Nonnull String match) { final String substitute = getSubstituteFromJscl(match); result.append(substitute == null ? match : substitute); return returnI(i, match); } @Nullable - protected String getSubstituteFromJscl(@NotNull String match) { + protected String getSubstituteFromJscl(@Nonnull String match) { return null; } @Nullable - protected String getSubstituteToJscl(@NotNull String match) { + protected String getSubstituteToJscl(@Nonnull String match) { return null; } @@ -340,8 +340,8 @@ public enum MathType { * @param hexMode * @return math entity type of substring starting from ith index of specified text */ - @NotNull - public static Result getType(@NotNull String text, int i, boolean hexMode) { + @Nonnull + public static Result getType(@Nonnull String text, int i, boolean hexMode) { if (i < 0) { throw new IllegalArgumentException("I must be more or equals to 0."); } else if (i >= text.length() && i != 0) { @@ -373,7 +373,7 @@ public enum MathType { private static List mathTypesByPriority; - @NotNull + @Nonnull private static List getMathTypesByPriority() { if (mathTypesByPriority == null) { final List result = Collections.asList(MathType.values()); @@ -393,32 +393,32 @@ public enum MathType { public static class Result { - @NotNull + @Nonnull private final MathType mathType; - @NotNull + @Nonnull private final String match; - public Result(@NotNull MathType mathType, @NotNull String match) { + public Result(@Nonnull MathType mathType, @Nonnull String match) { this.mathType = mathType; this.match = match; } - public int processToJscl(@NotNull StringBuilder result, int i) throws CalculatorParseException { + public int processToJscl(@Nonnull StringBuilder result, int i) throws CalculatorParseException { return mathType.processToJscl(result, i, match); } - public int processFromJscl(@NotNull StringBuilder result, int i) { + public int processFromJscl(@Nonnull StringBuilder result, int i) { return mathType.processFromJscl(result, i, match); } - @NotNull + @Nonnull public String getMatch() { return match; } - @NotNull + @Nonnull public MathType getMathType() { return mathType; } @@ -428,10 +428,10 @@ public enum MathType { private int i; - @NotNull + @Nonnull private final CharSequence targetString; - private EndsWithFinder(@NotNull CharSequence targetString) { + private EndsWithFinder(@Nonnull CharSequence targetString) { this.targetString = targetString; } @@ -449,10 +449,10 @@ public enum MathType { private int i; - @NotNull + @Nonnull private final String targetString; - public StartsWithFinder(@NotNull String targetString, int i) { + public StartsWithFinder(@Nonnull String targetString, int i) { this.targetString = targetString; this.i = i; } diff --git a/core/src/main/java/org/solovyev/android/calculator/model/AFunction.java b/core/src/main/java/org/solovyev/android/calculator/model/AFunction.java index e8c1e759..688238a0 100644 --- a/core/src/main/java/org/solovyev/android/calculator/model/AFunction.java +++ b/core/src/main/java/org/solovyev/android/calculator/model/AFunction.java @@ -7,8 +7,8 @@ package org.solovyev.android.calculator.model; import jscl.math.function.IFunction; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.simpleframework.xml.Element; import org.simpleframework.xml.ElementList; import org.simpleframework.xml.Root; @@ -47,22 +47,22 @@ public class AFunction implements IFunction, MathPersistenceEntity, Serializable private Integer id; @Element - @NotNull + @Nonnull private String name; @Element(name = "body") - @NotNull + @Nonnull private String content; @ElementList(type = String.class) - @NotNull + @Nonnull private List parameterNames = new ArrayList(); @Element private boolean system; @Element(required = false) - @NotNull + @Nonnull private String description = ""; /* @@ -80,7 +80,7 @@ public class AFunction implements IFunction, MathPersistenceEntity, Serializable this.id = id; } - public static AFunction fromIFunction(@NotNull IFunction function) { + public static AFunction fromIFunction(@Nonnull IFunction function) { final AFunction result = new AFunction(); copy(result, function); @@ -97,7 +97,7 @@ public class AFunction implements IFunction, MathPersistenceEntity, Serializable */ @Override - public void copy(@NotNull MathEntity mathEntity) { + public void copy(@Nonnull MathEntity mathEntity) { if (mathEntity instanceof IFunction) { copy(this, (IFunction) mathEntity); } else { @@ -105,8 +105,8 @@ public class AFunction implements IFunction, MathPersistenceEntity, Serializable } } - private static void copy(@NotNull AFunction target, - @NotNull IFunction source) { + private static void copy(@Nonnull AFunction target, + @Nonnull IFunction source) { target.name = source.getName(); target.content = source.getContent(); target.description = Strings.getNotEmpty(source.getDescription(), ""); @@ -139,7 +139,7 @@ public class AFunction implements IFunction, MathPersistenceEntity, Serializable ********************************************************************** */ - @NotNull + @Nonnull public String getName() { return name; } @@ -149,7 +149,7 @@ public class AFunction implements IFunction, MathPersistenceEntity, Serializable return system; } - @NotNull + @Nonnull @Override public Integer getId() { return this.id; @@ -161,35 +161,35 @@ public class AFunction implements IFunction, MathPersistenceEntity, Serializable } @Override - public void setId(@NotNull Integer id) { + public void setId(@Nonnull Integer id) { this.id = id; } - public void setName(@NotNull String name) { + public void setName(@Nonnull String name) { this.name = name; } - @NotNull + @Nonnull public String getContent() { return content; } - @NotNull + @Nonnull @Override public String getDescription() { return this.description; } - public void setContent(@NotNull String content) { + public void setContent(@Nonnull String content) { this.content = content; } - @NotNull + @Nonnull public List getParameterNames() { return parameterNames; } - public void setParameterNames(@NotNull List parameterNames) { + public void setParameterNames(@Nonnull List parameterNames) { this.parameterNames = parameterNames; } @@ -203,7 +203,7 @@ public class AFunction implements IFunction, MathPersistenceEntity, Serializable public static class Builder implements MathEntityBuilder { - @NotNull + @Nonnull private String name; @Nullable @@ -217,13 +217,13 @@ public class AFunction implements IFunction, MathPersistenceEntity, Serializable @Nullable private Integer id; - @NotNull + @Nonnull private List parameterNames = Collections.emptyList(); public Builder() { } - public Builder(@NotNull IFunction function) { + public Builder(@Nonnull IFunction function) { this.name = function.getName(); this.value = function.getContent(); this.system = function.isSystem(); @@ -234,21 +234,21 @@ public class AFunction implements IFunction, MathPersistenceEntity, Serializable this.parameterNames = new ArrayList(function.getParameterNames()); } - public Builder(@NotNull String name, - @NotNull String value, - @NotNull List parameterNames) { + public Builder(@Nonnull String name, + @Nonnull String value, + @Nonnull List parameterNames) { this.name = name; this.value = value; this.parameterNames = parameterNames; } - @NotNull - public Builder setName(@NotNull String name) { + @Nonnull + public Builder setName(@Nonnull String name) { this.name = name; return this; } - @NotNull + @Nonnull public Builder setValue(@Nullable String value) { this.value = value; return this; @@ -259,17 +259,17 @@ public class AFunction implements IFunction, MathPersistenceEntity, Serializable return this; } - public void setParameterNames(@NotNull List parameterNames) { + public void setParameterNames(@Nonnull List parameterNames) { this.parameterNames = parameterNames; } - @NotNull + @Nonnull public Builder setDescription(@Nullable String description) { this.description = description; return this; } - @NotNull + @Nonnull public AFunction create() throws AFunction.Builder.CreationException { final AFunction result; if (id != null) { @@ -293,41 +293,41 @@ public class AFunction implements IFunction, MathPersistenceEntity, Serializable public static class CreationException extends RuntimeException implements Message { - @NotNull + @Nonnull private final CalculatorParseException message; - public CreationException(@NotNull CalculatorParseException cause) { + public CreationException(@Nonnull CalculatorParseException cause) { super(cause); message = cause; } - @NotNull + @Nonnull @Override public String getMessageCode() { return message.getMessageCode(); } - @NotNull + @Nonnull @Override public List getParameters() { return message.getParameters(); } - @NotNull + @Nonnull @Override public MessageLevel getMessageLevel() { return message.getMessageLevel(); } @Override - @NotNull + @Nonnull public String getLocalizedMessage() { return message.getLocalizedMessage(); } - @NotNull + @Nonnull @Override - public String getLocalizedMessage(@NotNull Locale locale) { + public String getLocalizedMessage(@Nonnull Locale locale) { return message.getLocalizedMessage(locale); } } diff --git a/core/src/main/java/org/solovyev/android/calculator/model/MathEntityBuilder.java b/core/src/main/java/org/solovyev/android/calculator/model/MathEntityBuilder.java index 9fa69e1f..91d37df7 100644 --- a/core/src/main/java/org/solovyev/android/calculator/model/MathEntityBuilder.java +++ b/core/src/main/java/org/solovyev/android/calculator/model/MathEntityBuilder.java @@ -6,8 +6,8 @@ package org.solovyev.android.calculator.model; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.common.JBuilder; import org.solovyev.common.math.MathEntity; @@ -18,12 +18,12 @@ import org.solovyev.common.math.MathEntity; */ public interface MathEntityBuilder extends JBuilder { - @NotNull - public MathEntityBuilder setName(@NotNull String name); + @Nonnull + public MathEntityBuilder setName(@Nonnull String name); - @NotNull + @Nonnull public MathEntityBuilder setDescription(@Nullable String description); - @NotNull + @Nonnull public MathEntityBuilder setValue(@Nullable String value); } diff --git a/core/src/main/java/org/solovyev/android/calculator/model/Var.java b/core/src/main/java/org/solovyev/android/calculator/model/Var.java index e081364f..3003b852 100644 --- a/core/src/main/java/org/solovyev/android/calculator/model/Var.java +++ b/core/src/main/java/org/solovyev/android/calculator/model/Var.java @@ -9,8 +9,8 @@ package org.solovyev.android.calculator.model; import jscl.math.function.Constant; import jscl.math.function.ExtendedConstant; import jscl.math.function.IConstant; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.simpleframework.xml.Element; import org.simpleframework.xml.Root; import org.simpleframework.xml.Transient; @@ -32,7 +32,7 @@ public class Var implements IConstant, MathPersistenceEntity { private Integer id; @Element - @NotNull + @Nonnull private String name; @Element(required = false) @@ -51,7 +51,7 @@ public class Var implements IConstant, MathPersistenceEntity { public static class Builder implements JBuilder, MathEntityBuilder { - @NotNull + @Nonnull private String name; @Nullable @@ -68,7 +68,7 @@ public class Var implements IConstant, MathPersistenceEntity { public Builder() { } - public Builder(@NotNull Var var) { + public Builder(@Nonnull Var var) { this.name = var.name; this.value = var.value; this.system = var.system; @@ -76,7 +76,7 @@ public class Var implements IConstant, MathPersistenceEntity { this.id = var.id; } - public Builder(@NotNull IConstant iConstant) { + public Builder(@Nonnull IConstant iConstant) { this.name = iConstant.getName(); this.value = iConstant.getValue(); @@ -88,23 +88,23 @@ public class Var implements IConstant, MathPersistenceEntity { } } - public Builder(@NotNull String name, @NotNull Double value) { + public Builder(@Nonnull String name, @Nonnull Double value) { this(name, String.valueOf(value)); } - public Builder(@NotNull String name, @Nullable String value) { + public Builder(@Nonnull String name, @Nullable String value) { this.name = name; this.value = value; } - @NotNull - public Builder setName(@NotNull String name) { + @Nonnull + public Builder setName(@Nonnull String name) { this.name = name; return this; } - @NotNull + @Nonnull public Builder setValue(@Nullable String value) { this.value = value; return this; @@ -115,13 +115,13 @@ public class Var implements IConstant, MathPersistenceEntity { return this; } - @NotNull + @Nonnull public Builder setDescription(@Nullable String description) { this.description = description; return this; } - @NotNull + @Nonnull public Var create() { final Var result; if (id != null) { @@ -142,11 +142,11 @@ public class Var implements IConstant, MathPersistenceEntity { private Var() { } - private Var(@NotNull Integer id) { + private Var(@Nonnull Integer id) { this.id = id; } - public void copy(@NotNull MathEntity o) { + public void copy(@Nonnull MathEntity o) { if (o instanceof IConstant) { final IConstant that = ((IConstant) o); this.name = that.getName(); @@ -179,7 +179,7 @@ public class Var implements IConstant, MathPersistenceEntity { return value; } - @NotNull + @Nonnull @Override public String toJava() { return String.valueOf(value); @@ -189,7 +189,7 @@ public class Var implements IConstant, MathPersistenceEntity { return system; } - @NotNull + @Nonnull @Override public Integer getId() { return this.id; @@ -201,16 +201,16 @@ public class Var implements IConstant, MathPersistenceEntity { } @Override - public void setId(@NotNull Integer id) { + public void setId(@Nonnull Integer id) { this.id = id; } - @NotNull + @Nonnull public String getName() { return name; } - @NotNull + @Nonnull @Override public Constant getConstant() { if (constant == null) { diff --git a/core/src/main/java/org/solovyev/android/calculator/plot/CalculatorPlotter.java b/core/src/main/java/org/solovyev/android/calculator/plot/CalculatorPlotter.java index 0ea5383f..3fce1b15 100644 --- a/core/src/main/java/org/solovyev/android/calculator/plot/CalculatorPlotter.java +++ b/core/src/main/java/org/solovyev/android/calculator/plot/CalculatorPlotter.java @@ -1,8 +1,8 @@ package org.solovyev.android.calculator.plot; import jscl.math.Generic; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.List; @@ -13,55 +13,55 @@ import java.util.List; */ public interface CalculatorPlotter { - @NotNull + @Nonnull PlotData getPlotData(); - boolean addFunction(@NotNull Generic expression); + boolean addFunction(@Nonnull Generic expression); - boolean addFunction(@NotNull PlotFunction plotFunction); + boolean addFunction(@Nonnull PlotFunction plotFunction); - boolean addFunction(@NotNull XyFunction xyFunction); + boolean addFunction(@Nonnull XyFunction xyFunction); - boolean addFunction(@NotNull XyFunction xyFunction, @NotNull PlotLineDef functionLineDef); + boolean addFunction(@Nonnull XyFunction xyFunction, @Nonnull PlotLineDef functionLineDef); - boolean updateFunction(@NotNull PlotFunction newFunction); + boolean updateFunction(@Nonnull PlotFunction newFunction); - boolean updateFunction(@NotNull XyFunction xyFunction, @NotNull PlotLineDef functionLineDef); + boolean updateFunction(@Nonnull XyFunction xyFunction, @Nonnull PlotLineDef functionLineDef); - boolean removeFunction(@NotNull PlotFunction plotFunction); + boolean removeFunction(@Nonnull PlotFunction plotFunction); - boolean removeFunction(@NotNull XyFunction xyFunction); + boolean removeFunction(@Nonnull XyFunction xyFunction); - @NotNull - PlotFunction pin(@NotNull PlotFunction plotFunction); + @Nonnull + PlotFunction pin(@Nonnull PlotFunction plotFunction); - @NotNull - PlotFunction unpin(@NotNull PlotFunction plotFunction); + @Nonnull + PlotFunction unpin(@Nonnull PlotFunction plotFunction); - @NotNull - PlotFunction show(@NotNull PlotFunction plotFunction); + @Nonnull + PlotFunction show(@Nonnull PlotFunction plotFunction); - @NotNull - PlotFunction hide(@NotNull PlotFunction plotFunction); + @Nonnull + PlotFunction hide(@Nonnull PlotFunction plotFunction); void clearAllFunctions(); @Nullable - PlotFunction getFunctionById(@NotNull String functionId); + PlotFunction getFunctionById(@Nonnull String functionId); - @NotNull + @Nonnull List getFunctions(); - @NotNull + @Nonnull List getVisibleFunctions(); void plot(); - void plot(@NotNull Generic expression); + void plot(@Nonnull Generic expression); boolean is2dPlotPossible(); - boolean isPlotPossibleFor(@NotNull Generic expression); + boolean isPlotPossibleFor(@Nonnull Generic expression); void setPlot3d(boolean plot3d); @@ -69,7 +69,7 @@ public interface CalculatorPlotter { void setPlotImag(boolean plotImag); - void savePlotBoundaries(@NotNull PlotBoundaries plotBoundaries); + void savePlotBoundaries(@Nonnull PlotBoundaries plotBoundaries); - void setPlotBoundaries(@NotNull PlotBoundaries plotBoundaries); + void setPlotBoundaries(@Nonnull PlotBoundaries plotBoundaries); } diff --git a/core/src/main/java/org/solovyev/android/calculator/plot/CalculatorPlotterImpl.java b/core/src/main/java/org/solovyev/android/calculator/plot/CalculatorPlotterImpl.java index bd96cdc9..137f9f6a 100644 --- a/core/src/main/java/org/solovyev/android/calculator/plot/CalculatorPlotterImpl.java +++ b/core/src/main/java/org/solovyev/android/calculator/plot/CalculatorPlotterImpl.java @@ -5,11 +5,11 @@ import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import jscl.math.Generic; import jscl.math.function.Constant; -import org.jetbrains.annotations.NotNull; import org.solovyev.android.calculator.Calculator; import org.solovyev.android.calculator.CalculatorEventType; import org.solovyev.android.calculator.CalculatorUtils; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collections; @@ -22,10 +22,10 @@ import java.util.List; */ public class CalculatorPlotterImpl implements CalculatorPlotter { - @NotNull + @Nonnull private final List functions = new ArrayList(); - @NotNull + @Nonnull private final Calculator calculator; private final PlotResourceManager resourceManager = new MapPlotResourceManager(); @@ -36,24 +36,24 @@ public class CalculatorPlotterImpl implements CalculatorPlotter { private int arity = 0; - @NotNull + @Nonnull private PlotBoundaries plotBoundaries = PlotBoundaries.newDefaultInstance(); - @NotNull + @Nonnull private PlotData plotData = new PlotData(Collections.emptyList(), plot3d, plotBoundaries); - public CalculatorPlotterImpl(@NotNull Calculator calculator) { + public CalculatorPlotterImpl(@Nonnull Calculator calculator) { this.calculator = calculator; } - @NotNull + @Nonnull @Override public PlotData getPlotData() { return plotData; } @Override - public boolean addFunction(@NotNull Generic expression) { + public boolean addFunction(@Nonnull Generic expression) { final List variables = new ArrayList(CalculatorUtils.getNotSystemConstants(expression)); assert variables.size() <= 2; @@ -92,13 +92,13 @@ public class CalculatorPlotterImpl implements CalculatorPlotter { return imagAdded || realAdded; } - @NotNull - private PlotFunction newPlotFunction(@NotNull XyFunction xyFunction) { + @Nonnull + private PlotFunction newPlotFunction(@Nonnull XyFunction xyFunction) { return new PlotFunction(xyFunction, resourceManager.generateAndRegister()); } @Override - public boolean addFunction(@NotNull PlotFunction plotFunction) { + public boolean addFunction(@Nonnull PlotFunction plotFunction) { synchronized (functions) { if (!functions.contains(plotFunction)) { resourceManager.register(plotFunction.getPlotLineDef()); @@ -111,7 +111,7 @@ public class CalculatorPlotterImpl implements CalculatorPlotter { } } - private boolean removeAllUnpinnedExcept(@NotNull final PlotFunction... exceptFunctions) { + private boolean removeAllUnpinnedExcept(@Nonnull final PlotFunction... exceptFunctions) { synchronized (functions) { boolean changed = Iterables.removeIf(functions, new Predicate() { @@ -166,7 +166,7 @@ public class CalculatorPlotterImpl implements CalculatorPlotter { } @Override - public boolean removeFunction(@NotNull PlotFunction plotFunction) { + public boolean removeFunction(@Nonnull PlotFunction plotFunction) { synchronized (functions) { boolean changed = functions.remove(plotFunction); if (changed) { @@ -178,24 +178,24 @@ public class CalculatorPlotterImpl implements CalculatorPlotter { } @Override - public boolean addFunction(@NotNull XyFunction xyFunction) { + public boolean addFunction(@Nonnull XyFunction xyFunction) { return addFunction(newPlotFunction(xyFunction)); } @Override - public boolean addFunction(@NotNull XyFunction xyFunction, @NotNull PlotLineDef functionLineDef) { + public boolean addFunction(@Nonnull XyFunction xyFunction, @Nonnull PlotLineDef functionLineDef) { return addFunction(new PlotFunction(xyFunction, functionLineDef)); } @Override - public boolean updateFunction(@NotNull XyFunction xyFunction, @NotNull PlotLineDef functionLineDef) { + public boolean updateFunction(@Nonnull XyFunction xyFunction, @Nonnull PlotLineDef functionLineDef) { final PlotFunction newFunction = new PlotFunction(xyFunction, functionLineDef); return updateFunction(newFunction); } @Override - public boolean updateFunction(@NotNull PlotFunction newFunction) { + public boolean updateFunction(@Nonnull PlotFunction newFunction) { boolean changed = updateFunction0(newFunction); if (changed) { firePlotDataChangedEvent(); @@ -203,7 +203,7 @@ public class CalculatorPlotterImpl implements CalculatorPlotter { return changed; } - public boolean updateFunction0(@NotNull PlotFunction newFunction) { + public boolean updateFunction0(@Nonnull PlotFunction newFunction) { boolean changed = false; synchronized (functions) { @@ -226,29 +226,29 @@ public class CalculatorPlotterImpl implements CalculatorPlotter { } @Override - public boolean removeFunction(@NotNull XyFunction xyFunction) { + public boolean removeFunction(@Nonnull XyFunction xyFunction) { return removeFunction(new PlotFunction(xyFunction)); } - @NotNull + @Nonnull @Override - public PlotFunction pin(@NotNull PlotFunction plotFunction) { + public PlotFunction pin(@Nonnull PlotFunction plotFunction) { final PlotFunction newFunction = PlotFunction.pin(plotFunction); updateFunction0(newFunction); return newFunction; } - @NotNull + @Nonnull @Override - public PlotFunction unpin(@NotNull PlotFunction plotFunction) { + public PlotFunction unpin(@Nonnull PlotFunction plotFunction) { final PlotFunction newFunction = PlotFunction.unpin(plotFunction); updateFunction0(newFunction); return newFunction; } - @NotNull + @Nonnull @Override - public PlotFunction show(@NotNull PlotFunction plotFunction) { + public PlotFunction show(@Nonnull PlotFunction plotFunction) { final PlotFunction newFunction = PlotFunction.visible(plotFunction); updateFunction(newFunction); @@ -256,9 +256,9 @@ public class CalculatorPlotterImpl implements CalculatorPlotter { return newFunction; } - @NotNull + @Nonnull @Override - public PlotFunction hide(@NotNull PlotFunction plotFunction) { + public PlotFunction hide(@Nonnull PlotFunction plotFunction) { final PlotFunction newFunction = PlotFunction.invisible(plotFunction); updateFunction(newFunction); @@ -275,9 +275,9 @@ public class CalculatorPlotterImpl implements CalculatorPlotter { } } - @org.jetbrains.annotations.Nullable + @Nullable @Override - public PlotFunction getFunctionById(@NotNull final String functionId) { + public PlotFunction getFunctionById(@Nonnull final String functionId) { synchronized (functions) { return Iterables.find(functions, new Predicate() { @Override @@ -315,7 +315,7 @@ public class CalculatorPlotterImpl implements CalculatorPlotter { firePlotDataChangedEvent(); } - @NotNull + @Nonnull @Override public List getFunctions() { synchronized (functions) { @@ -323,7 +323,7 @@ public class CalculatorPlotterImpl implements CalculatorPlotter { } } - @NotNull + @Nonnull @Override public List getVisibleFunctions() { synchronized (functions) { @@ -342,7 +342,7 @@ public class CalculatorPlotterImpl implements CalculatorPlotter { } @Override - public void plot(@NotNull Generic expression) { + public void plot(@Nonnull Generic expression) { addFunction(expression); plot(); } @@ -353,7 +353,7 @@ public class CalculatorPlotterImpl implements CalculatorPlotter { } @Override - public boolean isPlotPossibleFor(@NotNull Generic expression) { + public boolean isPlotPossibleFor(@Nonnull Generic expression) { boolean result = false; int size = CalculatorUtils.getNotSystemConstants(expression).size(); @@ -392,7 +392,7 @@ public class CalculatorPlotterImpl implements CalculatorPlotter { } @Override - public void savePlotBoundaries(@NotNull PlotBoundaries plotBoundaries) { + public void savePlotBoundaries(@Nonnull PlotBoundaries plotBoundaries) { if (!this.plotBoundaries.equals(plotBoundaries)) { this.plotBoundaries = plotBoundaries; updatePlotData(); @@ -400,7 +400,7 @@ public class CalculatorPlotterImpl implements CalculatorPlotter { } @Override - public void setPlotBoundaries(@NotNull PlotBoundaries plotBoundaries) { + public void setPlotBoundaries(@Nonnull PlotBoundaries plotBoundaries) { if (!this.plotBoundaries.equals(plotBoundaries)) { this.plotBoundaries = plotBoundaries; firePlotDataChangedEvent(); diff --git a/core/src/main/java/org/solovyev/android/calculator/plot/MapPlotResourceManager.java b/core/src/main/java/org/solovyev/android/calculator/plot/MapPlotResourceManager.java index 0d8be2c4..42a92fe9 100644 --- a/core/src/main/java/org/solovyev/android/calculator/plot/MapPlotResourceManager.java +++ b/core/src/main/java/org/solovyev/android/calculator/plot/MapPlotResourceManager.java @@ -2,7 +2,7 @@ package org.solovyev.android.calculator.plot; import com.google.common.base.Predicate; import com.google.common.collect.Iterables; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.*; @@ -14,10 +14,10 @@ import java.util.*; */ public class MapPlotResourceManager implements PlotResourceManager { - @NotNull + @Nonnull private Map> registeredLineDefsMap = new HashMap>(); - @NotNull + @Nonnull private final List preparedLineDefs = new ArrayList(PlotLineStyle.values().length * PlotLineColor.values().length); public MapPlotResourceManager() { @@ -28,7 +28,7 @@ public class MapPlotResourceManager implements PlotResourceManager { } } - @NotNull + @Nonnull @Override public PlotLineDef generateAndRegister() { synchronized (this) { @@ -44,7 +44,7 @@ public class MapPlotResourceManager implements PlotResourceManager { } } - private void addLineDef(@NotNull final PlotLineDef toBeAdded) { + private void addLineDef(@Nonnull final PlotLineDef toBeAdded) { assert Thread.holdsLock(this); List registeredLineDefs = registeredLineDefsMap.get(toBeAdded); @@ -69,7 +69,7 @@ public class MapPlotResourceManager implements PlotResourceManager { } - private void removeLineDef(@NotNull final PlotLineDef toBeRemoved) { + private void removeLineDef(@Nonnull final PlotLineDef toBeRemoved) { assert Thread.holdsLock(this); List registeredLineDefs = registeredLineDefsMap.get(toBeRemoved); @@ -92,14 +92,14 @@ public class MapPlotResourceManager implements PlotResourceManager { } @Override - public void register(@NotNull PlotLineDef lineDef) { + public void register(@Nonnull PlotLineDef lineDef) { synchronized (this) { addLineDef(lineDef); } } @Override - public void unregister(@NotNull PlotLineDef lineDef) { + public void unregister(@Nonnull PlotLineDef lineDef) { synchronized (this) { removeLineDef(lineDef); } diff --git a/core/src/main/java/org/solovyev/android/calculator/plot/PlotBoundaries.java b/core/src/main/java/org/solovyev/android/calculator/plot/PlotBoundaries.java index c6759f77..c0315167 100644 --- a/core/src/main/java/org/solovyev/android/calculator/plot/PlotBoundaries.java +++ b/core/src/main/java/org/solovyev/android/calculator/plot/PlotBoundaries.java @@ -1,6 +1,6 @@ package org.solovyev.android.calculator.plot; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.io.Serializable; @@ -31,12 +31,12 @@ public final class PlotBoundaries implements Serializable { this.yMax = Math.max(yMin, yMax); } - @NotNull + @Nonnull public static PlotBoundaries newInstance(float xMin, float xMax, float yMin, float yMax) { return new PlotBoundaries(xMin, xMax, yMin, yMax); } - @NotNull + @Nonnull public static PlotBoundaries newInstance(float xMin, float xMax) { return newInstance(xMin, xMax, DEFAULT_MIN_NUMBER, DEFAULT_MAX_NUMBER); } @@ -67,7 +67,7 @@ public final class PlotBoundaries implements Serializable { '}'; } - @NotNull + @Nonnull public static PlotBoundaries newDefaultInstance() { PlotBoundaries plotBoundaries = new PlotBoundaries(); plotBoundaries.xMin = DEFAULT_MIN_NUMBER; diff --git a/core/src/main/java/org/solovyev/android/calculator/plot/PlotData.java b/core/src/main/java/org/solovyev/android/calculator/plot/PlotData.java index 3b6dc664..1ca69dde 100644 --- a/core/src/main/java/org/solovyev/android/calculator/plot/PlotData.java +++ b/core/src/main/java/org/solovyev/android/calculator/plot/PlotData.java @@ -1,6 +1,6 @@ package org.solovyev.android.calculator.plot; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import java.util.List; @@ -11,23 +11,23 @@ import java.util.List; */ public class PlotData { - @NotNull + @Nonnull private List functions; private boolean plot3d; - @NotNull + @Nonnull private PlotBoundaries boundaries; - public PlotData(@NotNull List functions, + public PlotData(@Nonnull List functions, boolean plot3d, - @NotNull PlotBoundaries boundaries) { + @Nonnull PlotBoundaries boundaries) { this.functions = functions; this.plot3d = plot3d; this.boundaries = boundaries; } - @NotNull + @Nonnull public List getFunctions() { return functions; } @@ -36,7 +36,7 @@ public class PlotData { return plot3d; } - @NotNull + @Nonnull public PlotBoundaries getBoundaries() { return boundaries; } diff --git a/core/src/main/java/org/solovyev/android/calculator/plot/PlotFunction.java b/core/src/main/java/org/solovyev/android/calculator/plot/PlotFunction.java index 33d017b0..50f1b78d 100644 --- a/core/src/main/java/org/solovyev/android/calculator/plot/PlotFunction.java +++ b/core/src/main/java/org/solovyev/android/calculator/plot/PlotFunction.java @@ -1,6 +1,6 @@ package org.solovyev.android.calculator.plot; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; /** * User: serso @@ -9,28 +9,28 @@ import org.jetbrains.annotations.NotNull; */ public class PlotFunction { - @NotNull + @Nonnull private XyFunction xyFunction; - @NotNull + @Nonnull private PlotLineDef plotLineDef; private boolean pinned = false; private boolean visible = true; - public PlotFunction(@NotNull XyFunction xyFunction) { + public PlotFunction(@Nonnull XyFunction xyFunction) { this.xyFunction = xyFunction; this.plotLineDef = PlotLineDef.newDefaultInstance(); } - public PlotFunction(@NotNull XyFunction xyFunction, - @NotNull PlotLineDef plotLineDef) { + public PlotFunction(@Nonnull XyFunction xyFunction, + @Nonnull PlotLineDef plotLineDef) { this.xyFunction = xyFunction; this.plotLineDef = plotLineDef; } - @NotNull + @Nonnull private PlotFunction copy() { final PlotFunction copy = new PlotFunction(this.xyFunction, this.plotLineDef); @@ -40,53 +40,53 @@ public class PlotFunction { return copy; } - @NotNull - public static PlotFunction changePlotLineDef(@NotNull PlotFunction that, @NotNull PlotLineDef newPlotLineDef) { + @Nonnull + public static PlotFunction changePlotLineDef(@Nonnull PlotFunction that, @Nonnull PlotLineDef newPlotLineDef) { final PlotFunction copy = that.copy(); copy.plotLineDef = newPlotLineDef; return copy; } - @NotNull - public static PlotFunction pin(@NotNull PlotFunction that) { + @Nonnull + public static PlotFunction pin(@Nonnull PlotFunction that) { return togglePinned(that, true); } - @NotNull - public static PlotFunction togglePinned(@NotNull PlotFunction that, boolean pinned) { + @Nonnull + public static PlotFunction togglePinned(@Nonnull PlotFunction that, boolean pinned) { final PlotFunction copy = that.copy(); copy.pinned = pinned; return copy; } - @NotNull - public static PlotFunction unpin(@NotNull PlotFunction that) { + @Nonnull + public static PlotFunction unpin(@Nonnull PlotFunction that) { return togglePinned(that, false); } - @NotNull - public static PlotFunction visible(@NotNull PlotFunction that) { + @Nonnull + public static PlotFunction visible(@Nonnull PlotFunction that) { return toggleVisible(that, true); } - @NotNull - public static PlotFunction toggleVisible(@NotNull PlotFunction that, boolean visible) { + @Nonnull + public static PlotFunction toggleVisible(@Nonnull PlotFunction that, boolean visible) { final PlotFunction copy = that.copy(); copy.visible = visible; return copy; } - @NotNull - public static PlotFunction invisible(@NotNull PlotFunction that) { + @Nonnull + public static PlotFunction invisible(@Nonnull PlotFunction that) { return toggleVisible(that, false); } - @NotNull + @Nonnull public XyFunction getXyFunction() { return xyFunction; } - @NotNull + @Nonnull public PlotLineDef getPlotLineDef() { return plotLineDef; } diff --git a/core/src/main/java/org/solovyev/android/calculator/plot/PlotLineColor.java b/core/src/main/java/org/solovyev/android/calculator/plot/PlotLineColor.java index c64c8d1a..77a92783 100644 --- a/core/src/main/java/org/solovyev/android/calculator/plot/PlotLineColor.java +++ b/core/src/main/java/org/solovyev/android/calculator/plot/PlotLineColor.java @@ -1,6 +1,6 @@ package org.solovyev.android.calculator.plot; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; /** * User: serso @@ -34,7 +34,7 @@ public enum PlotLineColor { return this.color; } - @NotNull + @Nonnull public static PlotLineColor valueOf(int color) { for (PlotLineColor plotLineColor : PlotLineColor.values()) { if (plotLineColor.color == color) { diff --git a/core/src/main/java/org/solovyev/android/calculator/plot/PlotLineDef.java b/core/src/main/java/org/solovyev/android/calculator/plot/PlotLineDef.java index e2c90fca..4104965d 100644 --- a/core/src/main/java/org/solovyev/android/calculator/plot/PlotLineDef.java +++ b/core/src/main/java/org/solovyev/android/calculator/plot/PlotLineDef.java @@ -1,6 +1,6 @@ package org.solovyev.android.calculator.plot; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; /** * User: serso @@ -17,7 +17,7 @@ public class PlotLineDef { ********************************************************************** */ - @NotNull + @Nonnull private static final Float DEFAULT_LINE_WIDTH = 0f; private static final int WHITE = 0xFFFFFFFF; @@ -31,12 +31,12 @@ public class PlotLineDef { ********************************************************************** */ - @NotNull + @Nonnull private PlotLineColorType lineColorType = PlotLineColorType.monochrome; private int lineColor = WHITE; - @NotNull + @Nonnull private PlotLineStyle lineStyle = PlotLineStyle.solid; private float lineWidth = DEFAULT_LINE_WIDTH; @@ -44,16 +44,16 @@ public class PlotLineDef { private PlotLineDef() { } - @NotNull - public static PlotLineDef newInstance(int lineColor, @NotNull PlotLineStyle lineStyle) { + @Nonnull + public static PlotLineDef newInstance(int lineColor, @Nonnull PlotLineStyle lineStyle) { final PlotLineDef result = new PlotLineDef(); result.lineColor = lineColor; result.lineStyle = lineStyle; return result; } - @NotNull - public static PlotLineDef newInstance(int lineColor, @NotNull PlotLineStyle lineStyle, float lineWidth) { + @Nonnull + public static PlotLineDef newInstance(int lineColor, @Nonnull PlotLineStyle lineStyle, float lineWidth) { final PlotLineDef result = new PlotLineDef(); result.lineColor = lineColor; result.lineStyle = lineStyle; @@ -61,8 +61,8 @@ public class PlotLineDef { return result; } - @NotNull - public static PlotLineDef newInstance(int lineColor, @NotNull PlotLineStyle lineStyle, float lineWidth, @NotNull PlotLineColorType lineColorType) { + @Nonnull + public static PlotLineDef newInstance(int lineColor, @Nonnull PlotLineStyle lineStyle, float lineWidth, @Nonnull PlotLineColorType lineColorType) { final PlotLineDef result = new PlotLineDef(); result.lineColor = lineColor; result.lineColorType = lineColorType; @@ -71,7 +71,7 @@ public class PlotLineDef { return result; } - @NotNull + @Nonnull private PlotLineDef copy() { final PlotLineDef copy = new PlotLineDef(); copy.lineColor = lineColor; @@ -81,43 +81,43 @@ public class PlotLineDef { return copy; } - @NotNull - public static PlotLineDef changeLineColor(@NotNull PlotLineDef plotLineDef, int newLineColor) { + @Nonnull + public static PlotLineDef changeLineColor(@Nonnull PlotLineDef plotLineDef, int newLineColor) { final PlotLineDef result = plotLineDef.copy(); result.lineColor = newLineColor; return result; } - @NotNull - public static PlotLineDef changeLineWidth(@NotNull PlotLineDef plotLineDef, int newLineWidth) { + @Nonnull + public static PlotLineDef changeLineWidth(@Nonnull PlotLineDef plotLineDef, int newLineWidth) { final PlotLineDef result = plotLineDef.copy(); result.lineWidth = newLineWidth; return result; } - @NotNull - public static PlotLineDef changeLineColorType(@NotNull PlotLineDef plotLineDef, @NotNull PlotLineColorType newPlotLineColorType) { + @Nonnull + public static PlotLineDef changeLineColorType(@Nonnull PlotLineDef plotLineDef, @Nonnull PlotLineColorType newPlotLineColorType) { final PlotLineDef result = plotLineDef.copy(); result.lineColorType = newPlotLineColorType; return result; } - @NotNull - public static PlotLineDef changeLineStyle(@NotNull PlotLineDef plotLineDef, @NotNull PlotLineStyle newPlotLineStyle) { + @Nonnull + public static PlotLineDef changeLineStyle(@Nonnull PlotLineDef plotLineDef, @Nonnull PlotLineStyle newPlotLineStyle) { final PlotLineDef result = plotLineDef.copy(); result.lineStyle = newPlotLineStyle; return result; } - @NotNull - public static PlotLineDef changeColor(@NotNull PlotLineDef plotLineDef, int newLineColor) { + @Nonnull + public static PlotLineDef changeColor(@Nonnull PlotLineDef plotLineDef, int newLineColor) { final PlotLineDef result = plotLineDef.copy(); result.lineColor = newLineColor; return result; } - @NotNull + @Nonnull public static PlotLineDef newDefaultInstance() { return new PlotLineDef(); } @@ -126,7 +126,7 @@ public class PlotLineDef { return lineColor; } - @NotNull + @Nonnull public PlotLineStyle getLineStyle() { return lineStyle; } @@ -135,7 +135,7 @@ public class PlotLineDef { return lineWidth; } - @NotNull + @Nonnull public PlotLineColorType getLineColorType() { return lineColorType; } diff --git a/core/src/main/java/org/solovyev/android/calculator/plot/PlotResourceManager.java b/core/src/main/java/org/solovyev/android/calculator/plot/PlotResourceManager.java index 76dd2235..a738e889 100644 --- a/core/src/main/java/org/solovyev/android/calculator/plot/PlotResourceManager.java +++ b/core/src/main/java/org/solovyev/android/calculator/plot/PlotResourceManager.java @@ -1,6 +1,6 @@ package org.solovyev.android.calculator.plot; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; /** * User: serso @@ -9,12 +9,12 @@ import org.jetbrains.annotations.NotNull; */ interface PlotResourceManager { - @NotNull + @Nonnull PlotLineDef generateAndRegister(); - void register(@NotNull PlotLineDef lineDef); + void register(@Nonnull PlotLineDef lineDef); - void unregister(@NotNull PlotLineDef lineDef); + void unregister(@Nonnull PlotLineDef lineDef); void unregisterAll(); } diff --git a/core/src/main/java/org/solovyev/android/calculator/plot/PlotUtils.java b/core/src/main/java/org/solovyev/android/calculator/plot/PlotUtils.java index ab894bdf..c085fd95 100644 --- a/core/src/main/java/org/solovyev/android/calculator/plot/PlotUtils.java +++ b/core/src/main/java/org/solovyev/android/calculator/plot/PlotUtils.java @@ -14,8 +14,8 @@ import jscl.math.function.Constant; import jscl.math.numeric.Complex; import jscl.math.numeric.Numeric; import jscl.math.numeric.Real; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; /** * User: serso @@ -29,8 +29,8 @@ public final class PlotUtils { throw new AssertionError(); } - @NotNull - public static Complex calculatorExpression(@NotNull Generic expression) { + @Nonnull + public static Complex calculatorExpression(@Nonnull Generic expression) { try { return unwrap(expression.numeric()); } catch (RuntimeException e) { @@ -38,8 +38,8 @@ public final class PlotUtils { } } - @NotNull - public static Complex calculatorExpression(@NotNull Generic expression, @NotNull Constant xVar, double x) { + @Nonnull + public static Complex calculatorExpression(@Nonnull Generic expression, @Nonnull Constant xVar, double x) { try { return unwrap(expression.substitute(xVar, Expression.valueOf(x)).numeric()); } catch (RuntimeException e) { @@ -47,8 +47,8 @@ public final class PlotUtils { } } - @NotNull - public static Complex calculatorExpression(@NotNull Generic expression, @NotNull Constant xVar, double x, @NotNull Constant yVar, double y) { + @Nonnull + public static Complex calculatorExpression(@Nonnull Generic expression, @Nonnull Constant xVar, double x, @Nonnull Constant yVar, double y) { try { Generic tmp = expression.substitute(xVar, Expression.valueOf(x)); tmp = tmp.substitute(yVar, Expression.valueOf(y)); @@ -60,7 +60,7 @@ public final class PlotUtils { private static final Complex NaN = Complex.valueOf(Double.NaN, 0d); - @NotNull + @Nonnull public static Complex unwrap(@Nullable Generic numeric) { if (numeric instanceof JsclInteger) { return Complex.valueOf(((JsclInteger) numeric).intValue(), 0d); @@ -71,7 +71,7 @@ public final class PlotUtils { } } - @NotNull + @Nonnull public static Complex unwrap(@Nullable Numeric content) { if (content instanceof Real) { return Complex.valueOf(((Real) content).doubleValue(), 0d); diff --git a/core/src/main/java/org/solovyev/android/calculator/plot/XyFunction.java b/core/src/main/java/org/solovyev/android/calculator/plot/XyFunction.java index 07900a83..33cc80f6 100644 --- a/core/src/main/java/org/solovyev/android/calculator/plot/XyFunction.java +++ b/core/src/main/java/org/solovyev/android/calculator/plot/XyFunction.java @@ -2,8 +2,8 @@ package org.solovyev.android.calculator.plot; import jscl.math.Generic; import jscl.math.function.Constant; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.common.text.Strings; public class XyFunction implements FunctionEvaluator { @@ -16,13 +16,13 @@ public class XyFunction implements FunctionEvaluator { ********************************************************************** */ - @NotNull + @Nonnull private final String id; - @NotNull + @Nonnull private Generic expression; - @NotNull + @Nonnull private String expressionString; @Nullable @@ -41,10 +41,10 @@ public class XyFunction implements FunctionEvaluator { private int arity; - @NotNull + @Nonnull private final FunctionEvaluator evaluator; - public XyFunction(@NotNull Generic expression, + public XyFunction(@Nonnull Generic expression, @Nullable Constant xVariable, @Nullable Constant yVariable, boolean imag) { @@ -99,7 +99,7 @@ public class XyFunction implements FunctionEvaluator { return evaluator.eval(x, y); } - @NotNull + @Nonnull public Generic getExpression() { return expression; } @@ -114,12 +114,12 @@ public class XyFunction implements FunctionEvaluator { return yVariable; } - @NotNull + @Nonnull public String getExpressionString() { return expressionString; } - @NotNull + @Nonnull public String getId() { return id; } @@ -161,13 +161,13 @@ public class XyFunction implements FunctionEvaluator { private static abstract class AbstractEvaluator implements FunctionEvaluator { - @NotNull + @Nonnull protected final XyFunction xyFunction; @Nullable private Double constant = null; - public AbstractEvaluator(@NotNull XyFunction xyFunction) { + public AbstractEvaluator(@Nonnull XyFunction xyFunction) { this.xyFunction = xyFunction; } @@ -190,7 +190,7 @@ public class XyFunction implements FunctionEvaluator { private static class RealEvaluator extends AbstractEvaluator { - private RealEvaluator(@NotNull XyFunction xyFunction) { + private RealEvaluator(@Nonnull XyFunction xyFunction) { super(xyFunction); } @@ -212,7 +212,7 @@ public class XyFunction implements FunctionEvaluator { private static class ImaginaryEvaluator extends AbstractEvaluator { - private ImaginaryEvaluator(@NotNull XyFunction xyFunction) { + private ImaginaryEvaluator(@Nonnull XyFunction xyFunction) { super(xyFunction); } diff --git a/core/src/main/java/org/solovyev/android/calculator/text/DummyTextProcessor.java b/core/src/main/java/org/solovyev/android/calculator/text/DummyTextProcessor.java index 22a969c5..b10fd53d 100644 --- a/core/src/main/java/org/solovyev/android/calculator/text/DummyTextProcessor.java +++ b/core/src/main/java/org/solovyev/android/calculator/text/DummyTextProcessor.java @@ -7,7 +7,7 @@ package org.solovyev.android.calculator.text; import jscl.math.Generic; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.android.calculator.CalculatorParseException; /** @@ -19,9 +19,9 @@ public enum DummyTextProcessor implements TextProcessor { instance; - @NotNull + @Nonnull @Override - public String process(@NotNull Generic s) throws CalculatorParseException { + public String process(@Nonnull Generic s) throws CalculatorParseException { return s.toString(); } } diff --git a/core/src/main/java/org/solovyev/android/calculator/text/FromJsclSimplifyTextProcessor.java b/core/src/main/java/org/solovyev/android/calculator/text/FromJsclSimplifyTextProcessor.java index ba207f99..577a510a 100644 --- a/core/src/main/java/org/solovyev/android/calculator/text/FromJsclSimplifyTextProcessor.java +++ b/core/src/main/java/org/solovyev/android/calculator/text/FromJsclSimplifyTextProcessor.java @@ -1,8 +1,8 @@ package org.solovyev.android.calculator.text; import jscl.math.Generic; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.solovyev.android.calculator.CalculatorParseException; import org.solovyev.android.calculator.Locator; import org.solovyev.android.calculator.math.MathType; @@ -22,17 +22,17 @@ public class FromJsclSimplifyTextProcessor implements TextProcessor { - @NotNull - TO process(@NotNull FROM from) throws CalculatorParseException; + @Nonnull + TO process(@Nonnull FROM from) throws CalculatorParseException; } diff --git a/core/src/main/java/org/solovyev/android/calculator/units/CalculatorNumeralBase.java b/core/src/main/java/org/solovyev/android/calculator/units/CalculatorNumeralBase.java index c00f6213..7953cd28 100644 --- a/core/src/main/java/org/solovyev/android/calculator/units/CalculatorNumeralBase.java +++ b/core/src/main/java/org/solovyev/android/calculator/units/CalculatorNumeralBase.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator.units; import jscl.NumeralBase; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.solovyev.common.units.Unit; import org.solovyev.common.units.UnitConverter; import org.solovyev.common.units.UnitImpl; @@ -25,34 +25,34 @@ public enum CalculatorNumeralBase implements UnitType { hex(NumeralBase.hex); - @NotNull + @Nonnull private final NumeralBase numeralBase; - private CalculatorNumeralBase(@NotNull NumeralBase numeralBase) { + private CalculatorNumeralBase(@Nonnull NumeralBase numeralBase) { this.numeralBase = numeralBase; } - @NotNull + @Nonnull public NumeralBase getNumeralBase() { return numeralBase; } - @NotNull + @Nonnull private static final CalculatorNumeralBase.Converter converter = new CalculatorNumeralBase.Converter(); - @NotNull + @Nonnull public static CalculatorNumeralBase.Converter getConverter() { return converter; } - @NotNull + @Nonnull @Override public Class getUnitValueClass() { return String.class; } - @NotNull - public Unit createUnit(@NotNull String value) { + @Nonnull + public Unit createUnit(@Nonnull String value) { return UnitImpl.newInstance(value, this); } @@ -62,13 +62,13 @@ public enum CalculatorNumeralBase implements UnitType { } @Override - public boolean isSupported(@NotNull UnitType from, @NotNull UnitType to) { + public boolean isSupported(@Nonnull UnitType from, @Nonnull UnitType to) { return CalculatorNumeralBase.class.isAssignableFrom(from.getClass()) && CalculatorNumeralBase.class.isAssignableFrom(to.getClass()); } - @NotNull + @Nonnull @Override - public Unit convert(@NotNull Unit from, @NotNull UnitType toType) { + public Unit convert(@Nonnull Unit from, @Nonnull UnitType toType) { if (!isSupported(from.getUnitType(), toType)) { throw new IllegalArgumentException("Types are not supported!"); } @@ -83,8 +83,8 @@ public enum CalculatorNumeralBase implements UnitType { } } - @NotNull - public static CalculatorNumeralBase valueOf(@NotNull NumeralBase nb) { + @Nonnull + public static CalculatorNumeralBase valueOf(@Nonnull NumeralBase nb) { for (CalculatorNumeralBase calculatorNumeralBase : values()) { if (calculatorNumeralBase.numeralBase == nb) { return calculatorNumeralBase; diff --git a/core/src/test/java/org/solovyev/android/calculator/CalculatorEditorImplTest.java b/core/src/test/java/org/solovyev/android/calculator/CalculatorEditorImplTest.java index 250490de..8e5532aa 100644 --- a/core/src/test/java/org/solovyev/android/calculator/CalculatorEditorImplTest.java +++ b/core/src/test/java/org/solovyev/android/calculator/CalculatorEditorImplTest.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator; import junit.framework.Assert; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.junit.Before; import org.junit.Test; @@ -12,7 +12,7 @@ import org.junit.Test; */ public class CalculatorEditorImplTest extends AbstractCalculatorTest { - @NotNull + @Nonnull private CalculatorEditor calculatorEditor; @Before diff --git a/core/src/test/java/org/solovyev/android/calculator/CalculatorTestUtils.java b/core/src/test/java/org/solovyev/android/calculator/CalculatorTestUtils.java index 4bb75d82..11022a22 100644 --- a/core/src/test/java/org/solovyev/android/calculator/CalculatorTestUtils.java +++ b/core/src/test/java/org/solovyev/android/calculator/CalculatorTestUtils.java @@ -2,8 +2,8 @@ package org.solovyev.android.calculator; import jscl.JsclMathEngine; import junit.framework.Assert; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.mockito.Mockito; import org.solovyev.android.calculator.external.CalculatorExternalListenersContainer; import org.solovyev.android.calculator.history.CalculatorHistory; @@ -29,7 +29,7 @@ public class CalculatorTestUtils { Locator.getInstance().getEngine().init(); } - @NotNull + @Nonnull static CalculatorEngineImpl newCalculatorEngine() { final MathEntityDao mathEntityDao = Mockito.mock(MathEntityDao.class); @@ -43,11 +43,11 @@ public class CalculatorTestUtils { return new CalculatorEngineImpl(jsclEngine, varsRegistry, functionsRegistry, operatorsRegistry, postfixFunctionsRegistry, null); } - public static void assertEval(@NotNull String expected, @NotNull String expression) { + public static void assertEval(@Nonnull String expected, @Nonnull String expression) { assertEval(expected, expression, JsclOperation.numeric); } - public static void assertEval(@NotNull String expected, @NotNull String expression, @NotNull JsclOperation operation) { + public static void assertEval(@Nonnull String expected, @Nonnull String expression, @Nonnull JsclOperation operation) { final Calculator calculator = Locator.getInstance().getCalculator(); Locator.getInstance().getDisplay().setViewState(CalculatorDisplayViewStateImpl.newDefaultInstance()); @@ -73,11 +73,11 @@ public class CalculatorTestUtils { } } - public static void assertError(@NotNull String expression) { + public static void assertError(@Nonnull String expression) { assertError(expression, JsclOperation.numeric); } - public static S testSerialization(@NotNull S serializable) throws IOException, ClassNotFoundException { + public static S testSerialization(@Nonnull S serializable) throws IOException, ClassNotFoundException { final ByteArrayOutputStream out = new ByteArrayOutputStream(); ObjectOutputStream oos = null; @@ -108,13 +108,13 @@ public class CalculatorTestUtils { @Nullable private CalculatorEventData calculatorEventData; - @NotNull + @Nonnull private final CountDownLatch latch; @Nullable private volatile CalculatorDisplayViewState result = null; - public TestCalculatorEventListener(@NotNull CountDownLatch latch) { + public TestCalculatorEventListener(@Nonnull CountDownLatch latch) { this.latch = latch; } @@ -123,7 +123,7 @@ public class CalculatorTestUtils { } @Override - public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) { + public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) { if (this.calculatorEventData != null && calculatorEventData.isSameSequence(this.calculatorEventData)) { if (calculatorEventType == CalculatorEventType.display_state_changed) { final CalculatorDisplayChangeEventData displayChange = (CalculatorDisplayChangeEventData) data; @@ -146,7 +146,7 @@ public class CalculatorTestUtils { } } - public static void assertError(@NotNull String expression, @NotNull JsclOperation operation) { + public static void assertError(@Nonnull String expression, @Nonnull JsclOperation operation) { final Calculator calculator = Locator.getInstance().getCalculator(); Locator.getInstance().getDisplay().setViewState(CalculatorDisplayViewStateImpl.newDefaultInstance()); diff --git a/core/src/test/java/org/solovyev/android/calculator/history/CalculatorHistoryImplTest.java b/core/src/test/java/org/solovyev/android/calculator/history/CalculatorHistoryImplTest.java index b7b88278..da90a39d 100644 --- a/core/src/test/java/org/solovyev/android/calculator/history/CalculatorHistoryImplTest.java +++ b/core/src/test/java/org/solovyev/android/calculator/history/CalculatorHistoryImplTest.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator.history; import junit.framework.Assert; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.junit.BeforeClass; import org.junit.Test; import org.solovyev.android.calculator.CalculatorDisplayViewStateImpl; @@ -47,7 +47,7 @@ public class CalculatorHistoryImplTest { Assert.assertEquals("123+3", states.get(0).getEditorState().getText()); } - private void addState(@NotNull CalculatorHistory calculatorHistory, @NotNull String text) { + private void addState(@Nonnull CalculatorHistory calculatorHistory, @Nonnull String text) { calculatorHistory.addState(CalculatorHistoryState.newInstance(CalculatorEditorViewStateImpl.newInstance(text, 3), CalculatorDisplayViewStateImpl.newDefaultInstance())); } } diff --git a/core/src/test/java/org/solovyev/android/calculator/model/FunctionsTest.java b/core/src/test/java/org/solovyev/android/calculator/model/FunctionsTest.java index f263b474..6b4a9452 100644 --- a/core/src/test/java/org/solovyev/android/calculator/model/FunctionsTest.java +++ b/core/src/test/java/org/solovyev/android/calculator/model/FunctionsTest.java @@ -3,8 +3,8 @@ package org.solovyev.android.calculator.model; import jscl.util.ExpressionGenerator; import org.hamcrest.BaseMatcher; import org.hamcrest.Description; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -90,8 +90,8 @@ public class FunctionsTest { } - @NotNull - private Functions testXml(@NotNull Functions in, @Nullable String expectedXml) throws Exception { + @Nonnull + private Functions testXml(@Nonnull Functions in, @Nullable String expectedXml) throws Exception { final String actualXml = toXml(in); if (expectedXml != null) { @@ -142,8 +142,8 @@ public class FunctionsTest { testXml(in, null); } - private void assertEquals(@NotNull final AFunction expected, - @NotNull AFunction actual) { + private void assertEquals(@Nonnull final AFunction expected, + @Nonnull AFunction actual) { //Assert.assertEquals(expected.getId(), actual.getId()); Assert.assertEquals(expected.getContent(), actual.getContent()); Assert.assertEquals(expected.getDescription(), actual.getDescription()); diff --git a/core/src/test/java/org/solovyev/android/calculator/model/NumeralBaseTest.java b/core/src/test/java/org/solovyev/android/calculator/model/NumeralBaseTest.java index 7943c3fa..2ac9dee2 100644 --- a/core/src/test/java/org/solovyev/android/calculator/model/NumeralBaseTest.java +++ b/core/src/test/java/org/solovyev/android/calculator/model/NumeralBaseTest.java @@ -6,7 +6,7 @@ import jscl.MathEngine; import jscl.math.Expression; import jscl.text.ParseException; import jscl.util.ExpressionGeneratorWithInput; -import org.jetbrains.annotations.NotNull; +import javax.annotation.Nonnull; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; @@ -91,7 +91,7 @@ public class NumeralBaseTest extends AbstractCalculatorTest { } } - public static void testExpression(@NotNull String[] line, @NotNull Converter converter) throws ParseException, CalculatorEvalException, CalculatorParseException { + public static void testExpression(@Nonnull String[] line, @Nonnull Converter converter) throws ParseException, CalculatorEvalException, CalculatorParseException { final String dec = line[0].toUpperCase(); final String hex = "0x:" + line[1].toUpperCase(); final String bin = "0b:" + line[2].toUpperCase(); @@ -109,36 +109,36 @@ public class NumeralBaseTest extends AbstractCalculatorTest { private static class DummyExpression implements Converter { - @NotNull + @Nonnull @Override - public String convert(@NotNull String s) { + public String convert(@Nonnull String s) { return s; } } private static class Expression1 implements Converter { - @NotNull + @Nonnull @Override - public String convert(@NotNull String s) { + public String convert(@Nonnull String s) { return s + "*" + s; } } private static class Expression2 implements Converter { - @NotNull + @Nonnull @Override - public String convert(@NotNull String s) { + public String convert(@Nonnull String s) { return s + "*" + s + " * sin(" + s + ") - 0b:1101"; } } private static class Expression3 implements Converter { - @NotNull + @Nonnull @Override - public String convert(@NotNull String s) { + public String convert(@Nonnull String s) { return s + "*" + s + " * sin(" + s + ") - 0b:1101 + √(" + s + ") + exp ( " + s + ")"; } } diff --git a/pom.xml b/pom.xml index 690e863c..34fbaefe 100644 --- a/pom.xml +++ b/pom.xml @@ -34,7 +34,7 @@ UTF-8 1.1.1-SNAPSHOT - 1.0.4 + 1.0.5-SNAPSHOT @@ -181,12 +181,6 @@ 4.8.2 - - com.intellij - annotations - 7.0.3 - - com.google.android android @@ -247,12 +241,12 @@ 1.0.2 - @NotNull Instrumentation + @Nonnull Instrumentation instrument + @Nonnull instrumentation will be done now after compilation and before proguard--> compile