Merge changes Id958ae26,I054ce60b,I8be6838c,I9b30bc16,I8b10d62f, ...

* changes:
  [apps] In i18n, syntax error
  [escher] In text field, change background color when editing
  [poincare] Pop up a syntax error for function with the wrong number of arguments
  [apps/sequence][apps/graph] Define x/n only in list controllers
  [apps/shared] Fix bug: avoid typing sum(cos(x),2,3) instead of sum(cos(n),2,3)
  [apps/shared] Fix bug in goto
  [apps/shared] Do not reset the textfield is the data has not been updated (syntax, math error)
This commit is contained in:
Émilie Feral
2017-03-30 10:04:35 +02:00
committed by Gerrit
61 changed files with 145 additions and 91 deletions

View File

@@ -2,10 +2,10 @@
#define CALCULATION_EDIT_EXPRESSION_CONTROLLER_H
#include <escher.h>
#include "../shared/text_field_delegate.h"
#include "history_controller.h"
#include "calculation_store.h"
#include "text_field.h"
#include "../shared/text_field_delegate.h"
namespace Calculation {
class HistoryController;

View File

@@ -33,7 +33,10 @@ InputViewController * App::inputViewController() {
}
Context * App::localContext() {
return &m_xContext;
if (m_tabViewController.activeTab() == 0) {
return &m_xContext;
}
return TextFieldDelegateApp::localContext();
}
}

View File

