diff --git a/pom.xml b/pom.xml
index 9beda5c1..226bf92d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -20,7 +20,7 @@
org.solovyev
common
- 0.1
+ 0.2
diff --git a/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java b/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java
index 99deefe5..8d5eccb9 100644
--- a/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java
+++ b/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java
@@ -16,8 +16,9 @@ import bsh.EvalError;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.solovyev.android.view.*;
-import org.solovyev.util.StringUtils;
-import org.solovyev.util.math.Point2d;
+import org.solovyev.common.utils.Point2d;
+import org.solovyev.common.utils.StringUtils;
+import org.solovyev.common.utils.history.HistoryAction;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
diff --git a/src/main/java/org/solovyev/android/calculator/CalculatorModel.java b/src/main/java/org/solovyev/android/calculator/CalculatorModel.java
index dd483038..345d606e 100644
--- a/src/main/java/org/solovyev/android/calculator/CalculatorModel.java
+++ b/src/main/java/org/solovyev/android/calculator/CalculatorModel.java
@@ -1,11 +1,9 @@
package org.solovyev.android.calculator;
-import android.util.Log;
-import android.widget.Toast;
import bsh.EvalError;
import bsh.Interpreter;
import org.jetbrains.annotations.NotNull;
-import org.solovyev.util.math.MathUtils;
+import org.solovyev.common.utils.MathUtils;
/**
* User: serso
diff --git a/src/main/java/org/solovyev/android/calculator/CalculatorView.java b/src/main/java/org/solovyev/android/calculator/CalculatorView.java
index 362c918c..8eb08744 100644
--- a/src/main/java/org/solovyev/android/calculator/CalculatorView.java
+++ b/src/main/java/org/solovyev/android/calculator/CalculatorView.java
@@ -13,12 +13,13 @@ import android.widget.Toast;
import bsh.EvalError;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import org.solovyev.util.StringUtils;
-import org.solovyev.util.date.MutableObject;
+import org.solovyev.common.utils.MutableObject;
+import org.solovyev.common.utils.StringUtils;
+import org.solovyev.common.utils.history.HistoryAction;
+import org.solovyev.common.utils.history.HistoryHelper;
+import org.solovyev.common.utils.history.SimpleHistoryHelper;
import org.solovyev.util.math.MathEntityType;
-import java.util.Date;
-
/**
* User: serso
* Date: 9/12/11
@@ -111,7 +112,7 @@ public class CalculatorView implements CursorControl{
// do only if nothing was post delayed before current instance was posted
if (currentRunner.getObject() == this) {
// actually nothing shall be logged while text operations are done
- evaluate(editorStateAfter, false);
+ evaluate(editorStateAfter, true);
if (history.isRedoAvailable()) {
history.redo(getCurrentHistoryState());
diff --git a/src/main/java/org/solovyev/android/calculator/DragButtonCalibrationActivity.java b/src/main/java/org/solovyev/android/calculator/DragButtonCalibrationActivity.java
index 35edec09..b6369016 100644
--- a/src/main/java/org/solovyev/android/calculator/DragButtonCalibrationActivity.java
+++ b/src/main/java/org/solovyev/android/calculator/DragButtonCalibrationActivity.java
@@ -16,8 +16,8 @@ import org.solovyev.android.view.*;
import org.solovyev.common.collections.ManyValuedHashMap;
import org.solovyev.common.collections.ManyValuedMap;
import org.solovyev.common.utils.Interval;
-import org.solovyev.util.math.MathUtils;
-import org.solovyev.util.math.Point2d;
+import org.solovyev.common.utils.MathUtils;
+import org.solovyev.common.utils.Point2d;
import java.util.ArrayList;
import java.util.HashMap;
diff --git a/src/main/java/org/solovyev/android/calculator/HistoryAction.java b/src/main/java/org/solovyev/android/calculator/HistoryAction.java
deleted file mode 100644
index 8377d0e8..00000000
--- a/src/main/java/org/solovyev/android/calculator/HistoryAction.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package org.solovyev.android.calculator;
-
-public enum HistoryAction {
-
- redo,
- undo;
-
-}
diff --git a/src/main/java/org/solovyev/android/calculator/HistoryHelper.java b/src/main/java/org/solovyev/android/calculator/HistoryHelper.java
deleted file mode 100644
index 3c4bad6a..00000000
--- a/src/main/java/org/solovyev/android/calculator/HistoryHelper.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.solovyev.android.calculator;
-
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-public interface HistoryHelper {
-
- boolean isUndoAvailable();
-
- @Nullable
- T undo (@Nullable T currentState);
-
- boolean isRedoAvailable();
-
- @Nullable
- T redo (@Nullable T currentState);
-
- boolean isActionAvailable(@NotNull HistoryAction historyAction);
-
- @Nullable
- T doAction(@NotNull HistoryAction historyAction, @Nullable T currentState);
-
- void addState(@Nullable T currentState);
-}
diff --git a/src/main/java/org/solovyev/android/calculator/SimpleHistoryHelper.java b/src/main/java/org/solovyev/android/calculator/SimpleHistoryHelper.java
deleted file mode 100644
index 04df8fc1..00000000
--- a/src/main/java/org/solovyev/android/calculator/SimpleHistoryHelper.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package org.solovyev.android.calculator;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-public class SimpleHistoryHelper implements HistoryHelper {
-
- private List history = new ArrayList();
-
- private int currentStateIndex = -1;
-
- @Override
- public T undo(@Nullable T currentState) {
- if ( !isUndoAvailable() ) {
- throw new IndexOutOfBoundsException();
- }
-
- currentStateIndex--;
-
- return history.get(currentStateIndex);
- }
-
- @Override
- public T redo(@Nullable T currentState) {
- if (!isRedoAvailable()) {
- throw new IndexOutOfBoundsException();
- }
- currentStateIndex++;
- return history.get(currentStateIndex);
- }
-
- @Override
- public void addState(@Nullable T currentState) {
- if (currentStateIndex == history.size() - 1) {
- currentStateIndex++;
- history.add(currentState);
- } else {
- assert currentStateIndex < history.size() - 1 : "Invalid history state index!";
- currentStateIndex++;
- history.set(currentStateIndex, currentState);
- while( history.size() > currentStateIndex + 1 ) {
- history.remove(history.size() - 1);
- }
- }
- }
-
- @Override
- public boolean isUndoAvailable() {
- return currentStateIndex > 0;
- }
-
- @Override
- public boolean isRedoAvailable() {
- return currentStateIndex < history.size() - 1;
- }
-
- @Override
- public boolean isActionAvailable(@NotNull HistoryAction historyAction) {
- boolean result = false;
-
- switch (historyAction) {
- case undo:
- result = isUndoAvailable();
- break;
- case redo:
- result = isRedoAvailable();
- break;
- }
-
- return result;
- }
-
- @Override
- public T doAction(@NotNull HistoryAction historyAction, @Nullable T currentState) {
- T result = null;
-
- switch (historyAction) {
- case undo:
- result = undo(currentState);
- break;
- case redo:
- result = redo(currentState);
- break;
- }
-
- return result;
- }
-}
diff --git a/src/main/java/org/solovyev/android/view/ColorButton.java b/src/main/java/org/solovyev/android/view/ColorButton.java
index 449d0e64..89ba575b 100644
--- a/src/main/java/org/solovyev/android/view/ColorButton.java
+++ b/src/main/java/org/solovyev/android/view/ColorButton.java
@@ -17,15 +17,15 @@
package org.solovyev.android.view;
import android.content.Context;
+import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.util.AttributeSet;
-import android.widget.Button;
import android.view.MotionEvent;
-import android.content.res.Resources;
+import android.widget.Button;
import org.jetbrains.annotations.NotNull;
-import org.solovyev.util.math.Point2d;
+import org.solovyev.common.utils.Point2d;
/**
* NOTE: copied from com.android.calculator2.ColorButton
diff --git a/src/main/java/org/solovyev/android/view/DirectionDragButton.java b/src/main/java/org/solovyev/android/view/DirectionDragButton.java
index 312f1ecd..64164605 100644
--- a/src/main/java/org/solovyev/android/view/DirectionDragButton.java
+++ b/src/main/java/org/solovyev/android/view/DirectionDragButton.java
@@ -8,9 +8,8 @@ import android.text.TextPaint;
import android.util.AttributeSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import org.solovyev.android.calculator.R;
-import org.solovyev.util.StringUtils;
-import org.solovyev.util.math.Point2d;
+import org.solovyev.common.utils.Point2d;
+import org.solovyev.common.utils.StringUtils;
/**
* User: serso
diff --git a/src/main/java/org/solovyev/android/view/DragButton.java b/src/main/java/org/solovyev/android/view/DragButton.java
index 282e9c92..65fabfe2 100644
--- a/src/main/java/org/solovyev/android/view/DragButton.java
+++ b/src/main/java/org/solovyev/android/view/DragButton.java
@@ -1,16 +1,15 @@
package org.solovyev.android.view;
-import android.os.Handler;
-import android.widget.Button;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.solovyev.util.math.Point2d;
-
import android.content.Context;
+import android.os.Handler;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
+import android.widget.Button;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.solovyev.common.utils.Point2d;
public class DragButton extends ColorButton {
diff --git a/src/main/java/org/solovyev/android/view/DragEvent.java b/src/main/java/org/solovyev/android/view/DragEvent.java
index 4f49bd29..a293edb9 100644
--- a/src/main/java/org/solovyev/android/view/DragEvent.java
+++ b/src/main/java/org/solovyev/android/view/DragEvent.java
@@ -1,9 +1,8 @@
package org.solovyev.android.view;
-import org.jetbrains.annotations.NotNull;
-import org.solovyev.util.math.Point2d;
-
import android.view.MotionEvent;
+import org.jetbrains.annotations.NotNull;
+import org.solovyev.common.utils.Point2d;
public class DragEvent {
diff --git a/src/main/java/org/solovyev/android/view/SimpleOnDragListener.java b/src/main/java/org/solovyev/android/view/SimpleOnDragListener.java
index bf186d1b..26a664df 100644
--- a/src/main/java/org/solovyev/android/view/SimpleOnDragListener.java
+++ b/src/main/java/org/solovyev/android/view/SimpleOnDragListener.java
@@ -1,13 +1,12 @@
package org.solovyev.android.view;
-import org.jetbrains.annotations.NotNull;
-import org.solovyev.android.calculator.DragButtonCalibrationActivity;
-import org.solovyev.common.utils.Interval;
-import org.solovyev.util.math.MathUtils;
-import org.solovyev.util.math.Point2d;
-
import android.util.Log;
import android.view.MotionEvent;
+import org.jetbrains.annotations.NotNull;
+import org.solovyev.android.calculator.DragButtonCalibrationActivity;
+import org.solovyev.common.utils.Interval;
+import org.solovyev.common.utils.MathUtils;
+import org.solovyev.common.utils.Point2d;
import java.util.Map;
diff --git a/src/main/java/org/solovyev/util/StringUtils.java b/src/main/java/org/solovyev/util/StringUtils.java
deleted file mode 100644
index 62dda574..00000000
--- a/src/main/java/org/solovyev/util/StringUtils.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.solovyev.util;
-
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-public class StringUtils {
-
- public static boolean isEmpty ( @Nullable CharSequence s ){
- return s == null || s.length() == 0;
- }
-
- @NotNull
- public static String getNotEmpty ( @Nullable CharSequence s, @NotNull String defaultValue ){
- return isEmpty(s) ? defaultValue : s.toString();
- }
-}
-
diff --git a/src/main/java/org/solovyev/util/date/DateUtils.java b/src/main/java/org/solovyev/util/date/DateUtils.java
deleted file mode 100644
index f7a7ab7f..00000000
--- a/src/main/java/org/solovyev/util/date/DateUtils.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package org.solovyev.util.date;
-
-public class DateUtils {
-
- public static long MS_IN_SECONDS = 1000l;
-
- public static long msToSeconds (long ms) {
- return ms / 1000l;
- }
-
-}
diff --git a/src/main/java/org/solovyev/util/date/MutableObject.java b/src/main/java/org/solovyev/util/date/MutableObject.java
deleted file mode 100644
index 733f1e67..00000000
--- a/src/main/java/org/solovyev/util/date/MutableObject.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.solovyev.util.date;
-
-/**
- * User: serso
- * Date: 9/13/11
- * Time: 6:46 PM
- */
-public class MutableObject {
-
- private T object;
-
- public MutableObject() {
- }
-
- public MutableObject(T object) {
- this.object = object;
- }
-
- public T getObject() {
- return object;
- }
-
- public void setObject(T object) {
- this.object = object;
- }
-}
diff --git a/src/main/java/org/solovyev/util/math/MathUtils.java b/src/main/java/org/solovyev/util/math/MathUtils.java
deleted file mode 100644
index cea513f8..00000000
--- a/src/main/java/org/solovyev/util/math/MathUtils.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package org.solovyev.util.math;
-
-import org.jetbrains.annotations.NotNull;
-
-import java.util.List;
-
-public class MathUtils {
-
- public static final float MIN_AMOUNT = 0.05f;
-
- public static double round(@NotNull Double value, int numberOfFractionDigits) {
- double roundFactor = Math.pow(10, numberOfFractionDigits);
-
- if (value < Double.MAX_VALUE / roundFactor) {
- return ((double)Math.round(value * roundFactor)) / roundFactor;
- } else {
- return value;
- }
- }
-
- public static float getDistance(@NotNull Point2d startPoint,
- @NotNull Point2d endPoint) {
- return getNorm(subtract(endPoint, startPoint));
- }
-
- public static Point2d subtract(@NotNull Point2d p1, @NotNull Point2d p2) {
- return new Point2d(p1.getX() - p2.getX(), p1.getY() - p2.getY());
- }
-
- public static Point2d sum(@NotNull Point2d p1, @NotNull Point2d p2) {
- return new Point2d(p1.getX() + p2.getX(), p1.getY() + p2.getY());
- }
-
- public static float getNorm(@NotNull Point2d point) {
- return (float) Math.pow(
- Math.pow(point.getX(), 2) + Math.pow(point.getY(), 2), 0.5);
- }
-
- public static float getAngle(@NotNull Point2d startPoint,
- @NotNull Point2d axisEndPoint, @NotNull Point2d endPoint) {
- final Point2d axisVector = subtract(axisEndPoint, startPoint);
- final Point2d vector = subtract(endPoint, startPoint);
-
- double a_2 = Math.pow(getDistance(vector, axisVector), 2);
- double b = getNorm(vector);
- double b_2 = Math.pow(b, 2);
- double c = getNorm(axisVector);
- double c_2 = Math.pow(c, 2);
-
- return (float) Math.acos((-a_2 + b_2 + c_2) / (2 * b * c));
- }
-
- public static double countMean(@NotNull List objects) {
-
- double sum = 0d;
- for (Double object : objects) {
- sum += object;
- }
-
- return objects.size() == 0 ? 0d : (sum / objects.size());
- }
-
- public static double countStandardDeviation(@NotNull Double mean, @NotNull List objects) {
- double sum = 0d;
-
- for (Double object : objects) {
- sum += Math.pow(object - mean, 2);
- }
-
- return objects.size() == 0 ? 0d : Math.sqrt(sum / objects.size());
- }
-
- public static StatData getStatData(@NotNull List objects) {
-
- final double mean = countMean(objects);
- final double standardDeviation = countStandardDeviation(mean, objects);
-
- return new StatData(mean, standardDeviation);
- }
-
- public static class StatData {
-
- private final double mean;
-
- private final double standardDeviation;
-
- public StatData(double mean, double standardDeviation) {
- this.mean = mean;
- this.standardDeviation = standardDeviation;
- }
-
- public double getMean() {
- return mean;
- }
-
- public double getStandardDeviation() {
- return standardDeviation;
- }
-
- }
-
-}
diff --git a/src/main/java/org/solovyev/util/math/Point2d.java b/src/main/java/org/solovyev/util/math/Point2d.java
deleted file mode 100644
index cbd6a09a..00000000
--- a/src/main/java/org/solovyev/util/math/Point2d.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package org.solovyev.util.math;
-
-public class Point2d {
-
- private float x = 0;
-
- private float y = 0;
-
- public Point2d() {
- }
-
- public Point2d( float x, float y ) {
- this.x = x;
- this.y = y;
- }
-
- public float getX() {
- return x;
- }
-
- public void setX(float x) {
- this.x = x;
- }
-
- public float getY() {
- return y;
- }
-
- public void setY(float y) {
- this.y = y;
- }
-
- @Override
- public String toString() {
- return "Point2d [x=" + x + ", y=" + y + "]";
- }
-}