File indexing completed on 2024-05-12 03:41:58
0001 /************************************************************************************* 0002 * Copyright (C) 2014 by Percy Camilo T. Aucahuasi <percy.camilo.ta\gmail.com> * 0003 * * 0004 * This program is free software; you can redistribute it and/or * 0005 * modify it under the terms of the GNU General Public License * 0006 * as published by the Free Software Foundation; either version 2 * 0007 * of the License, or (at your option) any later version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, * 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0012 * GNU General Public License for more details. * 0013 * * 0014 * You should have received a copy of the GNU General Public License * 0015 * along with this program; if not, write to the Free Software * 0016 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 0017 *************************************************************************************/ 0018 0019 #ifndef LISTCOMMANDS_H 0020 #define LISTCOMMANDS_H 0021 0022 #include "builtinmethods.h" 0023 0024 namespace Analitza { 0025 class Expression; 0026 } 0027 0028 /** 0029 * \class RangeCommand 0030 * 0031 * \brief Implements the \"range\" command. 0032 * 0033 * RangeCommand constructs a list that contains a sequence. 0034 * There are three ways to call this command: 0035 * 0036 * The first way creates a sequence from 1, with increment 1, that ends in 0037 * the number \"b\". 0038 * \code range(b) \endcode 0039 * constructs 0040 * \code list { 1, 2, 3, ... , b } \endcode 0041 * 0042 * The second way creates a sequence from the number \"a\", with increment 1, that 0043 * ends in the number \"b\". 0044 * \code range(a, b) \endcode 0045 * constructs 0046 * \code list { a, a+1, a+2, ... , b } \endcode 0047 * 0048 * The second way creates a sequence from the number \"a\", with 0049 * increment \"h\" (numeric value), that ends in the number \"b\". 0050 * \code range(a, b, h) \endcode 0051 * constructs 0052 * \code list { a, a+h, a+h, ... , b } \endcode 0053 * 0054 * The numbers can be reals too. For example: 0055 * \code range(0.0, 1.0, 0.2) \endcode 0056 * constructs 0057 * \code list { 0, 0.2, 0.4, 0.6, 0.8, 1 } \endcode 0058 * 0059 */ 0060 0061 class RangeCommand: public Analitza::FunctionDefinition 0062 { 0063 public: 0064 virtual Analitza::Expression operator()(const QList< Analitza::Expression >& args) override; 0065 0066 static const QString id; 0067 static const Analitza::ExpressionType type; 0068 }; 0069 0070 #endif // LISTCOMMANDS_H