mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/probability] Delete local context
Change-Id: I1f15cf659b44e4e6b8311109a40b8a5916fde782
This commit is contained in:
@@ -14,7 +14,6 @@ app_objs += $(addprefix apps/probability/,\
|
||||
law/uniform_law.o\
|
||||
law_controller.o\
|
||||
law_curve_view.o\
|
||||
local_context.o\
|
||||
parameters_controller.o\
|
||||
)
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include <escher.h>
|
||||
#include <poincare.h>
|
||||
#include "law_controller.h"
|
||||
#include "local_context.h"
|
||||
#include "../expression_text_field_delegate.h"
|
||||
|
||||
namespace Probability {
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
#include "local_context.h"
|
||||
#include <string.h>
|
||||
|
||||
namespace Probability {
|
||||
|
||||
LocalContext::LocalContext(::Context * parentContext) :
|
||||
m_tValue(Float(0.0f)),
|
||||
m_aValue(Float(0.0f)),
|
||||
m_bValue(Float(0.0f)),
|
||||
m_parentContext(parentContext)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void LocalContext::setExpressionForSymbolName(Expression * expression, const Symbol * symbol) {
|
||||
// TODO: Add syntax error if expression is a matrix?
|
||||
if (symbol->name() == 't') {
|
||||
m_tValue = Float(expression->approximate(*m_parentContext));
|
||||
return;
|
||||
}
|
||||
if (symbol->name() == 'a') {
|
||||
m_aValue = Float(expression->approximate(*m_parentContext));
|
||||
return;
|
||||
}
|
||||
if (symbol->name() == 'b') {
|
||||
m_bValue = Float(expression->approximate(*m_parentContext));
|
||||
return;
|
||||
}
|
||||
m_parentContext->setExpressionForSymbolName(expression, symbol);
|
||||
}
|
||||
|
||||
const Expression * LocalContext::expressionForSymbol(const Symbol * symbol) {
|
||||
if (symbol->name() == 't') {
|
||||
return &m_tValue;
|
||||
}
|
||||
if (symbol->name() == 'a') {
|
||||
return &m_aValue;
|
||||
}
|
||||
if (symbol->name() == 'b') {
|
||||
return &m_bValue;
|
||||
}
|
||||
return m_parentContext->expressionForSymbol(symbol);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
#ifndef PROBABILITY_LOCAL_CONTEXT_H
|
||||
#define PROBABILITY_LOCAL_CONTEXT_H
|
||||
|
||||
#include <poincare.h>
|
||||
|
||||
namespace Probability {
|
||||
|
||||
class LocalContext : public Context {
|
||||
public:
|
||||
LocalContext(Context * parentContext);
|
||||
void setExpressionForSymbolName(Expression * expression, const Symbol * symbol) override;
|
||||
const Expression * expressionForSymbol(const Symbol * symbol) override;
|
||||
private:
|
||||
Float m_tValue;
|
||||
Float m_aValue;
|
||||
Float m_bValue;
|
||||
Context * m_parentContext;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user