fixes + @NotNull -> @Nonnull
This commit is contained in:
@@ -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<String, List<AcraReport>> reports = new HashMap<String, List<AcraReport>>();
|
||||
|
||||
scanFiles(path, reports);
|
||||
scanFiles(path, reports, version);
|
||||
|
||||
final List<List<AcraReport>> sortedReports = new ArrayList<List<AcraReport>>(reports.size());
|
||||
for (Map.Entry<String, List<AcraReport>> entry : reports.entrySet()) {
|
||||
sortedReports.add(entry.getValue());
|
||||
@@ -58,29 +64,29 @@ public final class AcraAnalyzer {
|
||||
}
|
||||
}
|
||||
|
||||
private static void scanFiles(String path, Map<String, List<AcraReport>> reports) {
|
||||
private static void scanFiles(@Nonnull String path, @Nonnull Map<String, List<AcraReport>> 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<String, List<AcraReport>> reports) {
|
||||
private static void scanFiles(@Nonnull File directory, @Nonnull Map<String, List<AcraReport>> 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<String, List<AcraReport>> reports) {
|
||||
private static void analyzeFile(File file, Map<String, List<AcraReport>> 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<AcraReport> acraReports = reports.get(report.stackTrace);
|
||||
if (acraReports == null) {
|
||||
acraReports = new ArrayList<AcraReport>();
|
||||
|
@@ -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<T extends MathEntity, P extends MathPersistenceEntity> implements CalculatorMathRegistry<T> {
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private final MathRegistry<T> mathRegistry;
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private final String prefix;
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private final MathEntityDao<P> mathEntityDao;
|
||||
|
||||
protected AbstractCalculatorMathRegistry(@NotNull MathRegistry<T> mathRegistry,
|
||||
@NotNull String prefix,
|
||||
@NotNull MathEntityDao<P> mathEntityDao) {
|
||||
protected AbstractCalculatorMathRegistry(@Nonnull MathRegistry<T> mathRegistry,
|
||||
@Nonnull String prefix,
|
||||
@Nonnull MathEntityDao<P> mathEntityDao) {
|
||||
this.mathRegistry = mathRegistry;
|
||||
this.prefix = prefix;
|
||||
this.mathEntityDao = mathEntityDao;
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
protected abstract Map<String, String> getSubstitutes();
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getDescription(@NotNull String mathEntityName) {
|
||||
public String getDescription(@Nonnull String mathEntityName) {
|
||||
final String stringName;
|
||||
|
||||
final Map<String, String> substitutes = getSubstitutes();
|
||||
@@ -94,8 +94,8 @@ public abstract class AbstractCalculatorMathRegistry<T extends MathEntity, P ext
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected abstract JBuilder<? extends T> createBuilder(@NotNull P entity);
|
||||
@Nonnull
|
||||
protected abstract JBuilder<? extends T> createBuilder(@Nonnull P entity);
|
||||
|
||||
@Override
|
||||
public synchronized void save() {
|
||||
@@ -114,51 +114,51 @@ public abstract class AbstractCalculatorMathRegistry<T extends MathEntity, P ext
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected abstract P transform(@NotNull T entity);
|
||||
protected abstract P transform(@Nonnull T entity);
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
protected abstract MathEntityPersistenceContainer<P> createPersistenceContainer();
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<T> getEntities() {
|
||||
return mathRegistry.getEntities();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<T> getSystemEntities() {
|
||||
return mathRegistry.getSystemEntities();
|
||||
}
|
||||
|
||||
@Override
|
||||
public T add(@NotNull JBuilder<? extends T> JBuilder) {
|
||||
public T add(@Nonnull JBuilder<? extends T> 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<String> 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);
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package org.solovyev.android.calculator;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public abstract class AbstractFixableError implements FixableError {
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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<Cal
|
||||
|
||||
void evaluate();
|
||||
|
||||
void evaluate(@NotNull Long sequenceId);
|
||||
void evaluate(@Nonnull Long sequenceId);
|
||||
|
||||
void simplify();
|
||||
|
||||
@NotNull
|
||||
CalculatorEventData evaluate(@NotNull JsclOperation operation,
|
||||
@NotNull String expression);
|
||||
@Nonnull
|
||||
CalculatorEventData evaluate(@Nonnull JsclOperation operation,
|
||||
@Nonnull String expression);
|
||||
|
||||
@NotNull
|
||||
CalculatorEventData evaluate(@NotNull JsclOperation operation,
|
||||
@NotNull String expression,
|
||||
@NotNull Long sequenceId);
|
||||
@Nonnull
|
||||
CalculatorEventData evaluate(@Nonnull JsclOperation operation,
|
||||
@Nonnull String expression,
|
||||
@Nonnull Long sequenceId);
|
||||
|
||||
/*
|
||||
**********************************************************************
|
||||
@@ -48,10 +48,10 @@ public interface Calculator extends CalculatorEventContainer, HistoryControl<Cal
|
||||
**********************************************************************
|
||||
*/
|
||||
|
||||
boolean isConversionPossible(@NotNull Generic generic, @NotNull NumeralBase from, @NotNull NumeralBase to);
|
||||
boolean isConversionPossible(@Nonnull Generic generic, @Nonnull NumeralBase from, @Nonnull NumeralBase to);
|
||||
|
||||
@NotNull
|
||||
CalculatorEventData convert(@NotNull Generic generic, @NotNull NumeralBase to);
|
||||
@Nonnull
|
||||
CalculatorEventData convert(@Nonnull Generic generic, @Nonnull NumeralBase to);
|
||||
|
||||
/*
|
||||
**********************************************************************
|
||||
@@ -60,15 +60,15 @@ public interface Calculator extends CalculatorEventContainer, HistoryControl<Cal
|
||||
*
|
||||
**********************************************************************
|
||||
*/
|
||||
@NotNull
|
||||
CalculatorEventData fireCalculatorEvent(@NotNull CalculatorEventType calculatorEventType, @Nullable Object data);
|
||||
@Nonnull
|
||||
CalculatorEventData fireCalculatorEvent(@Nonnull CalculatorEventType calculatorEventType, @Nullable Object data);
|
||||
|
||||
@NotNull
|
||||
CalculatorEventData fireCalculatorEvent(@NotNull CalculatorEventType calculatorEventType, @Nullable Object data, @NotNull Object source);
|
||||
@Nonnull
|
||||
CalculatorEventData fireCalculatorEvent(@Nonnull CalculatorEventType calculatorEventType, @Nullable Object data, @Nonnull Object source);
|
||||
|
||||
@NotNull
|
||||
CalculatorEventData fireCalculatorEvent(@NotNull CalculatorEventType calculatorEventType, @Nullable Object data, @NotNull Long sequenceId);
|
||||
@Nonnull
|
||||
CalculatorEventData fireCalculatorEvent(@Nonnull CalculatorEventType calculatorEventType, @Nullable Object data, @Nonnull Long sequenceId);
|
||||
|
||||
@NotNull
|
||||
PreparedExpression prepareExpression(@NotNull String expression) throws CalculatorParseException;
|
||||
@Nonnull
|
||||
PreparedExpression prepareExpression(@Nonnull String expression) throws CalculatorParseException;
|
||||
}
|
||||
|
@@ -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
|
||||
@@ -13,7 +13,7 @@ public interface CalculatorClipboard {
|
||||
@Nullable
|
||||
String getText();
|
||||
|
||||
void setText(@NotNull String text);
|
||||
void setText(@Nonnull String text);
|
||||
|
||||
void setText(@NotNull CharSequence text);
|
||||
void setText(@Nonnull CharSequence text);
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@ package org.solovyev.android.calculator;
|
||||
|
||||
import jscl.NumeralBase;
|
||||
import jscl.math.Generic;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* User: Solovyev_S
|
||||
@@ -12,15 +12,15 @@ import org.jetbrains.annotations.NotNull;
|
||||
public interface CalculatorConversionEventData extends CalculatorEventData {
|
||||
|
||||
// display state on the moment of conversion
|
||||
@NotNull
|
||||
@Nonnull
|
||||
CalculatorDisplayViewState getDisplayState();
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
NumeralBase getFromNumeralBase();
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
NumeralBase getToNumeralBase();
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
Generic getValue();
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@ package org.solovyev.android.calculator;
|
||||
|
||||
import jscl.NumeralBase;
|
||||
import jscl.math.Generic;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* User: Solovyev_S
|
||||
@@ -11,30 +11,30 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public class CalculatorConversionEventDataImpl implements CalculatorConversionEventData {
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private CalculatorEventData calculatorEventData;
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private NumeralBase fromNumeralBase;
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private NumeralBase toNumeralBase;
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private Generic value;
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private CalculatorDisplayViewState displayState;
|
||||
|
||||
private CalculatorConversionEventDataImpl() {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static CalculatorConversionEventData newInstance(@NotNull CalculatorEventData calculatorEventData,
|
||||
@NotNull Generic value,
|
||||
@NotNull NumeralBase from,
|
||||
@NotNull NumeralBase to,
|
||||
@NotNull CalculatorDisplayViewState displayViewState) {
|
||||
@Nonnull
|
||||
public static CalculatorConversionEventData newInstance(@Nonnull CalculatorEventData calculatorEventData,
|
||||
@Nonnull Generic value,
|
||||
@Nonnull NumeralBase from,
|
||||
@Nonnull NumeralBase to,
|
||||
@Nonnull CalculatorDisplayViewState displayViewState) {
|
||||
final CalculatorConversionEventDataImpl result = new CalculatorConversionEventDataImpl();
|
||||
|
||||
result.calculatorEventData = calculatorEventData;
|
||||
@@ -52,7 +52,7 @@ public class CalculatorConversionEventDataImpl implements CalculatorConversionEv
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
@Nonnull
|
||||
public Long getSequenceId() {
|
||||
return calculatorEventData.getSequenceId();
|
||||
}
|
||||
@@ -63,40 +63,40 @@ public class CalculatorConversionEventDataImpl implements CalculatorConversionEv
|
||||
}
|
||||
|
||||
@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 calculatorEventData.isSameSequence(that);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAfterSequence(@NotNull CalculatorEventData that) {
|
||||
public boolean isAfterSequence(@Nonnull CalculatorEventData that) {
|
||||
return calculatorEventData.isAfterSequence(that);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
public CalculatorDisplayViewState getDisplayState() {
|
||||
return this.displayState;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
@Nonnull
|
||||
public NumeralBase getFromNumeralBase() {
|
||||
return fromNumeralBase;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
@Nonnull
|
||||
public NumeralBase getToNumeralBase() {
|
||||
return toNumeralBase;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
@Nonnull
|
||||
public Generic getValue() {
|
||||
return value;
|
||||
}
|
||||
|
@@ -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;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
@@ -21,11 +21,11 @@ public interface CalculatorDisplay extends CalculatorEventListener {
|
||||
@Nullable
|
||||
CalculatorDisplayView getView();
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
CalculatorDisplayViewState getViewState();
|
||||
|
||||
void setViewState(@NotNull CalculatorDisplayViewState viewState);
|
||||
void setViewState(@Nonnull CalculatorDisplayViewState viewState);
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
CalculatorEventData getLastEventData();
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package org.solovyev.android.calculator;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
@@ -9,24 +9,24 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public class CalculatorDisplayChangeEventDataImpl implements CalculatorDisplayChangeEventData {
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private final CalculatorDisplayViewState oldState;
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private final CalculatorDisplayViewState newState;
|
||||
|
||||
public CalculatorDisplayChangeEventDataImpl(@NotNull CalculatorDisplayViewState oldState, @NotNull CalculatorDisplayViewState newState) {
|
||||
public CalculatorDisplayChangeEventDataImpl(@Nonnull CalculatorDisplayViewState oldState, @Nonnull CalculatorDisplayViewState newState) {
|
||||
this.oldState = oldState;
|
||||
this.newState = newState;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
public CalculatorDisplayViewState getOldValue() {
|
||||
return this.oldState;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
public CalculatorDisplayViewState getNewValue() {
|
||||
return this.newState;
|
||||
|
@@ -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 static org.solovyev.android.calculator.CalculatorEventType.*;
|
||||
|
||||
@@ -12,22 +12,22 @@ import static org.solovyev.android.calculator.CalculatorEventType.*;
|
||||
*/
|
||||
public class CalculatorDisplayImpl implements CalculatorDisplay {
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private final CalculatorEventHolder lastEvent;
|
||||
|
||||
@Nullable
|
||||
private CalculatorDisplayView view;
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private final Object viewLock = new Object();
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private CalculatorDisplayViewState viewState = CalculatorDisplayViewStateImpl.newDefaultInstance();
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private final Calculator calculator;
|
||||
|
||||
public CalculatorDisplayImpl(@NotNull Calculator calculator) {
|
||||
public CalculatorDisplayImpl(@Nonnull Calculator calculator) {
|
||||
this.calculator = calculator;
|
||||
this.lastEvent = new CalculatorEventHolder(CalculatorUtils.createFirstEventDataId());
|
||||
this.calculator.addCalculatorEventListener(this);
|
||||
@@ -50,14 +50,14 @@ public class CalculatorDisplayImpl implements CalculatorDisplay {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
public CalculatorDisplayViewState getViewState() {
|
||||
return this.viewState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setViewState(@NotNull CalculatorDisplayViewState newViewState) {
|
||||
public void setViewState(@Nonnull CalculatorDisplayViewState newViewState) {
|
||||
synchronized (viewLock) {
|
||||
final CalculatorDisplayViewState oldViewState = setViewState0(newViewState);
|
||||
|
||||
@@ -65,7 +65,7 @@ public class CalculatorDisplayImpl implements CalculatorDisplay {
|
||||
}
|
||||
}
|
||||
|
||||
private void setViewStateForSequence(@NotNull CalculatorDisplayViewState newViewState, @NotNull Long sequenceId) {
|
||||
private void setViewStateForSequence(@Nonnull CalculatorDisplayViewState newViewState, @Nonnull Long sequenceId) {
|
||||
synchronized (viewLock) {
|
||||
final CalculatorDisplayViewState oldViewState = setViewState0(newViewState);
|
||||
|
||||
@@ -74,8 +74,8 @@ public class CalculatorDisplayImpl implements CalculatorDisplay {
|
||||
}
|
||||
|
||||
// must be synchronized with viewLock
|
||||
@NotNull
|
||||
private CalculatorDisplayViewState setViewState0(@NotNull CalculatorDisplayViewState newViewState) {
|
||||
@Nonnull
|
||||
private CalculatorDisplayViewState setViewState0(@Nonnull CalculatorDisplayViewState newViewState) {
|
||||
final CalculatorDisplayViewState oldViewState = this.viewState;
|
||||
|
||||
this.viewState = newViewState;
|
||||
@@ -86,14 +86,14 @@ public class CalculatorDisplayImpl implements CalculatorDisplay {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
@Nonnull
|
||||
public CalculatorEventData getLastEventData() {
|
||||
return lastEvent.getLastEventData();
|
||||
}
|
||||
|
||||
@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(calculation_result, calculation_failed, calculation_cancelled, conversion_result, conversion_failed)) {
|
||||
|
||||
@@ -121,13 +121,13 @@ public class CalculatorDisplayImpl implements CalculatorDisplay {
|
||||
}
|
||||
}
|
||||
|
||||
private void processConversationFailed(@NotNull CalculatorConversionEventData calculatorEventData,
|
||||
@NotNull ConversionFailure data) {
|
||||
private void processConversationFailed(@Nonnull CalculatorConversionEventData calculatorEventData,
|
||||
@Nonnull ConversionFailure data) {
|
||||
this.setViewStateForSequence(CalculatorDisplayViewStateImpl.newErrorState(calculatorEventData.getDisplayState().getOperation(), CalculatorMessages.getBundle().getString(CalculatorMessages.syntax_error)), calculatorEventData.getSequenceId());
|
||||
|
||||
}
|
||||
|
||||
private void processCalculationFailed(@NotNull CalculatorEvaluationEventData calculatorEventData, @NotNull CalculatorFailure data) {
|
||||
private void processCalculationFailed(@Nonnull CalculatorEvaluationEventData calculatorEventData, @Nonnull CalculatorFailure data) {
|
||||
|
||||
final CalculatorEvalException calculatorEvalException = data.getCalculationEvalException();
|
||||
|
||||
@@ -146,18 +146,18 @@ public class CalculatorDisplayImpl implements CalculatorDisplay {
|
||||
this.setViewStateForSequence(CalculatorDisplayViewStateImpl.newErrorState(calculatorEventData.getOperation(), errorMessage), calculatorEventData.getSequenceId());
|
||||
}
|
||||
|
||||
private void processCalculationCancelled(@NotNull CalculatorEvaluationEventData calculatorEventData) {
|
||||
private void processCalculationCancelled(@Nonnull CalculatorEvaluationEventData calculatorEventData) {
|
||||
final String errorMessage = CalculatorMessages.getBundle().getString(CalculatorMessages.syntax_error);
|
||||
|
||||
this.setViewStateForSequence(CalculatorDisplayViewStateImpl.newErrorState(calculatorEventData.getOperation(), errorMessage), calculatorEventData.getSequenceId());
|
||||
}
|
||||
|
||||
private void processCalculationResult(@NotNull CalculatorEvaluationEventData calculatorEventData, @NotNull CalculatorOutput data) {
|
||||
private void processCalculationResult(@Nonnull CalculatorEvaluationEventData calculatorEventData, @Nonnull CalculatorOutput data) {
|
||||
final String stringResult = data.getStringResult();
|
||||
this.setViewStateForSequence(CalculatorDisplayViewStateImpl.newValidState(calculatorEventData.getOperation(), data.getResult(), stringResult, 0), calculatorEventData.getSequenceId());
|
||||
}
|
||||
|
||||
private void processConversationResult(@NotNull CalculatorConversionEventData calculatorEventData, @NotNull String result) {
|
||||
private void processConversationResult(@Nonnull CalculatorConversionEventData calculatorEventData, @Nonnull String result) {
|
||||
// add prefix
|
||||
if (calculatorEventData.getFromNumeralBase() != calculatorEventData.getToNumeralBase()) {
|
||||
result = calculatorEventData.getToNumeralBase().getJsclPrefix() + result;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package org.solovyev.android.calculator;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
@@ -9,8 +9,8 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public interface CalculatorDisplayView {
|
||||
|
||||
void setState(@NotNull CalculatorDisplayViewState state);
|
||||
void setState(@Nonnull CalculatorDisplayViewState state);
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
CalculatorDisplayViewState getState();
|
||||
}
|
||||
|
@@ -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;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -14,7 +14,7 @@ import java.io.Serializable;
|
||||
*/
|
||||
public interface CalculatorDisplayViewState extends Serializable {
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
String getText();
|
||||
|
||||
int getSelection();
|
||||
@@ -27,7 +27,7 @@ public interface CalculatorDisplayViewState extends Serializable {
|
||||
@Nullable
|
||||
String getErrorMessage();
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
JsclOperation getOperation();
|
||||
|
||||
@Nullable
|
||||
|
@@ -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;
|
||||
import org.solovyev.common.text.Strings;
|
||||
|
||||
@@ -21,7 +21,7 @@ public class CalculatorDisplayViewStateImpl implements CalculatorDisplayViewStat
|
||||
**********************************************************************
|
||||
*/
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private JsclOperation operation = JsclOperation.numeric;
|
||||
|
||||
@Nullable
|
||||
@@ -48,14 +48,14 @@ public class CalculatorDisplayViewStateImpl implements CalculatorDisplayViewStat
|
||||
private CalculatorDisplayViewStateImpl() {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
public static CalculatorDisplayViewState newDefaultInstance() {
|
||||
return new CalculatorDisplayViewStateImpl();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static CalculatorDisplayViewState newErrorState(@NotNull JsclOperation operation,
|
||||
@NotNull String errorMessage) {
|
||||
@Nonnull
|
||||
public static CalculatorDisplayViewState newErrorState(@Nonnull JsclOperation operation,
|
||||
@Nonnull String errorMessage) {
|
||||
final CalculatorDisplayViewStateImpl calculatorDisplayState = new CalculatorDisplayViewStateImpl();
|
||||
calculatorDisplayState.valid = false;
|
||||
calculatorDisplayState.errorMessage = errorMessage;
|
||||
@@ -63,10 +63,10 @@ public class CalculatorDisplayViewStateImpl implements CalculatorDisplayViewStat
|
||||
return calculatorDisplayState;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static CalculatorDisplayViewState newValidState(@NotNull JsclOperation operation,
|
||||
@Nonnull
|
||||
public static CalculatorDisplayViewState newValidState(@Nonnull JsclOperation operation,
|
||||
@Nullable Generic result,
|
||||
@NotNull String stringResult,
|
||||
@Nonnull String stringResult,
|
||||
int selection) {
|
||||
final CalculatorDisplayViewStateImpl calculatorDisplayState = new CalculatorDisplayViewStateImpl();
|
||||
calculatorDisplayState.valid = true;
|
||||
@@ -86,7 +86,7 @@ public class CalculatorDisplayViewStateImpl implements CalculatorDisplayViewStat
|
||||
**********************************************************************
|
||||
*/
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getText() {
|
||||
return Strings.getNotEmpty(isValid() ? stringResult : errorMessage, "");
|
||||
@@ -120,7 +120,7 @@ public class CalculatorDisplayViewStateImpl implements CalculatorDisplayViewStat
|
||||
return stringResult;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
public JsclOperation getOperation() {
|
||||
return this.operation;
|
||||
|
@@ -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.gui.CursorControl;
|
||||
|
||||
/**
|
||||
@@ -13,13 +13,13 @@ public interface CalculatorEditor extends CalculatorEventListener {
|
||||
|
||||
void setView(@Nullable CalculatorEditorView view);
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
CalculatorEditorViewState getViewState();
|
||||
|
||||
// updates state of view (view.setState())
|
||||
void updateViewState();
|
||||
|
||||
void setViewState(@NotNull CalculatorEditorViewState viewState);
|
||||
void setViewState(@Nonnull CalculatorEditorViewState viewState);
|
||||
|
||||
/*
|
||||
**********************************************************************
|
||||
@@ -32,28 +32,28 @@ public interface CalculatorEditor extends CalculatorEventListener {
|
||||
/**
|
||||
* Method sets the cursor to the beginning
|
||||
*/
|
||||
@NotNull
|
||||
@Nonnull
|
||||
public CalculatorEditorViewState setCursorOnStart();
|
||||
|
||||
/**
|
||||
* Method sets the cursor to the end
|
||||
*/
|
||||
@NotNull
|
||||
@Nonnull
|
||||
public CalculatorEditorViewState setCursorOnEnd();
|
||||
|
||||
/**
|
||||
* Method moves cursor to the left of current position
|
||||
*/
|
||||
@NotNull
|
||||
@Nonnull
|
||||
public CalculatorEditorViewState moveCursorLeft();
|
||||
|
||||
/**
|
||||
* Method moves cursor to the right of current position
|
||||
*/
|
||||
@NotNull
|
||||
@Nonnull
|
||||
public CalculatorEditorViewState moveCursorRight();
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
CursorControl asCursorControl();
|
||||
|
||||
|
||||
@@ -64,27 +64,27 @@ public interface CalculatorEditor extends CalculatorEventListener {
|
||||
*
|
||||
**********************************************************************
|
||||
*/
|
||||
@NotNull
|
||||
@Nonnull
|
||||
CalculatorEditorViewState erase();
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
CalculatorEditorViewState clear();
|
||||
|
||||
@NotNull
|
||||
CalculatorEditorViewState setText(@NotNull String text);
|
||||
@Nonnull
|
||||
CalculatorEditorViewState setText(@Nonnull String text);
|
||||
|
||||
@NotNull
|
||||
CalculatorEditorViewState setText(@NotNull String text, int selection);
|
||||
@Nonnull
|
||||
CalculatorEditorViewState setText(@Nonnull String text, int selection);
|
||||
|
||||
@NotNull
|
||||
CalculatorEditorViewState insert(@NotNull String text);
|
||||
@Nonnull
|
||||
CalculatorEditorViewState insert(@Nonnull String text);
|
||||
|
||||
@NotNull
|
||||
CalculatorEditorViewState insert(@NotNull String text, int selectionOffset);
|
||||
@Nonnull
|
||||
CalculatorEditorViewState insert(@Nonnull String text, int selectionOffset);
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
CalculatorEditorViewState moveSelection(int offset);
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
CalculatorEditorViewState setSelection(int selection);
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package org.solovyev.android.calculator;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* User: Solovyev_S
|
||||
@@ -9,25 +9,25 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public class CalculatorEditorChangeEventDataImpl implements CalculatorEditorChangeEventData {
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private CalculatorEditorViewState oldState;
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private CalculatorEditorViewState newState;
|
||||
|
||||
public CalculatorEditorChangeEventDataImpl(@NotNull CalculatorEditorViewState oldState,
|
||||
@NotNull CalculatorEditorViewState newState) {
|
||||
public CalculatorEditorChangeEventDataImpl(@Nonnull CalculatorEditorViewState oldState,
|
||||
@Nonnull CalculatorEditorViewState newState) {
|
||||
this.oldState = oldState;
|
||||
this.newState = newState;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
public CalculatorEditorViewState getOldValue() {
|
||||
return this.oldState;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
public CalculatorEditorViewState getNewValue() {
|
||||
return this.newState;
|
||||
|
@@ -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.history.CalculatorHistoryState;
|
||||
import org.solovyev.android.calculator.history.EditorHistoryState;
|
||||
import org.solovyev.common.gui.CursorControl;
|
||||
@@ -17,22 +17,22 @@ public class CalculatorEditorImpl implements CalculatorEditor {
|
||||
@Nullable
|
||||
private CalculatorEditorView view;
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private final Object viewLock = new Object();
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private CalculatorEditorViewState lastViewState = CalculatorEditorViewStateImpl.newDefaultInstance();
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private final Calculator calculator;
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private final CalculatorEventHolder lastEventHolder;
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private final CursorControlAdapter cursorControlAdapter = new CursorControlAdapter(this);
|
||||
|
||||
public CalculatorEditorImpl(@NotNull Calculator calculator) {
|
||||
public CalculatorEditorImpl(@Nonnull Calculator calculator) {
|
||||
this.calculator = calculator;
|
||||
this.calculator.addCalculatorEventListener(this);
|
||||
this.lastEventHolder = new CalculatorEventHolder(CalculatorUtils.createFirstEventDataId());
|
||||
@@ -49,7 +49,7 @@ public class CalculatorEditorImpl implements CalculatorEditor {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
public CalculatorEditorViewState getViewState() {
|
||||
return lastViewState;
|
||||
@@ -61,11 +61,11 @@ public class CalculatorEditorImpl implements CalculatorEditor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setViewState(@NotNull CalculatorEditorViewState newViewState) {
|
||||
public void setViewState(@Nonnull CalculatorEditorViewState newViewState) {
|
||||
setViewState(newViewState, true);
|
||||
}
|
||||
|
||||
private void setViewState(@NotNull CalculatorEditorViewState newViewState, boolean majorChanges) {
|
||||
private void setViewState(@Nonnull CalculatorEditorViewState newViewState, boolean majorChanges) {
|
||||
synchronized (viewLock) {
|
||||
final CalculatorEditorViewState oldViewState = this.lastViewState;
|
||||
|
||||
@@ -83,8 +83,8 @@ public class CalculatorEditorImpl implements CalculatorEditor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData,
|
||||
@NotNull CalculatorEventType calculatorEventType,
|
||||
public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData,
|
||||
@Nonnull CalculatorEventType calculatorEventType,
|
||||
@Nullable Object data) {
|
||||
final CalculatorEventHolder.Result result = lastEventHolder.apply(calculatorEventData);
|
||||
|
||||
@@ -107,7 +107,7 @@ public class CalculatorEditorImpl implements CalculatorEditor {
|
||||
**********************************************************************
|
||||
*/
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private CalculatorEditorViewState newSelectionViewState(int newSelection) {
|
||||
if (this.lastViewState.getSelection() != newSelection) {
|
||||
final CalculatorEditorViewState result = CalculatorEditorViewStateImpl.newSelection(this.lastViewState, newSelection);
|
||||
@@ -118,7 +118,7 @@ public class CalculatorEditorImpl implements CalculatorEditor {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
public CalculatorEditorViewState setCursorOnStart() {
|
||||
synchronized (viewLock) {
|
||||
return newSelectionViewState(0);
|
||||
@@ -126,14 +126,14 @@ public class CalculatorEditorImpl implements CalculatorEditor {
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
public CalculatorEditorViewState setCursorOnEnd() {
|
||||
synchronized (viewLock) {
|
||||
return newSelectionViewState(this.lastViewState.getText().length());
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
public CalculatorEditorViewState moveCursorLeft() {
|
||||
synchronized (viewLock) {
|
||||
if (this.lastViewState.getSelection() > 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;
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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();
|
||||
|
@@ -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;
|
||||
|
@@ -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<IConstant> getVarsRegistry();
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
CalculatorMathRegistry<Function> getFunctionsRegistry();
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
CalculatorMathRegistry<Operator> getOperatorsRegistry();
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
CalculatorMathRegistry<Operator> 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);
|
||||
}
|
||||
|
@@ -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<IConstant> varsRegistry;
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private final CalculatorMathRegistry<Function> functionsRegistry;
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private final CalculatorMathRegistry<Operator> operatorsRegistry;
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private final CalculatorMathRegistry<Operator> 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<IConstant> varsRegistry,
|
||||
@NotNull CalculatorMathRegistry<Function> functionsRegistry,
|
||||
@NotNull CalculatorMathRegistry<Operator> operatorsRegistry,
|
||||
@NotNull CalculatorMathRegistry<Operator> postfixFunctionsRegistry,
|
||||
public CalculatorEngineImpl(@Nonnull JsclMathEngine engine,
|
||||
@Nonnull CalculatorMathRegistry<IConstant> varsRegistry,
|
||||
@Nonnull CalculatorMathRegistry<Function> functionsRegistry,
|
||||
@Nonnull CalculatorMathRegistry<Operator> operatorsRegistry,
|
||||
@Nonnull CalculatorMathRegistry<Operator> postfixFunctionsRegistry,
|
||||
@Nullable Object lock) {
|
||||
|
||||
this.engine = engine;
|
||||
@@ -102,37 +102,37 @@ public class CalculatorEngineImpl implements CalculatorEngine {
|
||||
*
|
||||
**********************************************************************
|
||||
*/
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
public CalculatorMathRegistry<IConstant> getVarsRegistry() {
|
||||
return this.varsRegistry;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
public CalculatorMathRegistry<Function> getFunctionsRegistry() {
|
||||
return this.functionsRegistry;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
public CalculatorMathRegistry<Operator> getOperatorsRegistry() {
|
||||
return this.operatorsRegistry;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
public CalculatorMathRegistry<Operator> 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);
|
||||
}
|
||||
}
|
||||
|
@@ -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<Object> 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);
|
||||
}
|
||||
}
|
||||
|
@@ -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();
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -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<CalculatorEvent> calculatorEvents);
|
||||
void fireCalculatorEvents(@Nonnull List<CalculatorEvent> 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;
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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();
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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);
|
||||
|
||||
}
|
||||
|
@@ -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<IConstant>
|
||||
// @Nonnull Change<IConstant>
|
||||
constant_changed,
|
||||
|
||||
// @NotNull IConstant
|
||||
// @Nonnull IConstant
|
||||
constant_removed,
|
||||
|
||||
|
||||
// @NotNull Function
|
||||
// @Nonnull Function
|
||||
function_removed,
|
||||
|
||||
// @NotNull Function
|
||||
// @Nonnull Function
|
||||
function_added,
|
||||
|
||||
// @NotNull Change<IFunction>
|
||||
// @Nonnull Change<IFunction>
|
||||
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;
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
|
@@ -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<String> 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;
|
||||
|
@@ -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<Function, AFunction> {
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private static final Map<String, String> substitutes = new HashMap<String, String>();
|
||||
|
||||
static {
|
||||
substitutes.put("√", "sqrt");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private static final String FUNCTION_DESCRIPTION_PREFIX = "c_fun_description_";
|
||||
|
||||
public CalculatorFunctionsMathRegistry(@NotNull MathRegistry<Function> functionsRegistry,
|
||||
@NotNull MathEntityDao<AFunction> mathEntityDao) {
|
||||
public CalculatorFunctionsMathRegistry(@Nonnull MathRegistry<Function> functionsRegistry,
|
||||
@Nonnull MathEntityDao<AFunction> mathEntityDao) {
|
||||
super(functionsRegistry, FUNCTION_DESCRIPTION_PREFIX, mathEntityDao);
|
||||
}
|
||||
|
||||
@@ -58,10 +58,10 @@ public class CalculatorFunctionsMathRegistry extends AbstractCalculatorMathRegis
|
||||
super.load();
|
||||
}
|
||||
|
||||
public static void saveFunction(@NotNull CalculatorMathRegistry<Function> registry,
|
||||
@NotNull MathEntityBuilder<? extends Function> builder,
|
||||
public static void saveFunction(@Nonnull CalculatorMathRegistry<Function> registry,
|
||||
@Nonnull MathEntityBuilder<? extends Function> 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<String, String> 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<? extends Function> createBuilder(@NotNull AFunction function) {
|
||||
protected JBuilder<? extends Function> 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<AFunction> createPersistenceContainer() {
|
||||
return new Functions();
|
||||
|
@@ -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<PreparedExpression, String> 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<CalculatorEvent> calculatorEvents) {
|
||||
public void fireCalculatorEvents(@Nonnull final List<CalculatorEvent> 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();
|
||||
}
|
||||
|
@@ -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();
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package org.solovyev.android.calculator;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
|
@@ -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);
|
||||
|
@@ -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();
|
||||
}
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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<T extends MathEntity> extends MathRegistry<T> {
|
||||
|
||||
@Nullable
|
||||
String getDescription(@NotNull String mathEntityName);
|
||||
String getDescription(@Nonnull String mathEntityName);
|
||||
|
||||
@Nullable
|
||||
String getCategory(@NotNull T mathEntity);
|
||||
String getCategory(@Nonnull T mathEntity);
|
||||
|
||||
void load();
|
||||
|
||||
|
@@ -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());
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -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<Object> parameters);
|
||||
void showMessage(@Nonnull Integer messageCode, @Nonnull MessageType messageType, @Nonnull List<Object> 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);
|
||||
}
|
||||
|
@@ -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<Operator, MathPersistenceEntity> {
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private static final Map<String, String> substitutes = new HashMap<String, String>();
|
||||
|
||||
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<Operator> functionsRegistry,
|
||||
@NotNull MathEntityDao<MathPersistenceEntity> mathEntityDao) {
|
||||
public CalculatorOperatorsMathRegistry(@Nonnull MathRegistry<Operator> functionsRegistry,
|
||||
@Nonnull MathEntityDao<MathPersistenceEntity> mathEntityDao) {
|
||||
super(functionsRegistry, OPERATOR_DESCRIPTION_PREFIX, mathEntityDao);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
protected Map<String, String> 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<? extends Operator> createBuilder(@NotNull MathPersistenceEntity entity) {
|
||||
protected JBuilder<? extends Operator> 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<MathPersistenceEntity> createPersistenceContainer() {
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
|
@@ -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();
|
||||
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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<Object> 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);
|
||||
}
|
||||
}
|
||||
|
@@ -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<Operator, MathPersistenceEntity> {
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private static final Map<String, String> substitutes = new HashMap<String, String>();
|
||||
|
||||
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<Operator> functionsRegistry,
|
||||
@NotNull MathEntityDao<MathPersistenceEntity> mathEntityDao) {
|
||||
public CalculatorPostfixFunctionsRegistry(@Nonnull MathRegistry<Operator> functionsRegistry,
|
||||
@Nonnull MathEntityDao<MathPersistenceEntity> mathEntityDao) {
|
||||
super(functionsRegistry, POSTFIX_FUNCTION_DESCRIPTION_PREFIX, mathEntityDao);
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
protected Map<String, String> 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<? extends Operator> createBuilder(@NotNull MathPersistenceEntity entity) {
|
||||
protected JBuilder<? extends Operator> 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<MathPersistenceEntity> createPersistenceContainer() {
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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<String, CalculatorSpecialButton> buttonsByActionCodes = new HashMap<String, CalculatorSpecialButton>();
|
||||
|
||||
@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()) {
|
||||
|
@@ -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<Constant> getNotSystemConstants(@NotNull Generic expression) {
|
||||
@Nonnull
|
||||
public static Set<Constant> getNotSystemConstants(@Nonnull Generic expression) {
|
||||
final Set<Constant> notSystemConstants = new HashSet<Constant>();
|
||||
|
||||
for (Constant constant : expression.getConstants()) {
|
||||
|
@@ -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<IConstant, Var> {
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
public static final String ANS = "ans";
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private static final Map<String, String> substitutes = new HashMap<String, String>();
|
||||
|
||||
static {
|
||||
@@ -40,15 +40,15 @@ public class CalculatorVarsRegistry extends AbstractCalculatorMathRegistry<ICons
|
||||
substitutes.put("NaN", "nan");
|
||||
}
|
||||
|
||||
public CalculatorVarsRegistry(@NotNull MathRegistry<IConstant> mathRegistry,
|
||||
@NotNull MathEntityDao<Var> mathEntityDao) {
|
||||
public CalculatorVarsRegistry(@Nonnull MathRegistry<IConstant> mathRegistry,
|
||||
@Nonnull MathEntityDao<Var> mathEntityDao) {
|
||||
super(mathRegistry, "c_var_description_", mathEntityDao);
|
||||
}
|
||||
|
||||
public static <T extends MathEntity> void saveVariable(@NotNull CalculatorMathRegistry<T> registry,
|
||||
@NotNull MathEntityBuilder<? extends T> builder,
|
||||
public static <T extends MathEntity> void saveVariable(@Nonnull CalculatorMathRegistry<T> registry,
|
||||
@Nonnull MathEntityBuilder<? extends T> 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<ICons
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
protected Map<String, String> getSubstitutes() {
|
||||
return substitutes;
|
||||
@@ -84,27 +84,27 @@ public class CalculatorVarsRegistry extends AbstractCalculatorMathRegistry<ICons
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
protected JBuilder<? extends IConstant> createBuilder(@NotNull Var entity) {
|
||||
protected JBuilder<? extends IConstant> createBuilder(@Nonnull Var entity) {
|
||||
return new Var.Builder(entity);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
protected MathEntityPersistenceContainer<Var> 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<ICons
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription(@NotNull String mathEntityName) {
|
||||
public String getDescription(@Nonnull String mathEntityName) {
|
||||
final IConstant var = get(mathEntityName);
|
||||
if (var != null && !var.isSystem()) {
|
||||
return var.getDescription();
|
||||
@@ -123,7 +123,7 @@ public class CalculatorVarsRegistry extends AbstractCalculatorMathRegistry<ICons
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCategory(@NotNull IConstant var) {
|
||||
public String getCategory(@Nonnull IConstant var) {
|
||||
for (VarCategory category : VarCategory.values()) {
|
||||
if (category.isInCategory(var)) {
|
||||
return category.name();
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package org.solovyev.android.calculator;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
@@ -9,10 +9,10 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public interface Change<T> {
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
T getOldValue();
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
T getNewValue();
|
||||
|
||||
}
|
||||
|
@@ -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<T> implements Change<T> {
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private T oldValue;
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private T newValue;
|
||||
|
||||
private ChangeImpl() {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static <T> Change<T> newInstance(@NotNull T oldValue, @NotNull T newValue) {
|
||||
@Nonnull
|
||||
public static <T> Change<T> newInstance(@Nonnull T oldValue, @Nonnull T newValue) {
|
||||
final ChangeImpl<T> result = new ChangeImpl<T>();
|
||||
|
||||
result.oldValue = oldValue;
|
||||
@@ -28,13 +28,13 @@ public class ChangeImpl<T> implements Change<T> {
|
||||
return result;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
public T getOldValue() {
|
||||
return this.oldValue;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
public T getNewValue() {
|
||||
return this.newValue;
|
||||
|
@@ -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();
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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
|
||||
|
@@ -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) {
|
||||
}
|
||||
}
|
||||
|
@@ -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<Object> parameters) {
|
||||
public void showMessage(@Nonnull Integer messageCode, @Nonnull MessageType messageType, @Nonnull List<Object> 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) {
|
||||
}
|
||||
}
|
||||
|
@@ -6,7 +6,7 @@
|
||||
|
||||
package org.solovyev.android.calculator;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package org.solovyev.android.calculator;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
@@ -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<String> 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<FunctionCategory> getCategoriesByTabOrder() {
|
||||
final List<FunctionCategory> result = Collections.asList(FunctionCategory.values());
|
||||
|
||||
|
@@ -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<CalculatorEventListener> 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<CalculatorEvent> calculatorEvents) {
|
||||
public void fireCalculatorEvents(@Nonnull List<CalculatorEvent> calculatorEvents) {
|
||||
final Collection<CalculatorEventListener> listeners = this.listeners.getListeners();
|
||||
|
||||
//final CalculatorLogger logger = Locator.getInstance().getLogger();
|
||||
|
@@ -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) {
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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<T extends MathPersistenceEntity> {
|
||||
|
||||
void save(@NotNull MathEntityPersistenceContainer<T> container);
|
||||
void save(@Nonnull MathEntityPersistenceContainer<T> container);
|
||||
|
||||
@Nullable
|
||||
MathEntityPersistenceContainer<T> load();
|
||||
|
||||
@Nullable
|
||||
String getDescription(@NotNull String descriptionId);
|
||||
String getDescription(@Nonnull String descriptionId);
|
||||
}
|
||||
|
@@ -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();
|
||||
}
|
||||
|
@@ -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();
|
||||
|
@@ -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<Integer> offset) {
|
||||
@Nonnull
|
||||
public MathType.Result process(@Nonnull StringBuilder text, @Nonnull MathType.Result mathTypeResult, @Nullable MutableObject<Integer> 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<Integer> offset) {
|
||||
public MathType.Result processNumber(@Nonnull StringBuilder text, @Nullable MutableObject<Integer> 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<Integer> 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);
|
||||
|
@@ -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<OperatorCategory> getCategoriesByTabOrder() {
|
||||
final List<OperatorCategory> result = Collections.asList(OperatorCategory.values());
|
||||
|
||||
|
@@ -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<IConstant> undefinedVars;
|
||||
|
||||
public PreparedExpression(@NotNull String expression, @NotNull List<IConstant> undefinedVars) {
|
||||
public PreparedExpression(@Nonnull String expression, @Nonnull List<IConstant> 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<IConstant> getUndefinedVars() {
|
||||
return undefinedVars;
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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<PreparedExpression, String> {
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private static final Integer MAX_DEPTH = 20;
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private static final TextProcessor<PreparedExpression, String> instance = new ToJsclTextProcessor();
|
||||
|
||||
private ToJsclTextProcessor() {
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
public static TextProcessor<PreparedExpression, String> 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<IConstant>());
|
||||
}
|
||||
|
||||
private static PreparedExpression processWithDepth(@NotNull String s, int depth, @NotNull List<IConstant> undefinedVars) throws CalculatorParseException {
|
||||
private static PreparedExpression processWithDepth(@Nonnull String s, int depth, @Nonnull List<IConstant> 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<PreparedExpression, St
|
||||
return result;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static PreparedExpression replaceVariables(@NotNull final String s, int depth, @NotNull List<IConstant> undefinedVars) throws CalculatorParseException {
|
||||
@Nonnull
|
||||
private static PreparedExpression replaceVariables(@Nonnull final String s, int depth, @Nonnull List<IConstant> undefinedVars) throws CalculatorParseException {
|
||||
if (depth >= MAX_DEPTH) {
|
||||
throw new CalculatorParseException(s, new CalculatorMessage(CalculatorMessages.msg_006, MessageType.error));
|
||||
} else {
|
||||
|
@@ -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<VarCategory> getCategoriesByTabOrder() {
|
||||
final List<VarCategory> result = Collections.asList(VarCategory.values());
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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<Function> {
|
||||
|
||||
@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<Function> setName(@NotNull String name) {
|
||||
public MathEntityBuilder<Function> setName(@Nonnull String name) {
|
||||
nestedBuilder.setName(name);
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
public MathEntityBuilder<Function> setDescription(@Nullable String description) {
|
||||
nestedBuilder.setDescription(description);
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
public MathEntityBuilder<Function> 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();
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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<CalculatorHistoryState>
|
||||
|
||||
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<CalculatorHistoryState> getSavedHistory();
|
||||
|
||||
@NotNull
|
||||
CalculatorHistoryState addSavedState(@NotNull CalculatorHistoryState historyState);
|
||||
@Nonnull
|
||||
CalculatorHistoryState addSavedState(@Nonnull CalculatorHistoryState historyState);
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
List<CalculatorHistoryState> getStates();
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
List<CalculatorHistoryState> getStates(boolean includeIntermediateStates);
|
||||
|
||||
}
|
||||
|
@@ -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<CalculatorHistoryState> history = SimpleHistoryHelper.newInstance();
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private final List<CalculatorHistoryState> savedHistory = new ArrayList<CalculatorHistoryState>();
|
||||
|
||||
@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<CalculatorHistoryState> getStates() {
|
||||
synchronized (history) {
|
||||
@@ -110,7 +110,7 @@ public class CalculatorHistoryImpl implements CalculatorHistory {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<CalculatorHistoryState> 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<CalculatorHistoryState> 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)) {
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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());
|
||||
}
|
||||
|
@@ -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<CalculatorHistoryState> historyItems) {
|
||||
public static void fromXml(@Nullable String xml, @Nonnull List<CalculatorHistoryState> historyItems) {
|
||||
if (xml != null) {
|
||||
final Serializer serializer = new Persister();
|
||||
try {
|
||||
@@ -40,8 +40,8 @@ class HistoryUtils {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String toXml(@NotNull List<CalculatorHistoryState> historyItems) {
|
||||
@Nonnull
|
||||
public static String toXml(@Nonnull List<CalculatorHistoryState> historyItems) {
|
||||
final History history = new History();
|
||||
for (CalculatorHistoryState historyState : historyItems) {
|
||||
if (historyState.isSaved()) {
|
||||
|
@@ -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<String, Generic> {
|
||||
|
||||
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("*", "");
|
||||
}
|
||||
}
|
||||
|
@@ -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<String, Generic> 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);
|
||||
|
@@ -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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> tokens) {
|
||||
@Nonnull MathGroupType groupType,
|
||||
@Nonnull List<String> 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<String> 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<MathType> mathTypesByPriority;
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private static List<MathType> getMathTypesByPriority() {
|
||||
if (mathTypesByPriority == null) {
|
||||
final List<MathType> 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;
|
||||
}
|
||||
|
@@ -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<String> parameterNames = new ArrayList<String>();
|
||||
|
||||
@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<String> getParameterNames() {
|
||||
return parameterNames;
|
||||
}
|
||||
|
||||
public void setParameterNames(@NotNull List<String> parameterNames) {
|
||||
public void setParameterNames(@Nonnull List<String> parameterNames) {
|
||||
this.parameterNames = parameterNames;
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ public class AFunction implements IFunction, MathPersistenceEntity, Serializable
|
||||
|
||||
public static class Builder implements MathEntityBuilder<AFunction> {
|
||||
|
||||
@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<String> 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<String>(function.getParameterNames());
|
||||
}
|
||||
|
||||
public Builder(@NotNull String name,
|
||||
@NotNull String value,
|
||||
@NotNull List<String> parameterNames) {
|
||||
public Builder(@Nonnull String name,
|
||||
@Nonnull String value,
|
||||
@Nonnull List<String> 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<String> parameterNames) {
|
||||
public void setParameterNames(@Nonnull List<String> 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<Object> 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);
|
||||
}
|
||||
}
|
||||
|
@@ -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<T extends MathEntity> extends JBuilder<T> {
|
||||
|
||||
@NotNull
|
||||
public MathEntityBuilder<T> setName(@NotNull String name);
|
||||
@Nonnull
|
||||
public MathEntityBuilder<T> setName(@Nonnull String name);
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
public MathEntityBuilder<T> setDescription(@Nullable String description);
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
public MathEntityBuilder<T> setValue(@Nullable String value);
|
||||
}
|
||||
|
@@ -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<Var>, MathEntityBuilder<Var> {
|
||||
|
||||
@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) {
|
||||
|
@@ -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<PlotFunction> getFunctions();
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
List<PlotFunction> 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);
|
||||
}
|
||||
|
@@ -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<PlotFunction> functions = new ArrayList<PlotFunction>();
|
||||
|
||||
@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.<PlotFunction>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<Constant> variables = new ArrayList<Constant>(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<PlotFunction>() {
|
||||
@@ -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<PlotFunction>() {
|
||||
@Override
|
||||
@@ -315,7 +315,7 @@ public class CalculatorPlotterImpl implements CalculatorPlotter {
|
||||
firePlotDataChangedEvent();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<PlotFunction> getFunctions() {
|
||||
synchronized (functions) {
|
||||
@@ -323,7 +323,7 @@ public class CalculatorPlotterImpl implements CalculatorPlotter {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<PlotFunction> 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();
|
||||
|
@@ -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<PlotLineDef, List<PlotLineDef>> registeredLineDefsMap = new HashMap<PlotLineDef, List<PlotLineDef>>();
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private final List<PlotLineDef> preparedLineDefs = new ArrayList<PlotLineDef>(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<PlotLineDef> 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<PlotLineDef> 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);
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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<PlotFunction> functions;
|
||||
|
||||
private boolean plot3d;
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private PlotBoundaries boundaries;
|
||||
|
||||
public PlotData(@NotNull List<PlotFunction> functions,
|
||||
public PlotData(@Nonnull List<PlotFunction> functions,
|
||||
boolean plot3d,
|
||||
@NotNull PlotBoundaries boundaries) {
|
||||
@Nonnull PlotBoundaries boundaries) {
|
||||
this.functions = functions;
|
||||
this.plot3d = plot3d;
|
||||
this.boundaries = boundaries;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
public List<PlotFunction> getFunctions() {
|
||||
return functions;
|
||||
}
|
||||
@@ -36,7 +36,7 @@ public class PlotData {
|
||||
return plot3d;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
public PlotBoundaries getBoundaries() {
|
||||
return boundaries;
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user