http://www.eteks.com

com.eteks.jeks
Class JeksExpressionSyntax

java.lang.Object
  |
  +--com.eteks.parser.AbstractSyntax
        |
        +--com.eteks.jeks.ResourceSyntax
              |
              +--com.eteks.jeks.JeksFunctionSyntax
                    |
                    +--com.eteks.jeks.JeksExpressionSyntax
All Implemented Interfaces:
Syntax

public class JeksExpressionSyntax
extends JeksFunctionSyntax

Localized syntax used by the parser to compile expressions defined in a cell.

Since:
Jeks 1.0
Version:
1.0
Author:
Emmanuel Puybaret

Field Summary
static java.lang.Integer ERROR_DIVISION_BY_ZERO
           
static java.lang.Integer ERROR_ERR
           
static java.lang.Integer ERROR_ILLEGAL_CELL
          Key for an invalid reference in a cell.
static java.lang.Integer ERROR_ILLEGAL_VALUE
           
static java.lang.Integer ERROR_INVALID_NUMBER
           
static java.lang.Integer ERROR_UNKNOWN_NAME
           
static java.lang.Integer JEKS_FUNCTION_IF
           
static java.lang.Integer MESSAGE_CIRCULARITY_ERROR_CONFIRM
           
static java.lang.Integer MESSAGE_CIRCULARITY_ERROR_INFO
           
static java.lang.Integer MESSAGE_CIRCULARITY_ERROR_TITLE
           
 
Fields inherited from class com.eteks.jeks.JeksFunctionSyntax
JEKS_FUNCTION_AND, JEKS_FUNCTION_CHAR, JEKS_FUNCTION_CODE, JEKS_FUNCTION_DATE, JEKS_FUNCTION_DATEVALUE, JEKS_FUNCTION_DAY, JEKS_FUNCTION_FACT, JEKS_FUNCTION_FALSE, JEKS_FUNCTION_FIND, JEKS_FUNCTION_HOUR, JEKS_FUNCTION_MINUTE, JEKS_FUNCTION_MODULO, JEKS_FUNCTION_MONTH, JEKS_FUNCTION_NOW, JEKS_FUNCTION_OR, JEKS_FUNCTION_RAND, JEKS_FUNCTION_SECOND, JEKS_FUNCTION_SUM, JEKS_FUNCTION_TIME, JEKS_FUNCTION_TIMEVALUE, JEKS_FUNCTION_TRUE, JEKS_FUNCTION_WEEKDAY, JEKS_FUNCTION_YEAR, MESSAGE_ASSIGN_OPERATOR_EXPECTED, MESSAGE_CLOSING_BRACKET_EXPECTED, MESSAGE_CLOSING_BRACKET_WITHOUT_OPENING_BRACKET, MESSAGE_COMPILATION_ERROR_TITLE, MESSAGE_DUPLICATED_PARAMETER_NAME, MESSAGE_ELSE_OPERATOR_EXPECTED, MESSAGE_ELSE_OPERATOR_WITHOUT_IF_THEN_OPERATORS, MESSAGE_FUNCTION_NAME_ALREADY_EXISTS, MESSAGE_INVALID_FUNCTION_NAME, MESSAGE_INVALID_JEKS_FILE, MESSAGE_INVALID_PARAMETER_NAME, MESSAGE_INVALID_PARAMETERS_COUNT_IN_FUNCTION_CALL, MESSAGE_MISSING_PARAMETERS_IN_FUNCTION_CALL, MESSAGE_OPENING_BRACKET_EXPECTED, MESSAGE_RESERVED_WORD, MESSAGE_SYNTAX_ERROR, MESSAGE_THEN_OPERATOR_EXPECTED, MESSAGE_THEN_OPERATOR_WITHOUT_IF_OPERATOR, MESSAGE_UNKOWN_IDENTIFIER
 
