mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[Sequences] Changing the name of CacheContext to SequenceCacheContext
Change-Id: If2d542748f6f7b2363d6c1443f88c058475945eb
This commit is contained in:
committed by
Émilie Feral
parent
960335c330
commit
4274b558b6
@@ -29,7 +29,6 @@ app_shared_src = $(addprefix apps/shared/,\
|
||||
buffer_function_title_cell.cpp \
|
||||
buffer_text_view_with_text_field.cpp \
|
||||
button_with_separator.cpp \
|
||||
cache_context.cpp \
|
||||
cursor_view.cpp \
|
||||
editable_cell_table_view_controller.cpp \
|
||||
expression_field_delegate_app.cpp \
|
||||
@@ -67,6 +66,7 @@ app_shared_src = $(addprefix apps/shared/,\
|
||||
scrollable_multiple_expressions_view.cpp \
|
||||
scrollable_two_expressions_cell.cpp \
|
||||
sequence.cpp\
|
||||
sequence_cache_context.cpp \
|
||||
sequence_context.cpp\
|
||||
sequence_store.cpp\
|
||||
sequence_title_cell.cpp \
|
||||
@@ -103,8 +103,8 @@ app_shared_test_src += $(addprefix apps/graph/,\
|
||||
)
|
||||
|
||||
app_shared_test_src += $(addprefix apps/shared/,\
|
||||
cache_context.cpp \
|
||||
sequence.cpp \
|
||||
sequence_cache_context.cpp \
|
||||
sequence_context.cpp \
|
||||
sequence_store.cpp \
|
||||
)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "sequence.h"
|
||||
#include "cache_context.h"
|
||||
#include "sequence_cache_context.h"
|
||||
#include "sequence_store.h"
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
@@ -209,7 +209,7 @@ T Sequence::approximateToNextRank(int n, SequenceContext * sqctx, int sequenceIn
|
||||
char unknownN[bufferSize];
|
||||
Poincare::SerializationHelper::CodePoint(unknownN, bufferSize, UCodePointUnknown);
|
||||
|
||||
CacheContext<T> ctx = CacheContext<T>(sqctx);
|
||||
SequenceCacheContext<T> ctx = SequenceCacheContext<T>(sqctx);
|
||||
// Hold values u(n), u(n-1), u(n-2), v(n), v(n-1), v(n-2)...
|
||||
T values[MaxNumberOfSequences][MaxRecurrenceDepth+1];
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "cache_context.h"
|
||||
#include "sequence_cache_context.h"
|
||||
#include "sequence.h"
|
||||
#include "sequence_store.h"
|
||||
#include "poincare_helpers.h"
|
||||
@@ -12,7 +12,7 @@ using namespace Poincare;
|
||||
namespace Shared {
|
||||
|
||||
template<typename T>
|
||||
CacheContext<T>::CacheContext(SequenceContext * sequenceContext) :
|
||||
SequenceCacheContext<T>::SequenceCacheContext(SequenceContext * sequenceContext) :
|
||||
ContextWithParent(sequenceContext),
|
||||
m_values{{NAN, NAN},{NAN, NAN},{NAN,NAN}},
|
||||
m_sequenceContext(sequenceContext)
|
||||
@@ -20,7 +20,7 @@ CacheContext<T>::CacheContext(SequenceContext * sequenceContext) :
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const Expression CacheContext<T>::expressionForSymbolAbstract(const Poincare::SymbolAbstract & symbol, bool clone, float unknownSymbolValue ) {
|
||||
const Expression SequenceCacheContext<T>::expressionForSymbolAbstract(const Poincare::SymbolAbstract & symbol, bool clone, float unknownSymbolValue ) {
|
||||
// [u|v|w](n(+1)?)
|
||||
if (symbol.type() == ExpressionNode::Type::Sequence) {
|
||||
int index = nameIndexForSymbol(const_cast<Symbol &>(static_cast<const Symbol &>(symbol)));
|
||||
@@ -52,12 +52,12 @@ const Expression CacheContext<T>::expressionForSymbolAbstract(const Poincare::Sy
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void CacheContext<T>::setValueForSymbol(T value, const Poincare::Symbol & symbol) {
|
||||
void SequenceCacheContext<T>::setValueForSymbol(T value, const Poincare::Symbol & symbol) {
|
||||
m_values[nameIndexForSymbol(symbol)][rankIndexForSymbol(symbol)] = value;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
int CacheContext<T>::nameIndexForSymbol(const Poincare::Symbol & symbol) {
|
||||
int SequenceCacheContext<T>::nameIndexForSymbol(const Poincare::Symbol & symbol) {
|
||||
assert(symbol.name()[0] >= 'u' && symbol.name()[0] <= 'w'); // [u|v|w]
|
||||
char name = symbol.name()[0];
|
||||
assert(name >= SequenceStore::k_sequenceNames[0][0] && name <= SequenceStore::k_sequenceNames[MaxNumberOfSequences-1][0]); // u, v or w
|
||||
@@ -65,7 +65,7 @@ int CacheContext<T>::nameIndexForSymbol(const Poincare::Symbol & symbol) {
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
int CacheContext<T>::rankIndexForSymbol(const Poincare::Symbol & symbol) {
|
||||
int SequenceCacheContext<T>::rankIndexForSymbol(const Poincare::Symbol & symbol) {
|
||||
assert(strcmp(symbol.name()+1, "(n)") == 0 || strcmp(symbol.name()+1, "(n+1)") == 0); // u(n) or u(n+1)
|
||||
if (symbol.name()[3] == ')') { // (n)
|
||||
return 0;
|
||||
@@ -74,7 +74,7 @@ int CacheContext<T>::rankIndexForSymbol(const Poincare::Symbol & symbol) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
template class CacheContext<float>;
|
||||
template class CacheContext<double>;
|
||||
template class SequenceCacheContext<float>;
|
||||
template class SequenceCacheContext<double>;
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef SEQUENCE_CACHE_CONTEXT_H
|
||||
#define SEQUENCE_CACHE_CONTEXT_H
|
||||
#ifndef SHARED_SEQUENCE_CACHE_CONTEXT_H
|
||||
#define SHARED_SEQUENCE_CACHE_CONTEXT_H
|
||||
|
||||
#include <poincare/context.h>
|
||||
#include <poincare/expression.h>
|
||||
@@ -9,9 +9,9 @@
|
||||
namespace Shared {
|
||||
|
||||
template<typename T>
|
||||
class CacheContext : public Poincare::ContextWithParent {
|
||||
class SequenceCacheContext : public Poincare::ContextWithParent {
|
||||
public:
|
||||
CacheContext(SequenceContext * sequenceContext);
|
||||
SequenceCacheContext(SequenceContext * sequenceContext);
|
||||
const Poincare::Expression expressionForSymbolAbstract(const Poincare::SymbolAbstract & symbol, bool clone, float unknownSymbolValue = NAN) override;
|
||||
void setValueForSymbol(T value, const Poincare::Symbol & symbol);
|
||||
void setNValue(int n) { m_nValue = n; }
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "sequence_context.h"
|
||||
#include "sequence_store.h"
|
||||
#include "cache_context.h"
|
||||
#include "sequence_cache_context.h"
|
||||
#include "../shared/poincare_helpers.h"
|
||||
#include <cmath>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user