[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/phpexcel/PHPExcel/Calculation/ -> FormulaToken.php (source)

   1  <?php
   2  
   3  /*
   4  PARTLY BASED ON:
   5      Copyright (c) 2007 E. W. Bachtal, Inc.
   6  
   7      Permission is hereby granted, free of charge, to any person obtaining a copy of this software
   8      and associated documentation files (the "Software"), to deal in the Software without restriction,
   9      including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
  10      and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
  11      subject to the following conditions:
  12  
  13        The above copyright notice and this permission notice shall be included in all copies or substantial
  14        portions of the Software.
  15  
  16      The software is provided "as is", without warranty of any kind, express or implied, including but not
  17      limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In
  18      no event shall the authors or copyright holders be liable for any claim, damages or other liability,
  19      whether in an action of contract, tort or otherwise, arising from, out of or in connection with the
  20      software or the use or other dealings in the software.
  21  
  22      http://ewbi.blogs.com/develops/2007/03/excel_formula_p.html
  23      http://ewbi.blogs.com/develops/2004/12/excel_formula_p.html
  24  */
  25  
  26  /**
  27   * PHPExcel_Calculation_FormulaToken
  28   *
  29   * Copyright (c) 2006 - 2015 PHPExcel
  30   *
  31   * This library is free software; you can redistribute it and/or
  32   * modify it under the terms of the GNU Lesser General Public
  33   * License as published by the Free Software Foundation; either
  34   * version 2.1 of the License, or (at your option) any later version.
  35   *
  36   * This library is distributed in the hope that it will be useful,
  37   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  38   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  39   * Lesser General Public License for more details.
  40   *
  41   * You should have received a copy of the GNU Lesser General Public
  42   * License along with this library; if not, write to the Free Software
  43   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  44   *
  45   * @category   PHPExcel
  46   * @package    PHPExcel_Calculation
  47   * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
  48   * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
  49   * @version    ##VERSION##, ##DATE##
  50   */
  51  
  52  
  53  class PHPExcel_Calculation_FormulaToken
  54  {
  55      /* Token types */
  56      const TOKEN_TYPE_NOOP            = 'Noop';
  57      const TOKEN_TYPE_OPERAND         = 'Operand';
  58      const TOKEN_TYPE_FUNCTION        = 'Function';
  59      const TOKEN_TYPE_SUBEXPRESSION   = 'Subexpression';
  60      const TOKEN_TYPE_ARGUMENT        = 'Argument';
  61      const TOKEN_TYPE_OPERATORPREFIX  = 'OperatorPrefix';
  62      const TOKEN_TYPE_OPERATORINFIX   = 'OperatorInfix';
  63      const TOKEN_TYPE_OPERATORPOSTFIX = 'OperatorPostfix';
  64      const TOKEN_TYPE_WHITESPACE      = 'Whitespace';
  65      const TOKEN_TYPE_UNKNOWN         = 'Unknown';
  66  
  67      /* Token subtypes */
  68      const TOKEN_SUBTYPE_NOTHING       = 'Nothing';
  69      const TOKEN_SUBTYPE_START         = 'Start';
  70      const TOKEN_SUBTYPE_STOP          = 'Stop';
  71      const TOKEN_SUBTYPE_TEXT          = 'Text';
  72      const TOKEN_SUBTYPE_NUMBER        = 'Number';
  73      const TOKEN_SUBTYPE_LOGICAL       = 'Logical';
  74      const TOKEN_SUBTYPE_ERROR         = 'Error';
  75      const TOKEN_SUBTYPE_RANGE         = 'Range';
  76      const TOKEN_SUBTYPE_MATH          = 'Math';
  77      const TOKEN_SUBTYPE_CONCATENATION = 'Concatenation';
  78      const TOKEN_SUBTYPE_INTERSECTION  = 'Intersection';
  79      const TOKEN_SUBTYPE_UNION         = 'Union';
  80  
  81      /**
  82       * Value
  83       *
  84       * @var string
  85       */
  86      private $value;
  87  
  88      /**
  89       * Token Type (represented by TOKEN_TYPE_*)
  90       *
  91       * @var string
  92       */
  93      private $tokenType;
  94  
  95      /**
  96       * Token SubType (represented by TOKEN_SUBTYPE_*)
  97       *
  98       * @var string
  99       */
 100      private $tokenSubType;
 101  
 102      /**
 103       * Create a new PHPExcel_Calculation_FormulaToken
 104       *
 105       * @param string    $pValue
 106       * @param string    $pTokenType     Token type (represented by TOKEN_TYPE_*)
 107       * @param string    $pTokenSubType     Token Subtype (represented by TOKEN_SUBTYPE_*)
 108       */
 109      public function __construct($pValue, $pTokenType = PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN, $pTokenSubType = PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING)
 110      {
 111          // Initialise values
 112          $this->value       = $pValue;
 113          $this->tokenType    = $pTokenType;
 114          $this->tokenSubType = $pTokenSubType;
 115      }
 116  
 117      /**
 118       * Get Value
 119       *
 120       * @return string
 121       */
 122      public function getValue()
 123      {
 124          return $this->value;
 125      }
 126  
 127      /**
 128       * Set Value
 129       *
 130       * @param string    $value
 131       */
 132      public function setValue($value)
 133      {
 134          $this->value = $value;
 135      }
 136  
 137      /**
 138       * Get Token Type (represented by TOKEN_TYPE_*)
 139       *
 140       * @return string
 141       */
 142      public function getTokenType()
 143      {
 144          return $this->tokenType;
 145      }
 146  
 147      /**
 148       * Set Token Type
 149       *
 150       * @param string    $value
 151       */
 152      public function setTokenType($value = PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN)
 153      {
 154          $this->tokenType = $value;
 155      }
 156  
 157      /**
 158       * Get Token SubType (represented by TOKEN_SUBTYPE_*)
 159       *
 160       * @return string
 161       */
 162      public function getTokenSubType()
 163      {
 164          return $this->tokenSubType;
 165      }
 166  
 167      /**
 168       * Set Token SubType
 169       *
 170       * @param string    $value
 171       */
 172      public function setTokenSubType($value = PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING)
 173      {
 174          $this->tokenSubType = $value;
 175      }
 176  }


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1