mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
Sequences can now be defined using specific terms form other sequences : Un = n Vn = u(3) Initial values can also depend on other sequences. Should there be a circular dependency, the sequences concerned will display "undef" as value Change-Id: I6fe1f3ff7b500f35d480ddefb42de729c327432e
28 lines
875 B
C++
28 lines
875 B
C++
#ifndef SEQUENCE_CACHE_CONTEXT_H
|
|
#define SEQUENCE_CACHE_CONTEXT_H
|
|
|
|
#include <poincare/context.h>
|
|
#include <poincare/expression.h>
|
|
#include <poincare/symbol.h>
|
|
#include "sequence_context.h"
|
|
|
|
namespace Sequence {
|
|
|
|
template<typename T>
|
|
class CacheContext : public Poincare::ContextWithParent {
|
|
public:
|
|
CacheContext(Poincare::Context * parentContext);
|
|
const Poincare::Expression expressionForSymbolAbstract(const Poincare::SymbolAbstract & symbol, bool clone) override;
|
|
void setValueForSymbol(T value, const Poincare::Symbol & symbol);
|
|
void setSequenceContext(SequenceContext * sequenceContext) { m_sequenceContext = sequenceContext;}
|
|
private:
|
|
int nameIndexForSymbol(const Poincare::Symbol & symbol);
|
|
int rankIndexForSymbol(const Poincare::Symbol & symbol);
|
|
T m_values[MaxNumberOfSequences][MaxRecurrenceDepth];
|
|
SequenceContext * m_sequenceContext;
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|