diff --git a/calculatorpp-core/src/main/java/org/solovyev/android/calculator/ListCalculatorEventContainer.java b/calculatorpp-core/src/main/java/org/solovyev/android/calculator/ListCalculatorEventContainer.java index f977eedf..f344b9cf 100644 --- a/calculatorpp-core/src/main/java/org/solovyev/android/calculator/ListCalculatorEventContainer.java +++ b/calculatorpp-core/src/main/java/org/solovyev/android/calculator/ListCalculatorEventContainer.java @@ -39,10 +39,10 @@ public class ListCalculatorEventContainer implements CalculatorEventContainer { public void fireCalculatorEvents(@NotNull List calculatorEvents) { final List listeners = this.listeners.getListeners(); - final CalculatorLogger logger = CalculatorLocatorImpl.getInstance().getLogger(); + //final CalculatorLogger logger = CalculatorLocatorImpl.getInstance().getLogger(); for (CalculatorEvent e : calculatorEvents) { - CalculatorLocatorImpl.getInstance().getLogger().debug(TAG, "Event fired: " + e.getCalculatorEventType()); + //CalculatorLocatorImpl.getInstance().getLogger().debug(TAG, "Event fired: " + e.getCalculatorEventType()); for (CalculatorEventListener listener : listeners) { /*long startTime = System.currentTimeMillis();*/ listener.onCalculatorEvent(e.getCalculatorEventData(), e.getCalculatorEventType(), e.getData()); diff --git a/calculatorpp-core/src/main/java/org/solovyev/android/calculator/ToJsclTextProcessor.java b/calculatorpp-core/src/main/java/org/solovyev/android/calculator/ToJsclTextProcessor.java index efe9d942..1c4f94f2 100644 --- a/calculatorpp-core/src/main/java/org/solovyev/android/calculator/ToJsclTextProcessor.java +++ b/calculatorpp-core/src/main/java/org/solovyev/android/calculator/ToJsclTextProcessor.java @@ -6,11 +6,12 @@ package org.solovyev.android.calculator; +import jscl.math.function.Function; import jscl.math.function.IConstant; import org.jetbrains.annotations.NotNull; +import org.solovyev.android.calculator.math.MathType; import org.solovyev.android.calculator.text.TextProcessor; import org.solovyev.common.StartsWithFinder; -import org.solovyev.android.calculator.math.MathType; import org.solovyev.common.collections.CollectionsUtils; import org.solovyev.common.msg.MessageType; @@ -72,7 +73,17 @@ public class ToJsclTextProcessor implements TextProcessor 0 ) { + throw new CalculatorParseException(i, s, new CalculatorMessage(CalculatorMessages.msg_005, MessageType.error, mathTypeBefore.getMatch())); + } + } + + i = mathTypeResult.processToJscl(result, i); } return result; } diff --git a/calculatorpp-core/src/test/java/org/solovyev/android/calculator/model/AndroidCalculatorEngineTest.java b/calculatorpp-core/src/test/java/org/solovyev/android/calculator/model/AndroidCalculatorEngineTest.java index 44692471..b49c6aef 100644 --- a/calculatorpp-core/src/test/java/org/solovyev/android/calculator/model/AndroidCalculatorEngineTest.java +++ b/calculatorpp-core/src/test/java/org/solovyev/android/calculator/model/AndroidCalculatorEngineTest.java @@ -207,10 +207,10 @@ public class AndroidCalculatorEngineTest extends AbstractCalculatorTest { try { cm.setNumeralBase(NumeralBase.hex); - CalculatorTestUtils.assertEval("E/F", "0x:E/0x:F"); - CalculatorTestUtils.assertEval("E/F", cm.simplify( "0x:E/0x:F")); - CalculatorTestUtils.assertEval("E/F", "E/F"); - CalculatorTestUtils.assertEval("E/F", cm.simplify( "E/F")); + CalculatorTestUtils.assertEval("0.EE E", "0x:E/0x:F"); + CalculatorTestUtils.assertEval("0.EE E", cm.simplify( "0x:E/0x:F")); + CalculatorTestUtils.assertEval("0.EE E", "E/F"); + CalculatorTestUtils.assertEval("0.EE E", cm.simplify( "E/F")); } finally { cm.setNumeralBase(NumeralBase.dec); } @@ -396,7 +396,7 @@ public class AndroidCalculatorEngineTest extends AbstractCalculatorTest { try{ cm.setNumeralBase(NumeralBase.bin); CalculatorTestUtils.assertEval("101", "10+11"); - CalculatorTestUtils.assertEval("10/11", "10/11"); + CalculatorTestUtils.assertEval("0.101", "10/11"); cm.setNumeralBase(NumeralBase.hex); CalculatorTestUtils.assertEval("63 7B", "56CE+CAD"); diff --git a/calculatorpp-core/src/test/java/org/solovyev/android/calculator/model/FunctionsTest.java b/calculatorpp-core/src/test/java/org/solovyev/android/calculator/model/FunctionsTest.java index 952df63f..02787d39 100644 --- a/calculatorpp-core/src/test/java/org/solovyev/android/calculator/model/FunctionsTest.java +++ b/calculatorpp-core/src/test/java/org/solovyev/android/calculator/model/FunctionsTest.java @@ -6,9 +6,11 @@ import org.hamcrest.Description; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.junit.Assert; +import org.junit.Before; import org.junit.Test; import org.simpleframework.xml.Serializer; import org.simpleframework.xml.core.Persister; +import org.solovyev.android.calculator.CalculatorTestUtils; import org.solovyev.common.equals.CollectionEqualizer; import org.solovyev.common.equals.EqualsUtils; import org.solovyev.common.text.StringUtils; @@ -58,6 +60,11 @@ public class FunctionsTest { " \n" + ""; + @Before + public void setUp() throws Exception { + CalculatorTestUtils.staticSetUp(); + } + @Test public void testXml() throws Exception { final Functions in = new Functions(); diff --git a/calculatorpp/project.properties b/calculatorpp/project.properties index 41522aac..c0cbfcbe 100644 --- a/calculatorpp/project.properties +++ b/calculatorpp/project.properties @@ -9,19 +9,19 @@ # Project target. target=android-15 -android.library.reference.1=gen-external-apklibs/org.solovyev.android_android-common-all_1.0.5-SNAPSHOT -android.library.reference.2=gen-external-apklibs/org.solovyev.android_android-common-ads_1.0.5-SNAPSHOT -android.library.reference.3=gen-external-apklibs/org.solovyev.android_android-common-core_1.0.5-SNAPSHOT -android.library.reference.4=gen-external-apklibs/org.solovyev.android_android-common-billing_1.0.5-SNAPSHOT -android.library.reference.5=gen-external-apklibs/org.solovyev.android_android-common-db_1.0.5-SNAPSHOT -android.library.reference.6=gen-external-apklibs/org.solovyev.android_android-common-http_1.0.5-SNAPSHOT -android.library.reference.7=gen-external-apklibs/org.solovyev.android_android-common-list_1.0.5-SNAPSHOT -android.library.reference.8=gen-external-apklibs/org.solovyev.android_android-common-view_1.0.5-SNAPSHOT -android.library.reference.9=gen-external-apklibs/org.solovyev.android_android-common-preferences_1.0.5-SNAPSHOT -android.library.reference.10=gen-external-apklibs/org.solovyev.android_android-common-menu_1.0.5-SNAPSHOT -android.library.reference.11=gen-external-apklibs/org.solovyev.android_android-common-other_1.0.5-SNAPSHOT -android.library.reference.12=gen-external-apklibs/org.solovyev.android_android-common-sherlock_1.0.5-SNAPSHOT +android.library.reference.1=gen-external-apklibs/org.solovyev.android_android-common-all_1.0.5 +android.library.reference.2=gen-external-apklibs/org.solovyev.android_android-common-ads_1.0.5 +android.library.reference.3=gen-external-apklibs/org.solovyev.android_android-common-core_1.0.5 +android.library.reference.4=gen-external-apklibs/org.solovyev.android_android-common-billing_1.0.5 +android.library.reference.5=gen-external-apklibs/org.solovyev.android_android-common-db_1.0.5 +android.library.reference.6=gen-external-apklibs/org.solovyev.android_android-common-http_1.0.5 +android.library.reference.7=gen-external-apklibs/org.solovyev.android_android-common-list_1.0.5 +android.library.reference.8=gen-external-apklibs/org.solovyev.android_android-common-view_1.0.5 +android.library.reference.9=gen-external-apklibs/org.solovyev.android_android-common-preferences_1.0.5 +android.library.reference.10=gen-external-apklibs/org.solovyev.android_android-common-menu_1.0.5 +android.library.reference.11=gen-external-apklibs/org.solovyev.android_android-common-other_1.0.5 +android.library.reference.12=gen-external-apklibs/org.solovyev.android_android-common-sherlock_1.0.5 android.library.reference.13=gen-external-apklibs/com.actionbarsherlock_actionbarsherlock_4.2.0 -android.library.reference.14=gen-external-apklibs/org.solovyev.android_android-common-keyboard_1.0.5-SNAPSHOT +android.library.reference.14=gen-external-apklibs/org.solovyev.android_android-common-keyboard_1.0.5