From 591cfa46488a5d707366a9ad0420afeb7157fe49 Mon Sep 17 00:00:00 2001 From: serso Date: Wed, 20 Jan 2016 17:04:17 +0100 Subject: [PATCH] Rename --- .../calculator/BaseEntitiesRegistry.java | 24 ++++++----- .../solovyev/android/calculator/Engine.java | 10 ++--- .../android/calculator/FunctionsRegistry.java | 21 ++++++---- .../android/calculator/MathEntityDao.java | 42 ------------------- .../android/calculator/OperatorsRegistry.java | 28 +++++-------- ...r.java => PersistedEntitiesContainer.java} | 11 +---- ...stenceEntity.java => PersistedEntity.java} | 7 +--- .../calculator/PostfixFunctionsRegistry.java | 19 +++++---- .../android/calculator/VarsRegistry.java | 15 ++++--- .../android/calculator/model/AFunction.java | 12 +++--- ...droidMathEntityDao.java => EntityDao.java} | 28 ++++++------- .../android/calculator/model/Functions.java | 9 +--- .../android/calculator/model/Var.java | 4 +- .../android/calculator/model/Vars.java | 4 +- .../calculator/CalculatorTestUtils.java | 11 ++--- 15 files changed, 95 insertions(+), 150 deletions(-) delete mode 100644 app/src/main/java/org/solovyev/android/calculator/MathEntityDao.java rename app/src/main/java/org/solovyev/android/calculator/{MathEntityPersistenceContainer.java => PersistedEntitiesContainer.java} (82%) rename app/src/main/java/org/solovyev/android/calculator/{MathPersistenceEntity.java => PersistedEntity.java} (89%) rename app/src/main/java/org/solovyev/android/calculator/model/{AndroidMathEntityDao.java => EntityDao.java} (78%) diff --git a/app/src/main/java/org/solovyev/android/calculator/BaseEntitiesRegistry.java b/app/src/main/java/org/solovyev/android/calculator/BaseEntitiesRegistry.java index 8fc53e68..850b7ac1 100644 --- a/app/src/main/java/org/solovyev/android/calculator/BaseEntitiesRegistry.java +++ b/app/src/main/java/org/solovyev/android/calculator/BaseEntitiesRegistry.java @@ -22,17 +22,19 @@ package org.solovyev.android.calculator; +import org.solovyev.android.calculator.model.EntityDao; import org.solovyev.common.JBuilder; import org.solovyev.common.math.MathEntity; import org.solovyev.common.math.MathRegistry; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; import java.util.Map; -public abstract class BaseEntitiesRegistry implements EntitiesRegistry { +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public abstract class BaseEntitiesRegistry implements EntitiesRegistry { @Nonnull private final MathRegistry mathRegistry; @@ -41,14 +43,14 @@ public abstract class BaseEntitiesRegistry mathEntityDao; + private final EntityDao

entityDao; protected BaseEntitiesRegistry(@Nonnull MathRegistry mathRegistry, @Nonnull String prefix, - @Nonnull MathEntityDao

mathEntityDao) { + @Nonnull EntityDao

entityDao) { this.mathRegistry = mathRegistry; this.prefix = prefix; - this.mathEntityDao = mathEntityDao; + this.entityDao = entityDao; } @@ -68,11 +70,11 @@ public abstract class BaseEntitiesRegistry persistenceContainer = mathEntityDao.load(); + final PersistedEntitiesContainer

persistenceContainer = entityDao.load(); final List

notCreatedEntities = new ArrayList

(); @@ -110,7 +112,7 @@ public abstract class BaseEntitiesRegistry container = createPersistenceContainer(); + final PersistedEntitiesContainer

container = createPersistenceContainer(); for (T entity : this.getEntities()) { if (!entity.isSystem()) { @@ -121,14 +123,14 @@ public abstract class BaseEntitiesRegistry createPersistenceContainer(); + protected abstract PersistedEntitiesContainer

createPersistenceContainer(); @Nonnull @Override diff --git a/app/src/main/java/org/solovyev/android/calculator/Engine.java b/app/src/main/java/org/solovyev/android/calculator/Engine.java index a1905ff1..1e65f590 100644 --- a/app/src/main/java/org/solovyev/android/calculator/Engine.java +++ b/app/src/main/java/org/solovyev/android/calculator/Engine.java @@ -27,7 +27,7 @@ import android.content.SharedPreferences; import com.squareup.otto.Bus; -import org.solovyev.android.calculator.model.AndroidMathEntityDao; +import org.solovyev.android.calculator.model.EntityDao; import org.solovyev.android.calculator.model.Functions; import org.solovyev.android.calculator.model.Vars; import org.solovyev.android.prefs.BooleanPreference; @@ -92,10 +92,10 @@ public class Engine implements SharedPreferences.OnSharedPreferenceChangeListene this.mathEngine.setRoundResult(true); this.mathEngine.setUseGroupingSeparator(true); - this.varsRegistry = new VarsRegistry(mathEngine.getConstantsRegistry(), new AndroidMathEntityDao<>("org.solovyev.android.calculator.CalculatorModel_vars", application, Vars.class)); - this.functionsRegistry = new FunctionsRegistry(mathEngine.getFunctionsRegistry(), new AndroidMathEntityDao<>("org.solovyev.android.calculator.CalculatorModel_functions", application, Functions.class)); - this.operatorsRegistry = new OperatorsRegistry(mathEngine.getOperatorsRegistry(), new AndroidMathEntityDao<>(null, application, null)); - this.postfixFunctionsRegistry = new PostfixFunctionsRegistry(mathEngine.getPostfixFunctionsRegistry(), new AndroidMathEntityDao<>(null, application, null)); + this.varsRegistry = new VarsRegistry(mathEngine.getConstantsRegistry(), new EntityDao<>("org.solovyev.android.calculator.CalculatorModel_vars", application, Vars.class)); + this.functionsRegistry = new FunctionsRegistry(mathEngine.getFunctionsRegistry(), new EntityDao<>("org.solovyev.android.calculator.CalculatorModel_functions", application, Functions.class)); + this.operatorsRegistry = new OperatorsRegistry(mathEngine.getOperatorsRegistry(), new EntityDao<>(null, application, null)); + this.postfixFunctionsRegistry = new PostfixFunctionsRegistry(mathEngine.getPostfixFunctionsRegistry(), new EntityDao<>(null, application, null)); } private static void migratePreference(@Nonnull SharedPreferences preferences, @Nonnull BooleanPreference preference, @Nonnull String oldKey, @Nonnull SharedPreferences.Editor editor) { diff --git a/app/src/main/java/org/solovyev/android/calculator/FunctionsRegistry.java b/app/src/main/java/org/solovyev/android/calculator/FunctionsRegistry.java index ed294d78..ca3b5422 100644 --- a/app/src/main/java/org/solovyev/android/calculator/FunctionsRegistry.java +++ b/app/src/main/java/org/solovyev/android/calculator/FunctionsRegistry.java @@ -22,25 +22,28 @@ package org.solovyev.android.calculator; -import jscl.CustomFunctionCalculationException; -import jscl.math.function.CustomFunction; -import jscl.math.function.Function; -import jscl.math.function.IFunction; import org.solovyev.android.calculator.function.FunctionBuilderAdapter; import org.solovyev.android.calculator.model.AFunction; import org.solovyev.android.calculator.model.Functions; import org.solovyev.android.calculator.model.MathEntityBuilder; +import org.solovyev.android.calculator.model.EntityDao; import org.solovyev.common.JBuilder; import org.solovyev.common.math.MathRegistry; import org.solovyev.common.text.Strings; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.Map; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import jscl.CustomFunctionCalculationException; +import jscl.math.function.CustomFunction; +import jscl.math.function.Function; +import jscl.math.function.IFunction; + public class FunctionsRegistry extends BaseEntitiesRegistry { @Nonnull @@ -53,8 +56,8 @@ public class FunctionsRegistry extends BaseEntitiesRegistry } public FunctionsRegistry(@Nonnull MathRegistry functionsRegistry, - @Nonnull MathEntityDao mathEntityDao) { - super(functionsRegistry, FUNCTION_DESCRIPTION_PREFIX, mathEntityDao); + @Nonnull EntityDao entityDao) { + super(functionsRegistry, FUNCTION_DESCRIPTION_PREFIX, entityDao); } public static void saveFunction(@Nonnull EntitiesRegistry registry, @@ -138,7 +141,7 @@ public class FunctionsRegistry extends BaseEntitiesRegistry @Nonnull @Override - protected MathEntityPersistenceContainer createPersistenceContainer() { + protected PersistedEntitiesContainer createPersistenceContainer() { return new Functions(); } } diff --git a/app/src/main/java/org/solovyev/android/calculator/MathEntityDao.java b/app/src/main/java/org/solovyev/android/calculator/MathEntityDao.java deleted file mode 100644 index bd24ecfb..00000000 --- a/app/src/main/java/org/solovyev/android/calculator/MathEntityDao.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2013 serso aka se.solovyev - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * Contact details - * - * Email: se.solovyev@gmail.com - * Site: http://se.solovyev.org - */ - -package org.solovyev.android.calculator; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -/** - * User: serso - * Date: 10/7/12 - * Time: 6:43 PM - */ -public interface MathEntityDao { - - void save(@Nonnull MathEntityPersistenceContainer container); - - @Nullable - MathEntityPersistenceContainer load(); - - @Nullable - String getDescription(@Nonnull String descriptionId); -} diff --git a/app/src/main/java/org/solovyev/android/calculator/OperatorsRegistry.java b/app/src/main/java/org/solovyev/android/calculator/OperatorsRegistry.java index cc1f96ac..d1d2e419 100644 --- a/app/src/main/java/org/solovyev/android/calculator/OperatorsRegistry.java +++ b/app/src/main/java/org/solovyev/android/calculator/OperatorsRegistry.java @@ -22,15 +22,18 @@ package org.solovyev.android.calculator; -import jscl.math.operator.Operator; +import org.solovyev.android.calculator.model.EntityDao; import org.solovyev.common.JBuilder; import org.solovyev.common.math.MathRegistry; -import javax.annotation.Nonnull; import java.util.HashMap; import java.util.Map; -public class OperatorsRegistry extends BaseEntitiesRegistry { +import javax.annotation.Nonnull; + +import jscl.math.operator.Operator; + +public class OperatorsRegistry extends BaseEntitiesRegistry { @Nonnull private static final Map substitutes = new HashMap(); @@ -47,8 +50,8 @@ public class OperatorsRegistry extends BaseEntitiesRegistry functionsRegistry, - @Nonnull MathEntityDao mathEntityDao) { - super(functionsRegistry, OPERATOR_DESCRIPTION_PREFIX, mathEntityDao); + @Nonnull EntityDao entityDao) { + super(functionsRegistry, OPERATOR_DESCRIPTION_PREFIX, entityDao); } @Nonnull @@ -74,7 +77,7 @@ public class OperatorsRegistry extends BaseEntitiesRegistry createBuilder(@Nonnull MathPersistenceEntity entity) { + protected JBuilder createBuilder(@Nonnull PersistedEntity entity) { return null; //To change body of implemented methods use File | Settings | File Templates. } @@ -84,22 +87,13 @@ public class OperatorsRegistry extends BaseEntitiesRegistry createPersistenceContainer() { + protected PersistedEntitiesContainer createPersistenceContainer() { return null; //To change body of implemented methods use File | Settings | File Templates. } - - /* - ********************************************************************** - * - * STATIC - * - ********************************************************************** - */ - } diff --git a/app/src/main/java/org/solovyev/android/calculator/MathEntityPersistenceContainer.java b/app/src/main/java/org/solovyev/android/calculator/PersistedEntitiesContainer.java similarity index 82% rename from app/src/main/java/org/solovyev/android/calculator/MathEntityPersistenceContainer.java rename to app/src/main/java/org/solovyev/android/calculator/PersistedEntitiesContainer.java index c15fa83f..0e3bcb55 100644 --- a/app/src/main/java/org/solovyev/android/calculator/MathEntityPersistenceContainer.java +++ b/app/src/main/java/org/solovyev/android/calculator/PersistedEntitiesContainer.java @@ -24,13 +24,6 @@ package org.solovyev.android.calculator; import java.util.List; -/** - * User: serso - * Date: 12/22/11 - * Time: 5:03 PM - */ -public interface MathEntityPersistenceContainer { - - public List getEntities(); - +public interface PersistedEntitiesContainer { + List getEntities(); } diff --git a/app/src/main/java/org/solovyev/android/calculator/MathPersistenceEntity.java b/app/src/main/java/org/solovyev/android/calculator/PersistedEntity.java similarity index 89% rename from app/src/main/java/org/solovyev/android/calculator/MathPersistenceEntity.java rename to app/src/main/java/org/solovyev/android/calculator/PersistedEntity.java index 8956da59..0e5a98c6 100644 --- a/app/src/main/java/org/solovyev/android/calculator/MathPersistenceEntity.java +++ b/app/src/main/java/org/solovyev/android/calculator/PersistedEntity.java @@ -24,12 +24,7 @@ package org.solovyev.android.calculator; import javax.annotation.Nonnull; -/** - * User: serso - * Date: 12/22/11 - * Time: 5:27 PM - */ -public interface MathPersistenceEntity { +public interface PersistedEntity { @Nonnull String getName(); diff --git a/app/src/main/java/org/solovyev/android/calculator/PostfixFunctionsRegistry.java b/app/src/main/java/org/solovyev/android/calculator/PostfixFunctionsRegistry.java index cb2cfae0..9af51fd1 100644 --- a/app/src/main/java/org/solovyev/android/calculator/PostfixFunctionsRegistry.java +++ b/app/src/main/java/org/solovyev/android/calculator/PostfixFunctionsRegistry.java @@ -22,15 +22,18 @@ package org.solovyev.android.calculator; -import jscl.math.operator.Operator; +import org.solovyev.android.calculator.model.EntityDao; import org.solovyev.common.JBuilder; import org.solovyev.common.math.MathRegistry; -import javax.annotation.Nonnull; import java.util.HashMap; import java.util.Map; -public class PostfixFunctionsRegistry extends BaseEntitiesRegistry { +import javax.annotation.Nonnull; + +import jscl.math.operator.Operator; + +public class PostfixFunctionsRegistry extends BaseEntitiesRegistry { @Nonnull private static final Map substitutes = new HashMap(); @@ -45,8 +48,8 @@ public class PostfixFunctionsRegistry extends BaseEntitiesRegistry functionsRegistry, - @Nonnull MathEntityDao mathEntityDao) { - super(functionsRegistry, POSTFIX_FUNCTION_DESCRIPTION_PREFIX, mathEntityDao); + @Nonnull EntityDao entityDao) { + super(functionsRegistry, POSTFIX_FUNCTION_DESCRIPTION_PREFIX, entityDao); } @@ -73,7 +76,7 @@ public class PostfixFunctionsRegistry extends BaseEntitiesRegistry createBuilder(@Nonnull MathPersistenceEntity entity) { + protected JBuilder createBuilder(@Nonnull PersistedEntity entity) { throw new UnsupportedOperationException(); } @@ -83,13 +86,13 @@ public class PostfixFunctionsRegistry extends BaseEntitiesRegistry createPersistenceContainer() { + protected PersistedEntitiesContainer createPersistenceContainer() { throw new UnsupportedOperationException(); } } diff --git a/app/src/main/java/org/solovyev/android/calculator/VarsRegistry.java b/app/src/main/java/org/solovyev/android/calculator/VarsRegistry.java index 24cdda63..b37456a4 100644 --- a/app/src/main/java/org/solovyev/android/calculator/VarsRegistry.java +++ b/app/src/main/java/org/solovyev/android/calculator/VarsRegistry.java @@ -22,19 +22,22 @@ package org.solovyev.android.calculator; -import jscl.math.function.IConstant; import org.solovyev.android.calculator.model.MathEntityBuilder; +import org.solovyev.android.calculator.model.EntityDao; import org.solovyev.android.calculator.model.Var; import org.solovyev.android.calculator.model.Vars; import org.solovyev.common.JBuilder; import org.solovyev.common.math.MathEntity; import org.solovyev.common.math.MathRegistry; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.HashMap; import java.util.Map; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import jscl.math.function.IConstant; + public class VarsRegistry extends BaseEntitiesRegistry { @Nonnull @@ -52,8 +55,8 @@ public class VarsRegistry extends BaseEntitiesRegistry { } public VarsRegistry(@Nonnull MathRegistry mathRegistry, - @Nonnull MathEntityDao mathEntityDao) { - super(mathRegistry, "c_var_description_", mathEntityDao); + @Nonnull EntityDao entityDao) { + super(mathRegistry, "c_var_description_", entityDao); } public static void saveVariable(@Nonnull EntitiesRegistry registry, @@ -97,7 +100,7 @@ public class VarsRegistry extends BaseEntitiesRegistry { @Nonnull @Override - protected MathEntityPersistenceContainer createPersistenceContainer() { + protected PersistedEntitiesContainer createPersistenceContainer() { return new Vars(); } diff --git a/app/src/main/java/org/solovyev/android/calculator/model/AFunction.java b/app/src/main/java/org/solovyev/android/calculator/model/AFunction.java index 22d0c089..47c2617b 100644 --- a/app/src/main/java/org/solovyev/android/calculator/model/AFunction.java +++ b/app/src/main/java/org/solovyev/android/calculator/model/AFunction.java @@ -22,29 +22,31 @@ package org.solovyev.android.calculator.model; -import jscl.math.function.IFunction; import org.simpleframework.xml.Element; import org.simpleframework.xml.ElementList; import org.simpleframework.xml.Root; import org.simpleframework.xml.Transient; import org.solovyev.android.calculator.CalculatorParseException; import org.solovyev.android.calculator.Locator; -import org.solovyev.android.calculator.MathPersistenceEntity; +import org.solovyev.android.calculator.PersistedEntity; import org.solovyev.common.math.MathEntity; import org.solovyev.common.msg.Message; import org.solovyev.common.msg.MessageLevel; import org.solovyev.common.text.Strings; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.io.Serializable; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Locale; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import jscl.math.function.IFunction; + @Root(name = "function") -public class AFunction implements IFunction, MathPersistenceEntity, Serializable { +public class AFunction implements IFunction, PersistedEntity, Serializable { @Transient private Integer id; diff --git a/app/src/main/java/org/solovyev/android/calculator/model/AndroidMathEntityDao.java b/app/src/main/java/org/solovyev/android/calculator/model/EntityDao.java similarity index 78% rename from app/src/main/java/org/solovyev/android/calculator/model/AndroidMathEntityDao.java rename to app/src/main/java/org/solovyev/android/calculator/model/EntityDao.java index 23a9ec89..5322f42d 100644 --- a/app/src/main/java/org/solovyev/android/calculator/model/AndroidMathEntityDao.java +++ b/app/src/main/java/org/solovyev/android/calculator/model/EntityDao.java @@ -27,21 +27,19 @@ import android.content.Context; import android.content.SharedPreferences; import android.content.res.Resources; import android.preference.PreferenceManager; + import org.simpleframework.xml.Serializer; import org.simpleframework.xml.core.Persister; import org.solovyev.android.calculator.CalculatorApplication; -import org.solovyev.android.calculator.MathEntityDao; -import org.solovyev.android.calculator.MathEntityPersistenceContainer; -import org.solovyev.android.calculator.MathPersistenceEntity; +import org.solovyev.android.calculator.PersistedEntitiesContainer; +import org.solovyev.android.calculator.PersistedEntity; + +import java.io.StringWriter; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.io.StringWriter; -public class AndroidMathEntityDao implements MathEntityDao { - - @Nonnull - private static final String TAG = AndroidMathEntityDao.class.getSimpleName(); +public class EntityDao { @Nullable private final String preferenceString; @@ -50,18 +48,17 @@ public class AndroidMathEntityDao implements Ma private final Context context; @Nullable - private final Class> persistenceContainerClass; + private final Class> persistenceContainerClass; - public AndroidMathEntityDao(@Nullable String preferenceString, - @Nonnull Application application, - @Nullable Class> persistenceContainerClass) { + public EntityDao(@Nullable String preferenceString, + @Nonnull Application application, + @Nullable Class> persistenceContainerClass) { this.preferenceString = preferenceString; this.context = application; this.persistenceContainerClass = persistenceContainerClass; } - @Override - public void save(@Nonnull MathEntityPersistenceContainer container) { + public void save(@Nonnull PersistedEntitiesContainer container) { if (preferenceString != null) { final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context); final SharedPreferences.Editor editor = settings.edit(); @@ -81,8 +78,7 @@ public class AndroidMathEntityDao implements Ma } @Nullable - @Override - public MathEntityPersistenceContainer load() { + public PersistedEntitiesContainer load() { if (persistenceContainerClass != null && preferenceString != null) { final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); diff --git a/app/src/main/java/org/solovyev/android/calculator/model/Functions.java b/app/src/main/java/org/solovyev/android/calculator/model/Functions.java index 630383d1..88b3479f 100644 --- a/app/src/main/java/org/solovyev/android/calculator/model/Functions.java +++ b/app/src/main/java/org/solovyev/android/calculator/model/Functions.java @@ -24,18 +24,13 @@ package org.solovyev.android.calculator.model; import org.simpleframework.xml.ElementList; import org.simpleframework.xml.Root; -import org.solovyev.android.calculator.MathEntityPersistenceContainer; +import org.solovyev.android.calculator.PersistedEntitiesContainer; import java.util.ArrayList; import java.util.List; -/** - * User: serso - * Date: 12/22/11 - * Time: 5:15 PM - */ @Root -public class Functions implements MathEntityPersistenceContainer { +public class Functions implements PersistedEntitiesContainer { @ElementList(type = AFunction.class) private List functions = new ArrayList(); diff --git a/app/src/main/java/org/solovyev/android/calculator/model/Var.java b/app/src/main/java/org/solovyev/android/calculator/model/Var.java index f055b9a9..7dd201da 100644 --- a/app/src/main/java/org/solovyev/android/calculator/model/Var.java +++ b/app/src/main/java/org/solovyev/android/calculator/model/Var.java @@ -25,7 +25,7 @@ package org.solovyev.android.calculator.model; import org.simpleframework.xml.Element; import org.simpleframework.xml.Root; import org.simpleframework.xml.Transient; -import org.solovyev.android.calculator.MathPersistenceEntity; +import org.solovyev.android.calculator.PersistedEntity; import org.solovyev.common.JBuilder; import org.solovyev.common.math.MathEntity; import org.solovyev.common.text.Strings; @@ -44,7 +44,7 @@ import jscl.math.function.IConstant; */ @Root -public class Var implements IConstant, MathPersistenceEntity { +public class Var implements IConstant, PersistedEntity { @Transient private Integer id; diff --git a/app/src/main/java/org/solovyev/android/calculator/model/Vars.java b/app/src/main/java/org/solovyev/android/calculator/model/Vars.java index 974bedcf..79967bd7 100644 --- a/app/src/main/java/org/solovyev/android/calculator/model/Vars.java +++ b/app/src/main/java/org/solovyev/android/calculator/model/Vars.java @@ -24,7 +24,7 @@ package org.solovyev.android.calculator.model; import org.simpleframework.xml.ElementList; import org.simpleframework.xml.Root; -import org.solovyev.android.calculator.MathEntityPersistenceContainer; +import org.solovyev.android.calculator.PersistedEntitiesContainer; import java.util.ArrayList; import java.util.List; @@ -36,7 +36,7 @@ import java.util.List; */ @Root -public class Vars implements MathEntityPersistenceContainer { +public class Vars implements PersistedEntitiesContainer { @ElementList(type = Var.class) private List vars = new ArrayList(); diff --git a/app/src/test/java/org/solovyev/android/calculator/CalculatorTestUtils.java b/app/src/test/java/org/solovyev/android/calculator/CalculatorTestUtils.java index 169c7485..24a78bef 100644 --- a/app/src/test/java/org/solovyev/android/calculator/CalculatorTestUtils.java +++ b/app/src/test/java/org/solovyev/android/calculator/CalculatorTestUtils.java @@ -31,6 +31,7 @@ import org.mockito.Mockito; import org.robolectric.fakes.RoboSharedPreferences; import org.solovyev.android.calculator.jscl.JsclOperation; import org.solovyev.android.calculator.language.Languages; +import org.solovyev.android.calculator.model.EntityDao; import org.solovyev.android.calculator.plot.CalculatorPlotter; import java.io.ByteArrayInputStream; @@ -98,14 +99,14 @@ public class CalculatorTestUtils { @Nonnull static Engine newCalculatorEngine() { - final MathEntityDao mathEntityDao = Mockito.mock(MathEntityDao.class); + final EntityDao entityDao = Mockito.mock(EntityDao.class); final JsclMathEngine jsclEngine = JsclMathEngine.getInstance(); - final VarsRegistry varsRegistry = new VarsRegistry(jsclEngine.getConstantsRegistry(), mathEntityDao); - final FunctionsRegistry functionsRegistry = new FunctionsRegistry(jsclEngine.getFunctionsRegistry(), mathEntityDao); - final OperatorsRegistry operatorsRegistry = new OperatorsRegistry(jsclEngine.getOperatorsRegistry(), mathEntityDao); - final PostfixFunctionsRegistry postfixFunctionsRegistry = new PostfixFunctionsRegistry(jsclEngine.getPostfixFunctionsRegistry(), mathEntityDao); + final VarsRegistry varsRegistry = new VarsRegistry(jsclEngine.getConstantsRegistry(), entityDao); + final FunctionsRegistry functionsRegistry = new FunctionsRegistry(jsclEngine.getFunctionsRegistry(), entityDao); + final OperatorsRegistry operatorsRegistry = new OperatorsRegistry(jsclEngine.getOperatorsRegistry(), entityDao); + final PostfixFunctionsRegistry postfixFunctionsRegistry = new PostfixFunctionsRegistry(jsclEngine.getPostfixFunctionsRegistry(), entityDao); return new Engine(jsclEngine, varsRegistry, functionsRegistry, operatorsRegistry, postfixFunctionsRegistry); }