edu.neu.ccs.parser
Class ParserUtilities

java.lang.Object
  |
  +--edu.neu.ccs.parser.ParserUtilities

public class ParserUtilities
extends Object

Provides utility methods for use with parser operations.

Since:
1.0
See Also:
Parser

Constructor Summary
ParserUtilities()
           
 
Method Summary
static Parser getDefaultParser()
          Returns the default parser used by JPT classes.
static boolean isXBoolean(Object x)
          Return true if x is XBoolean.
static boolean isXFloating(Object x)
          Return true if x is floating, that is, if x is one of the types: XBigDecimal, XDouble, XFloat.
static boolean isXIntegral(Object x)
          Return true if x is integral, that is, if x is one of the types: XBigInteger, XLong, XInt, XShort, XByte.
static boolean isXNumber(Object x)
          Return true if x is an XNumber.
static void setDefaultParser(Parser p)
          Sets the default parser used by JPT classes to the given parser.
static XBigDecimal toXBigDecimal(XNumber value)
          Converts the given value to XBigDecimal.
static XBigInteger toXBigInteger(XNumber value)
          Converts the given value to XBigInteger.
static XDouble toXDouble(XNumber value)
          Converts the given value to XDouble.
static XLong toXLong(XNumber value)
          Converts the given value to XLong.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParserUtilities

public ParserUtilities()
Method Detail

getDefaultParser

public static Parser getDefaultParser()
Returns the default parser used by JPT classes.


setDefaultParser

public static void setDefaultParser(Parser p)
Sets the default parser used by JPT classes to the given parser. If null, the default parser is set to the standard default parser for the JPT.

Parameters:
p - the desired default parser

isXNumber

public static boolean isXNumber(Object x)
Return true if x is an XNumber.


isXIntegral

public static boolean isXIntegral(Object x)
Return true if x is integral, that is, if x is one of the types: XBigInteger, XLong, XInt, XShort, XByte.


isXFloating

public static boolean isXFloating(Object x)
Return true if x is floating, that is, if x is one of the types: XBigDecimal, XDouble, XFloat.


isXBoolean

public static boolean isXBoolean(Object x)
Return true if x is XBoolean.


toXLong

public static XLong toXLong(XNumber value)
Converts the given value to XLong.

Parameters:
value - the value to be converted

toXDouble

public static XDouble toXDouble(XNumber value)
Converts the given value to XDouble.

Parameters:
value - the value to be converted

toXBigInteger

public static XBigInteger toXBigInteger(XNumber value)
Converts the given value to XBigInteger.

Parameters:
value - the value to be converted

toXBigDecimal

public static XBigDecimal toXBigDecimal(XNumber value)
Converts the given value to XBigDecimal.

Parameters:
value - the value to be converted