@@ -22,7 +22,7 @@ const char * messages[196][3] {
{"Valider", "Confirm", "Confirmar"},
{"Suivant", "Next", "Siguiente"},
{"Attention a la syntaxe", "Syntax error", "Error sintactico"},
{"Error mathematique", "Math error", "Error matematico"},
{"Erreur mathematique", "Math error", "Error matematico"},
/* Variables */
{"Variables", "Variables", "Variables"},

View File

@@ -151,9 +151,11 @@ bool ParametersController::setParameterAtIndex(int parameterIndex, float f) {
}
bool ParametersController::textFieldDidFinishEditing(TextField * textField, const char * text) {
FloatParameterController::textFieldDidFinishEditing(textField, text);
m_selectableTableView.reloadData();
return true;
if (FloatParameterController::textFieldDidFinishEditing(textField, text)) {
m_selectableTableView.reloadData();
return true;
}
return false;
}
void ParametersController::buttonAction() {

View File

@@ -111,7 +111,6 @@ bool GoToParameterController::textFieldDidFinishEditing(TextField * textField, c
void GoToParameterController::viewWillAppear() {
m_previousParameter = parameterAtIndex(0);
m_selectableTableView.reloadData();
}
void GoToParameterController::buttonAction() {

View File

@@ -30,8 +30,11 @@ InputViewController * App::inputViewController() {
return &m_inputViewController;
}
LocalContext * App::localContext() {
return &m_nContext;
Context * App::localContext() {
if (m_tabViewController.activeTab() == 0) {
return &m_nContext;
}
return TextFieldDelegateApp::localContext();
}
const char * App::XNT() {

View File

@@ -16,7 +16,7 @@ class App : public Shared::TextFieldDelegateApp {
public:
App(Container * container, Poincare::Context * context);
InputViewController * inputViewController();
LocalContext * localContext() override;
Poincare::Context * localContext() override;
const char * XNT() override;
private:
SequenceStore m_sequenceStore;

View File

@@ -24,18 +24,17 @@ View * FloatParameterController::view() {
}
void FloatParameterController::didBecomeFirstResponder() {
m_selectableTableView.reloadData();
m_selectableTableView.selectCellAtLocation(0, 0);
app()->setFirstResponder(&m_selectableTableView);
}
void FloatParameterController::viewWillAppear() {
m_selectableTableView.reloadData();
}
bool FloatParameterController::handleEvent(Ion::Events::Event event) {
if (event == Ion::Events::Back) {
for (int i = 0; i < numberOfRows()-1; i++) {
setParameterAtIndex(i, previousParameterAtIndex(i));
if (parameterAtIndex(i) != previousParameterAtIndex(i)) {
setParameterAtIndex(i, previousParameterAtIndex(i));
}
}
stackController()->pop();
return true;

View File

@@ -14,7 +14,6 @@ class FloatParameterController : public ViewController, public ListViewDataSourc
public:
FloatParameterController(Responder * parentResponder, I18n::Message okButtonText = I18n::Message::Ok);
View * view() override;
void viewWillAppear() override;
void didBecomeFirstResponder() override;
bool handleEvent(Ion::Events::Event event) override;

View File

@@ -62,9 +62,11 @@ void RangeParameterController::willDisplayCellForIndex(HighlightCell * cell, int
}
bool RangeParameterController::textFieldDidFinishEditing(TextField * textField, const char * text) {
FloatParameterController::textFieldDidFinishEditing(textField, text);
m_selectableTableView.reloadData();
return true;
if (FloatParameterController::textFieldDidFinishEditing(textField, text)) {
m_selectableTableView.reloadData();
return true;
}
return false;
}
void RangeParameterController::tableViewDidChangeSelection(SelectableTableView * t, int previousSelectedCellX, int previousSelectedCellY) {

View File

@@ -29,16 +29,19 @@ bool TextFieldDelegateApp::cursorInToken(TextField * textField, const char * tok
const char * text = textField->text();
int location = textField->cursorLocation();
int tokenLength = strlen(token);
while (text[location] != '(') {
location --;
}
if (location - tokenLength < 0) {
return false;
}
char previousToken[10];
strlcpy(previousToken, text+location-tokenLength, tokenLength+1);
if (strcmp(previousToken, token) == 0) {
return true;
while (location >= 0) {
while (text[location] != '(') {
location --;
}
if (location - tokenLength < 0) {
return false;
}
char previousToken[10];
strlcpy(previousToken, text+location-tokenLength, tokenLength+1);
if (strcmp(previousToken, token) == 0) {
return true;
}
location--;
}
return false;
}
@@ -46,7 +49,7 @@ bool TextFieldDelegateApp::cursorInToken(TextField * textField, const char * tok
bool TextFieldDelegateApp::textFieldDidReceiveEvent(TextField * textField, Ion::Events::Event event) {
if ((event == Ion::Events::OK || event == Ion::Events::EXE) && textField->isEditing()) {
Expression * exp = Expression::parse(textField->text());
if (exp == nullptr) {
if (exp == nullptr || !exp->hasValidNumberOfArguments()) {
if (textField->textLength() == 0) {
return true;
}

View File

@@ -8,7 +8,7 @@ class TabViewController : public ViewController {
public:
TabViewController(Responder * parentResponder, ViewController * one, ViewController * two, ViewController * three, ViewController * four = nullptr);
View * view() override;
int activeTab() const;
void setSelectedTab(int8_t index);
void setActiveTab(int8_t index, bool forceReactive = false);
uint8_t numberOfTabs();

View File

@@ -39,10 +39,7 @@ View * EditableTextCell::subviewAtIndex(int index) {
}
void EditableTextCell::layoutSubviews() {
KDCoordinate width = bounds().width();
KDCoordinate height = bounds().height();
KDCoordinate textHeight = m_textField.minimalSizeForOptimalDisplay().height();
m_textField.setFrame(KDRect(k_separatorThickness, (height - textHeight)/2, width - k_separatorThickness, textHeight));
m_textField.setFrame(bounds());
}
void EditableTextCell::didBecomeFirstResponder() {

View File

@@ -69,6 +69,10 @@ TabViewController::TabViewController(Responder * parentResponder, ViewController
}
}
int TabViewController::activeTab() const {
return m_activeChildIndex;
}
bool TabViewController::handleEvent(Ion::Events::Event event) {
if (event == Ion::Events::Back) {
if (app()->firstResponder() != this) {

View File

@@ -21,11 +21,15 @@ TextField::ContentView::ContentView(char * textBuffer, char * draftTextBuffer, s
}
void TextField::ContentView::drawRect(KDContext * ctx, KDRect rect) const {
ctx->fillRect(rect, m_backgroundColor);
KDColor bckCol = m_backgroundColor;
if (m_isEditing) {
bckCol = KDColorWhite;
}
ctx->fillRect(rect, bckCol);
KDSize textSize = KDText::stringSize(text(), m_fontSize);
KDPoint origin(m_horizontalAlignment*(m_frame.width() - textSize.width()-m_cursorView.minimalSizeForOptimalDisplay().width()),
m_verticalAlignment*(m_frame.height() - textSize.height()));
ctx->drawString(text(), origin, m_fontSize, m_textColor, m_backgroundColor);
ctx->drawString(text(), origin, m_fontSize, m_textColor, bckCol);
}
void TextField::ContentView::reload() {
@@ -277,6 +281,8 @@ bool TextField::handleEvent(Ion::Events::Event event) {
}
if (event == Ion::Events::OK || event == Ion::Events::EXE) {
if (isEditing()) {
char bufferText[ContentView::k_maxBufferSize];
strlcpy(bufferText, m_contentView.textBuffer(), ContentView::k_maxBufferSize);
strlcpy(m_contentView.textBuffer(), m_contentView.draftTextBuffer(), m_contentView.bufferSize());
int cursorLoc = cursorLocation();
setEditing(false);
@@ -284,11 +290,13 @@ bool TextField::handleEvent(Ion::Events::Event event) {
reloadScroll();
return true;
}
char buffer[ContentView::k_maxBufferSize];
strlcpy(buffer, m_contentView.textBuffer(), ContentView::k_maxBufferSize);
setText("");
/* if the text was refused (textFieldDidFinishEditing returned false, we
* reset the textfield in the same state as before */
char bufferDraft[ContentView::k_maxBufferSize];
strlcpy(bufferDraft, m_contentView.textBuffer(), ContentView::k_maxBufferSize);
setText(bufferText);
setEditing(true);
setText(buffer);
setText(bufferDraft);
setCursorLocation(cursorLoc);
return true;
}

View File

@@ -11,6 +11,7 @@ class BinaryOperation : public Expression {
public:
BinaryOperation(Expression ** operands, bool cloneOperands = true);
~BinaryOperation();
bool hasValidNumberOfArguments() const override;
const Expression * operand(int i) const override;
int numberOfOperands() const override;
Expression * clone() const override;

View File

@@ -8,7 +8,7 @@ namespace Poincare {
class BinomialCoefficient : public Function {
public:
BinomialCoefficient();
bool isValidNumberOfArguments(int numberOfArguments) override;
bool hasValidNumberOfArguments() const override;
Type type() const override;
Expression * cloneWithDifferentOperands(Expression ** newOperands,
int numberOfOperands, bool cloneOperands = true) const override;

View File

@@ -8,7 +8,7 @@ namespace Poincare {
class ConfidenceInterval : public Function {
public:
ConfidenceInterval();
bool isValidNumberOfArguments(int numberOfArguments) override;
bool hasValidNumberOfArguments() const override;
Type type() const override;
Expression * cloneWithDifferentOperands(Expression ** newOperands,
int numberOfOperands, bool cloneOperands = true) const override;

View File

@@ -9,7 +9,7 @@ namespace Poincare {
class Derivative : public Function {
public:
Derivative();
bool isValidNumberOfArguments(int numberOfArguments) override;
bool hasValidNumberOfArguments() const override;
Type type() const override;
Expression * cloneWithDifferentOperands(Expression ** newOperands,
int numberOfOperands, bool cloneOperands = true) const override;

View File

@@ -8,7 +8,7 @@ namespace Poincare {
class DivisionQuotient : public Function {
public:
DivisionQuotient();
bool isValidNumberOfArguments(int numberOfArguments) override;
bool hasValidNumberOfArguments() const override;
Type type() const override;
Expression * cloneWithDifferentOperands(Expression ** newOperands,
int numberOfOperands, bool cloneOperands = true) const override;

View File

@@ -8,7 +8,7 @@ namespace Poincare {
class DivisionRemainder : public Function {
public:
DivisionRemainder();
bool isValidNumberOfArguments(int numberOfArguments) override;
bool hasValidNumberOfArguments() const override;
Type type() const override;
Expression * cloneWithDifferentOperands(Expression ** newOperands,
int numberOfOperands, bool cloneOperands = true) const override;

View File

@@ -84,7 +84,7 @@ public:
};
static Expression * parse(char const * string);
virtual ~Expression();
virtual bool hasValidNumberOfArguments() const = 0;
ExpressionLayout * createLayout(FloatDisplayMode floatDisplayMode = FloatDisplayMode::Default, ComplexFormat complexFormat = ComplexFormat::Default) const; // Returned object must be deleted
virtual const Expression * operand(int i) const = 0;
virtual int numberOfOperands() const = 0;

View File

@@ -15,7 +15,7 @@ public:
~Function();
void setArgument(Expression ** args, int numberOfArguments, bool clone = true);
void setArgument(ListData * listData, bool clone = true);
virtual bool isValidNumberOfArguments(int numberOfArguments);
bool hasValidNumberOfArguments() const override;
const Expression * operand(int i) const override;
int numberOfOperands() const override;
Expression * clone() const override;

View File

@@ -8,7 +8,7 @@ namespace Poincare {
class GreatCommonDivisor : public Function {
public:
GreatCommonDivisor();
bool isValidNumberOfArguments(int numberOfArguments) override;
bool hasValidNumberOfArguments() const override;
Type type() const override;
Expression * cloneWithDifferentOperands(Expression ** newOperands,
int numberOfOperands, bool cloneOperands = true) const override;

View File

@@ -9,7 +9,7 @@ namespace Poincare {
class Integral : public Function {
public:
Integral();
bool isValidNumberOfArguments(int numberOfArguments) override;
bool hasValidNumberOfArguments() const override;
Type type() const override;
Expression * cloneWithDifferentOperands(Expression ** newOperands,
int numberOfOperands, bool cloneOperands = true) const override;

View File

@@ -7,6 +7,7 @@ namespace Poincare {
class LeafExpression : public Expression {
public:
bool hasValidNumberOfArguments() const override;
const Expression * operand(int i) const override;
int numberOfOperands() const override;
Expression * cloneWithDifferentOperands(Expression** newOperands,

View File

@@ -8,7 +8,7 @@ namespace Poincare {
class LeastCommonMultiple : public Function {
public:
LeastCommonMultiple();
bool isValidNumberOfArguments(int numberOfArguments) override;
bool hasValidNumberOfArguments() const override;
Type type() const override;
Expression * cloneWithDifferentOperands(Expression ** newOperands,
int numberOfOperands, bool cloneOperands = true) const override;

View File

@@ -8,7 +8,7 @@ namespace Poincare {
class Logarithm : public Function {
public:
Logarithm();
bool isValidNumberOfArguments(int numberOfArguments) override;
bool hasValidNumberOfArguments() const override;
Type type() const override;
Expression * cloneWithDifferentOperands(Expression ** newOperands,
int numberOfOperands, bool cloneOperands = true) const override;

View File

@@ -12,6 +12,7 @@ public:
Matrix(MatrixData * matrixData);
Matrix(Expression ** newOperands, int numberOfOperands, int m_numberOfColumns, int m_numberOfRows, bool cloneOperands);
~Matrix();
bool hasValidNumberOfArguments() const override;
const Expression * operand(int i) const override;
int numberOfOperands() const override;
Expression * clone() const override;

View File

@@ -8,7 +8,7 @@ namespace Poincare {
class NthRoot : public Function {
public:
NthRoot();
bool isValidNumberOfArguments(int numberOfArguments) override;
bool hasValidNumberOfArguments() const override;
Type type() const override;
Expression * cloneWithDifferentOperands(Expression ** newOperands,
int numberOfOperands, bool cloneOperands = true) const override;

View File

@@ -10,6 +10,7 @@ class Opposite : public Expression {
public:
Opposite(Expression * operand, bool cloneOperands = true);
~Opposite();
bool hasValidNumberOfArguments() const override;
const Expression * operand(int i) const override;
int numberOfOperands() const override;
Expression * clone() const override;

View File

@@ -9,6 +9,7 @@ class Parenthesis : public Expression {
public:
Parenthesis(Expression * operand, bool cloneOperands = true);
~Parenthesis();
bool hasValidNumberOfArguments() const override;
const Expression * operand(int i) const override;
int numberOfOperands() const override;
Expression * clone() const override;

View File

@@ -8,7 +8,7 @@ namespace Poincare {
class PermuteCoefficient : public Function {
public:
PermuteCoefficient();
bool isValidNumberOfArguments(int numberOfArguments) override;
bool hasValidNumberOfArguments() const override;
Type type() const override;
Expression * cloneWithDifferentOperands(Expression ** newOperands,
int numberOfOperands, bool cloneOperands = true) const override;

View File

@@ -8,7 +8,7 @@ namespace Poincare {
class PredictionInterval : public Function {
public:
PredictionInterval();
bool isValidNumberOfArguments(int numberOfArguments) override;
bool hasValidNumberOfArguments() const override;
Type type() const override;
Expression * cloneWithDifferentOperands(Expression ** newOperands,
int numberOfOperands, bool cloneOperands = true) const override;

View File

@@ -8,7 +8,7 @@ namespace Poincare {
class Product : public Function {
public:
Product();
bool isValidNumberOfArguments(int numberOfArguments) override;
bool hasValidNumberOfArguments() const override;
Type type() const override;
Expression * cloneWithDifferentOperands(Expression ** newOperands,
int numberOfOperands, bool cloneOperands = true) const override;

View File

@@ -8,7 +8,7 @@ namespace Poincare {
class Round : public Function {
public:
Round();
bool isValidNumberOfArguments(int numberOfArguments) override;
bool hasValidNumberOfArguments() const override;
Type type() const override;
Expression * cloneWithDifferentOperands(Expression ** newOperands,
int numberOfOperands, bool cloneOperands = true) const override;

View File

@@ -10,6 +10,7 @@ class Store : public Expression {
public:
Store(Symbol * symbol, Expression * value, bool clone = true);
~Store();
bool hasValidNumberOfArguments() const override;
Type type() const override;
const Expression * operand(int i) const override;
int numberOfOperands() const override;

View File

@@ -8,7 +8,7 @@ namespace Poincare {
class Sum : public Function {
public:
Sum();
bool isValidNumberOfArguments(int numberOfArguments) override;
bool hasValidNumberOfArguments() const override;
Type type() const override;
Expression * cloneWithDifferentOperands(Expression ** newOperands,
int numberOfOperands, bool cloneOperands = true) const override;

View File

@@ -25,6 +25,10 @@ BinaryOperation::~BinaryOperation() {
delete m_operands[0];
}
bool BinaryOperation::hasValidNumberOfArguments() const {
return m_operands[0]->hasValidNumberOfArguments() && m_operands[1]->hasValidNumberOfArguments();
}
int BinaryOperation::numberOfOperands() const {
return 2;
}

View File

@@ -16,8 +16,8 @@ BinomialCoefficient::BinomialCoefficient() :
{
}
bool BinomialCoefficient::isValidNumberOfArguments(int numberOfArguments) {
return (numberOfArguments == 2);
bool BinomialCoefficient::hasValidNumberOfArguments() const {
return (m_numberOfArguments == 2);
}
Expression::Type BinomialCoefficient::type() const {

View File

@@ -12,8 +12,8 @@ ConfidenceInterval::ConfidenceInterval() :
{
}
bool ConfidenceInterval::isValidNumberOfArguments(int numberOfArguments) {
return (numberOfArguments == 2);
bool ConfidenceInterval::hasValidNumberOfArguments() const {
return (m_numberOfArguments == 2);
}
Expression::Type ConfidenceInterval::type() const {

View File

@@ -15,8 +15,8 @@ Derivative::Derivative() :
{
}
bool Derivative::isValidNumberOfArguments(int numberOfArguments) {
return (numberOfArguments == 2);
bool Derivative::hasValidNumberOfArguments() const {
return (m_numberOfArguments == 2);
}
Expression::Type Derivative::type() const {

View File

@@ -12,8 +12,8 @@ DivisionQuotient::DivisionQuotient() :
{
}
bool DivisionQuotient::isValidNumberOfArguments(int numberOfArguments) {
return (numberOfArguments == 2);
bool DivisionQuotient::hasValidNumberOfArguments() const {
return (m_numberOfArguments == 2);
}
Expression::Type DivisionQuotient::type() const {

View File

@@ -12,8 +12,8 @@ DivisionRemainder::DivisionRemainder() :
{
}
bool DivisionRemainder::isValidNumberOfArguments(int numberOfArguments) {
return (numberOfArguments == 2);
bool DivisionRemainder::hasValidNumberOfArguments() const {
return (m_numberOfArguments == 2);
}
Expression::Type DivisionRemainder::type() const {

View File

@@ -141,7 +141,7 @@ exp:
| MINUS exp { $$ = new Poincare::Opposite($2, false); }
| LEFT_PARENTHESIS exp RIGHT_PARENTHESIS { $$ = new Poincare::Parenthesis($2, false); }
| LEFT_BRACKET mtxData RIGHT_BRACKET { $$ = new Poincare::Matrix($2); }
| FUNCTION LEFT_PARENTHESIS lstData RIGHT_PARENTHESIS { if (!$1->isValidNumberOfArguments($3->numberOfOperands())) { $$ = new Poincare::Complex(Poincare::Complex::Float(NAN));} else {$$ = $1; $1->setArgument($3, true); delete $3;} }
| FUNCTION LEFT_PARENTHESIS lstData RIGHT_PARENTHESIS { $$ = $1; $1->setArgument($3, true); delete $3; }
;
%%

View File

@@ -63,9 +63,9 @@ Function::~Function() {
}
}
bool Function::isValidNumberOfArguments(int numberOfArguments) {
bool Function::hasValidNumberOfArguments() const {
/* By default, a function has one argument only */
return (numberOfArguments == 1);
return (m_numberOfArguments == 1);
}
Expression * Function::clone() const {

View File

@@ -13,8 +13,8 @@ GreatCommonDivisor::GreatCommonDivisor() :
{
}
bool GreatCommonDivisor::isValidNumberOfArguments(int numberOfArguments) {
return (numberOfArguments == 2);
bool GreatCommonDivisor::hasValidNumberOfArguments() const {
return (m_numberOfArguments == 2);
}
Expression::Type GreatCommonDivisor::type() const {

View File

@@ -19,8 +19,8 @@ Integral::Integral() :
{
}
bool Integral::isValidNumberOfArguments(int numberOfArguments) {
return (numberOfArguments == 3);
bool Integral::hasValidNumberOfArguments() const {
return (m_numberOfArguments == 3);
}
Expression::Type Integral::type() const {

View File

@@ -6,6 +6,10 @@ extern "C" {
namespace Poincare {
bool LeafExpression::hasValidNumberOfArguments() const {
return true;
}
int LeafExpression::numberOfOperands() const {
return 0;
}

View File

@@ -13,8 +13,8 @@ LeastCommonMultiple::LeastCommonMultiple() :
{
}
bool LeastCommonMultiple::isValidNumberOfArguments(int numberOfArguments) {
return (numberOfArguments == 2);
bool LeastCommonMultiple::hasValidNumberOfArguments() const {
return (m_numberOfArguments == 2);
}
Expression::Type LeastCommonMultiple::type() const {

View File

@@ -16,8 +16,8 @@ Logarithm::Logarithm() :
{
}
bool Logarithm::isValidNumberOfArguments(int numberOfArguments) {
return (numberOfArguments == 1 || numberOfArguments == 2);
bool Logarithm::hasValidNumberOfArguments() const {
return (m_numberOfArguments == 1 || m_numberOfArguments == 2);
}
Expression::Type Logarithm::type() const {

View File

@@ -21,6 +21,15 @@ Matrix::~Matrix() {
delete m_matrixData;
}
bool Matrix::hasValidNumberOfArguments() const {
for (int i = 0; i < numberOfOperands(); i++) {
if (!operand(i)->hasValidNumberOfArguments()) {
return false;
}
}
return true;
}
Matrix::Matrix(Expression ** newOperands, int numberOfOperands, int numberOfColumns, int numberOfRows, bool cloneOperands)
{
m_matrixData = new MatrixData(newOperands, numberOfOperands, numberOfColumns, numberOfRows, cloneOperands);

View File

@@ -16,8 +16,8 @@ NthRoot::NthRoot() :
{
}
bool NthRoot::isValidNumberOfArguments(int numberOfArguments) {
return (numberOfArguments == 2);
bool NthRoot::hasValidNumberOfArguments() const {
return (m_numberOfArguments == 2);
}
Expression::Type NthRoot::type() const {

View File

@@ -23,6 +23,10 @@ Opposite::~Opposite() {
delete m_operand;
}
bool Opposite::hasValidNumberOfArguments() const {
return m_operand->hasValidNumberOfArguments();
}
const Expression * Opposite::operand(int i) const {
assert(i == 0);
return m_operand;

View File

@@ -20,6 +20,10 @@ Parenthesis::~Parenthesis() {
delete m_operand;
}
bool Parenthesis::hasValidNumberOfArguments() const {
return m_operand->hasValidNumberOfArguments();
}
int Parenthesis::numberOfOperands() const {
return 1;
}

View File

@@ -13,8 +13,8 @@ PermuteCoefficient::PermuteCoefficient() :
{
}
bool PermuteCoefficient::isValidNumberOfArguments(int numberOfArguments) {
return (numberOfArguments == 2);
bool PermuteCoefficient::hasValidNumberOfArguments() const {
return (m_numberOfArguments == 2);
}
Expression::Type PermuteCoefficient::type() const {

View File

@@ -12,8 +12,8 @@ PredictionInterval::PredictionInterval() :
{
}
bool PredictionInterval::isValidNumberOfArguments(int numberOfArguments) {
return (numberOfArguments == 2);
bool PredictionInterval::hasValidNumberOfArguments() const {
return (m_numberOfArguments == 2);
}
Expression::Type PredictionInterval::type() const {

View File

@@ -19,8 +19,8 @@ Product::Product() :
{
}
bool Product::isValidNumberOfArguments(int numberOfArguments) {
return (numberOfArguments == 3);
bool Product::hasValidNumberOfArguments() const {
return (m_numberOfArguments == 3);
}
Expression::Type Product::type() const {

View File

@@ -12,8 +12,8 @@ Round::Round() :
{
}
bool Round::isValidNumberOfArguments(int numberOfArguments) {
return (numberOfArguments == 2);
bool Round::hasValidNumberOfArguments() const {
return (m_numberOfArguments == 2);
}
Expression::Type Round::type() const {

View File

@@ -26,6 +26,10 @@ Store::~Store() {
delete m_value;
}
bool Store::hasValidNumberOfArguments() const {
return m_value->hasValidNumberOfArguments();
}
Expression::Type Store::type() const {
return Type::Store;
}

View File

@@ -19,8 +19,8 @@ Sum::Sum() :
{
}
bool Sum::isValidNumberOfArguments(int numberOfArguments) {
return (numberOfArguments == 3);
bool Sum::hasValidNumberOfArguments() const {
return (m_numberOfArguments == 3);
}
Expression::Type Sum::type() const {