com.realtime.crossfire.jxclient.skin.io
Class ExpressionParser

java.lang.Object
  extended by com.realtime.crossfire.jxclient.skin.io.ExpressionParser

public class ExpressionParser
extends java.lang.Object

Parser for integer expressions.


Field Summary
private static java.lang.String HEIGHT
          The identifier evaluating to the height in pixels of the current resolution.
private static java.util.regex.Pattern PATTERN_EXPR
          Pattern to parse integer constants.
private static java.lang.String WIDTH
          The identifier evaluating to the width in pixels of the current resolution.
 
Constructor Summary
private ExpressionParser()
          Private constructor to prevent instantiation.
 
Method Summary
static Expression parseExpression(java.lang.String str)
          Parses an integer constant.
static int parseInt(java.lang.String str)
          Parses an integer constant.
private static Expression parseIntegerConstant(java.lang.String str)
          Parses an integer constant string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HEIGHT

@NotNull
private static final java.lang.String HEIGHT
The identifier evaluating to the height in pixels of the current resolution.

See Also:
Constant Field Values

PATTERN_EXPR

@NotNull
private static final java.util.regex.Pattern PATTERN_EXPR
Pattern to parse integer constants.


WIDTH

@NotNull
private static final java.lang.String WIDTH
The identifier evaluating to the width in pixels of the current resolution.

See Also:
Constant Field Values
Constructor Detail

ExpressionParser

private ExpressionParser()
Private constructor to prevent instantiation.

Method Detail

parseExpression

@NotNull
public static Expression parseExpression(@NotNull
                                                 java.lang.String str)
                                  throws java.io.IOException
Parses an integer constant. Valid constants are "3", "3+4", and "1+2-3+4".

Parameters:
str - the integer constant string to parse
Returns:
the integer expression
Throws:
java.io.IOException - if a parsing error occurs

parseInt

public static int parseInt(@NotNull
                           java.lang.String str)
                    throws java.io.IOException
Parses an integer constant. Valid constants are "3", "3+4", and "1+2-3+4".

Parameters:
str - the integer constant string to parse
Returns:
the integer value
Throws:
java.io.IOException - if a parsing error occurs

parseIntegerConstant

@NotNull
private static Expression parseIntegerConstant(@NotNull
                                                       java.lang.String str)
Parses an integer constant string.

Parameters:
str - the string
Returns:
the integer expression
Throws:
java.lang.NumberFormatException - if the string cannot be parsed