Fields inherited from interface com.eteks.parser.Syntax
CONDITION_ELSE, CONDITION_IF, CONDITION_THEN, CONSTANT_E, CONSTANT_FALSE, CONSTANT_PI, CONSTANT_TRUE, FUNCTION_ABS, FUNCTION_ACOS, FUNCTION_ASIN, FUNCTION_ATAN, FUNCTION_CEIL, FUNCTION_COS, FUNCTION_COSH, FUNCTION_EXP, FUNCTION_FLOOR, FUNCTION_INTEGER, FUNCTION_LN, FUNCTION_LOG, FUNCTION_NOT, FUNCTION_OPPOSITE, FUNCTION_ROUND, FUNCTION_SIN, FUNCTION_SINH, FUNCTION_SQR, FUNCTION_SQRT, FUNCTION_TAN, FUNCTION_TANH, OPERATOR_ADD, OPERATOR_BITWISE_AND, OPERATOR_BITWISE_NOT, OPERATOR_BITWISE_OR, OPERATOR_BITWISE_XOR, OPERATOR_DIFFERENT, OPERATOR_DIVIDE, OPERATOR_EQUAL, OPERATOR_GREATER, OPERATOR_GREATER_OR_EQUAL, OPERATOR_LESS, OPERATOR_LESS_OR_EQUAL, OPERATOR_LOGICAL_AND, OPERATOR_LOGICAL_NOT, OPERATOR_LOGICAL_OR, OPERATOR_LOGICAL_XOR, OPERATOR_MODULO, OPERATOR_MULTIPLY, OPERATOR_OPPOSITE, OPERATOR_POSITIVE, OPERATOR_POWER, OPERATOR_REMAINDER, OPERATOR_SHIFT_LEFT, OPERATOR_SHIFT_RIGHT, OPERATOR_SHIFT_RIGHT_0, OPERATOR_SUBSTRACT, USER_STARTING_KEY
 
Constructor Summary
JeksExpressionSyntax()
          Creates an instance of JeksExpressionSyntax with default locale.
JeksExpressionSyntax(java.util.Locale locale)
          Creates an instance of JeksExpressionSyntax initialized with the resource bundle com.eteks.jeks.syntax.
 
Method Summary
 JeksCell getCellAt(java.lang.String identifier)
          Returns a cell at the coordinates contained in the string identifier.
 java.lang.String getCellError(java.lang.Object cellErrorKey)
          Returns the localized string code used to describe the cell error cellErrorKey.
 java.lang.String getCellError(java.lang.Throwable error)
          Returns a localized error string matching the exception error.
 char getCellSetSeparator()
          Returns the character used to separate the two cells of a set.
 java.lang.String getColumnName(int column)
          Returns a string equivalent to column.
 java.lang.Object getConditionPartKey(java.lang.String conditionPart)
          Returns null.
 char getConstantChar()
          Returns the character representing a constant row or column.
 java.lang.String getMessage(java.lang.Object messageKey)
          Returns the localized message matching the key messageKey.
 java.lang.String getRowName(int row)
          Returns a string equivalent to row.
 boolean isCellIdentifier(java.lang.String identifier)
          Returns true if identifier represents a cell.
 boolean isValidIdentifier(java.lang.String identifier)
          Returns true if identifier is a valid identifier for a function or is a cell identifier.
 java.lang.String toString(int row, boolean rowConstant, int column, boolean columnConstant)
          Returns a string equivalent to cell.
 java.lang.String toString(JeksCell cell)
          Returns a string equivalent to cell.
 
Methods inherited from class com.eteks.jeks.JeksFunctionSyntax
getExceptionMessage, getJeksFunction, getJeksFunctionKey, getLiteral, getLocale, getNumberFormat, getQuoteCharacter
 
Methods inherited from class com.eteks.jeks.ResourceSyntax
getBinaryOperator, getCommonFunction, getConditionPart, getConstant, getResourceBoolean, getResourceBoolean, getResourceBundle, getResourceChar, getResourceChar, getResourceString, getResourceString, getUnaryOperator, setResourceBinaryOperatorKey, setResourceBinaryOperatorPriority, setResourceCommonFunctionKey, setResourceConditionPartKey, setResourceConstantKey, setResourceUnaryOperatorKey
 
Methods inherited from class com.eteks.parser.AbstractSyntax
addFunction, getAssignmentOperator, getBinaryOperatorKey, getBinaryOperatorPriority, getClosingBracket, getCommonFunctionKey, getConditionPartCount, getConstantKey, getDelimiters, getFunction, getOpeningBracket, getParameterSeparator, getUnaryOperatorKey, getWhiteSpaceCharacters, isCaseSensitive, isShortSyntax, removeFunction, setAssignmentOperator, setBinaryOperatorKey, setBinaryOperatorPriority, setClosingBracket, setCommonFunctionKey, setConditionPartKey, setConstantKey, setOpeningBracket, setParameterSeparator, setShortSyntax, setUnaryOperatorKey, setWhiteSpaceCharacters
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERROR_ILLEGAL_CELL

public static final java.lang.Integer ERROR_ILLEGAL_CELL
Key for an invalid reference in a cell.

ERROR_ILLEGAL_VALUE

public static final java.lang.Integer ERROR_ILLEGAL_VALUE

ERROR_UNKNOWN_NAME

