Im and Re

This commit is contained in:
Sergey Solovyev 2012-11-15 23:28:28 +04:00
parent 1a8feb86db
commit 6dfc26dc2a
6 changed files with 34 additions and 2 deletions

View File

@ -6,6 +6,7 @@
package org.solovyev.android.calculator; package org.solovyev.android.calculator;
import jscl.CustomFunctionCalculationException;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.solovyev.common.JBuilder; import org.solovyev.common.JBuilder;
@ -66,7 +67,11 @@ public abstract class AbstractCalculatorMathRegistry<T extends MathEntity, P ext
if (persistenceContainer != null) { if (persistenceContainer != null) {
for (P entity : persistenceContainer.getEntities()) { for (P entity : persistenceContainer.getEntities()) {
if (!contains(entity.getName())) { if (!contains(entity.getName())) {
try {
add(createBuilder(entity)); add(createBuilder(entity));
} catch (CustomFunctionCalculationException e) {
CalculatorLocatorImpl.getInstance().getLogger().error(null, e.getMessage(), e);
}
} }
} }
} }

View File

@ -13,4 +13,7 @@ public interface CalculatorLogger {
void debug(@Nullable String tag, @NotNull String message); void debug(@Nullable String tag, @NotNull String message);
void debug(@Nullable String tag, @NotNull String message, @NotNull Throwable e); void debug(@Nullable String tag, @NotNull String message, @NotNull Throwable e);
void error(@Nullable String tag, @NotNull String message, @NotNull Throwable e);
} }

View File

@ -28,4 +28,10 @@ public class SystemOutCalculatorLogger implements CalculatorLogger {
debug(tag, message); debug(tag, message);
e.printStackTrace(System.out); e.printStackTrace(System.out);
} }
@Override
public void error(@Nullable String tag, @NotNull String message, @NotNull Throwable e) {
System.out.println(getTag(tag) + ": " + message);
e.printStackTrace(System.out);
}
} }

View File

@ -234,4 +234,18 @@
<string name="p_blue_line_color">Синий</string> <string name="p_blue_line_color">Синий</string>
<string name="p_green_line_color">Зелёный</string> <string name="p_green_line_color">Зелёный</string>
<string name="c_function_name">Имя</string>
<string name="c_function_value">Тело функции</string>
<string name="c_function_description">Описание</string>
<string name="c_function_parameters">Параметры</string>
<string name="function_create_function">Создать функцию</string>
<string name="function_edit_function">Редактировать функцию</string>
<string name="function_name_is_not_valid">Не правильное имя функции: имя должно начинаться с буквы, должно сожержать буквы, цифры и знаки подчёркивания.</string>
<string name="function_already_exists">Функция с таким именем уже существует!</string>
<string name="function_is_empty">Тело функции не должно быть пустым!</string>
<string name="function_param_not_empty">Имя параметра не должно быть пустым!</string>
<string name="function_removal_confirmation_question">Вы действительно хотите удалить функцию \'%s\'?</string>
<string name="empty_function_error">Невозможно создать пустую функцию!</string>
</resources> </resources>

View File

@ -243,7 +243,6 @@
<string name="function_edit_function">Edit function</string> <string name="function_edit_function">Edit function</string>
<string name="function_name_is_not_valid">Name of function is not valid: name must start with letter, can contain letters, digits and underscore.</string> <string name="function_name_is_not_valid">Name of function is not valid: name must start with letter, can contain letters, digits and underscore.</string>
<string name="function_already_exists">Function with same name already exists!</string> <string name="function_already_exists">Function with same name already exists!</string>
<string name="function_name_clashes">Function name clashes with function name!</string>
<string name="function_is_empty">Function body could not be empty!</string> <string name="function_is_empty">Function body could not be empty!</string>
<string name="function_param_not_empty">Function parameter should not be empty!</string> <string name="function_param_not_empty">Function parameter should not be empty!</string>
<string name="function_removal_confirmation_question">Do you really want to delete \'%s\' function?</string> <string name="function_removal_confirmation_question">Do you really want to delete \'%s\' function?</string>

View File

@ -28,4 +28,9 @@ public class AndroidCalculatorLogger implements CalculatorLogger {
public void debug(@Nullable String tag, @NotNull String message, @NotNull Throwable e) { public void debug(@Nullable String tag, @NotNull String message, @NotNull Throwable e) {
Log.d(getTag(tag), message, e); Log.d(getTag(tag), message, e);
} }
@Override
public void error(@Nullable String tag, @NotNull String message, @NotNull Throwable e) {
Log.e(getTag(tag), message, e);
}
} }