public static final java.lang.Integer ERROR_UNKNOWN_NAME

ERROR_INVALID_NUMBER

public static final java.lang.Integer ERROR_INVALID_NUMBER

ERROR_DIVISION_BY_ZERO

public static final java.lang.Integer ERROR_DIVISION_BY_ZERO

ERROR_ERR

public static final java.lang.Integer ERROR_ERR

JEKS_FUNCTION_IF

public static final java.lang.Integer JEKS_FUNCTION_IF

MESSAGE_CIRCULARITY_ERROR_TITLE

public static final java.lang.Integer MESSAGE_CIRCULARITY_ERROR_TITLE

MESSAGE_CIRCULARITY_ERROR_CONFIRM

public static final java.lang.Integer MESSAGE_CIRCULARITY_ERROR_CONFIRM

MESSAGE_CIRCULARITY_ERROR_INFO

public static final java.lang.Integer MESSAGE_CIRCULARITY_ERROR_INFO
Constructor Detail

JeksExpressionSyntax

public JeksExpressionSyntax()
Creates an instance of JeksExpressionSyntax with default locale.

JeksExpressionSyntax

public JeksExpressionSyntax(java.util.Locale locale)
Creates an instance of JeksExpressionSyntax initialized with the resource bundle com.eteks.jeks.syntax. The syntax may be localized with an appropriate locale. See the default locale file com/eteks/jeks/resources/syntax.properties to see which type of syntax is described by a JeksExpressionSyntax object.
Method Detail

getCellError

public java.lang.String getCellError(java.lang.Object cellErrorKey)
Returns the localized string code used to describe the cell error cellErrorKey.

getCellError

public java.lang.String getCellError(java.lang.Throwable error)
Returns a localized error string matching the exception error.
Parameters:
error - an exception thrown at the interpretation time of an expression.
Returns:
a localized string or null if error doesn't match any forseen exception.

getConditionPartKey

public java.lang.Object getConditionPartKey(java.lang.String conditionPart)
Returns null. This method is overriden to disable the condition operator in an expression. Users may use the user function IF(,,) instead.
Overrides:
getConditionPartKey in class AbstractSyntax
Following copied from class: com.eteks.parser.AbstractSyntax
Parameters:
conditionPart - the string to test.
Returns:
the key associated with the conditional part conditionPart.

getMessage

public java.lang.String getMessage(java.lang.Object messageKey)
Returns the localized message matching the key messageKey.
Overrides:
getMessage in class JeksFunctionSyntax

getCellSetSeparator

public char getCellSetSeparator()
Returns the character used to separate the two cells of a set.
Returns:
A seperator character.

getConstantChar

public char getConstantChar()
Returns the character representing a constant row or column.
Returns:
The constant character.

isValidIdentifier

public boolean isValidIdentifier(java.lang.String identifier)
Returns true if identifier is a valid identifier for a function or is a cell identifier.
Overrides:
isValidIdentifier in class JeksFunctionSyntax
Following copied from class: com.eteks.jeks.JeksFunctionSyntax
Parameters:
identifier - the string to test.
Returns:
true if identifier is a correct identifier.

isCellIdentifier

public boolean isCellIdentifier(java.lang.String identifier)
Returns true if identifier represents a cell. The syntax for a single cell is one or more letters followed by a number. A set of cells is separated by the character returned by getCellSetSeparator (). The letters and the number may be prefixed by the constant char returned by getConstantChar ().

getCellAt

public JeksCell getCellAt(java.lang.String identifier)
Returns a cell at the coordinates contained in the string identifier.
Parameters:
identifier - A string representing a cell (a group of letters followed by a number). It may contain JeksExpressionSyntax.getConstantChar () ('$' character by default).
Returns:
Returns an instance of JeksCell matching indentifier.

getRowName

public java.lang.String getRowName(int row)
Returns a string equivalent to row.
Parameters:
row - A cell row index.
Returns:
The string value of row + 1.

getColumnName

public java.lang.String getColumnName(int column)
Returns a string equivalent to column.
Parameters:
row - A cell column index.
Returns:
The string value of column using a group of letters.

toString

public java.lang.String toString(JeksCell cell)
Returns a string equivalent to cell.
Parameters:
cell - A cell.
Returns:
The string value of cell using a group of letters and a number

toString

public java.lang.String toString(int row,
                                 boolean rowConstant,
                                 int column,
                                 boolean columnConstant)
Returns a string equivalent to cell.
Parameters:
cell - A cell.
Returns:
The string value of cell using a group of letters and a number

&cp; 1998-2003 eTeks - All rights reserved