Crossfire JXClient, Trunk  R20561
com.realtime.crossfire.jxclient.util.NumberParser Class Reference

Utility class for parsing strings into numbers. More...

+ Collaboration diagram for com.realtime.crossfire.jxclient.util.NumberParser:

Static Public Member Functions

static boolean parseBoolean (@NotNull final String str) throws IOException
 Parses a boolean constant. More...
 
static< T extends Enum< T > T parseEnum (@NotNull final Class< T > class_, @NotNull final String name, @NotNull final String ident) throws IOException
 Parses an enum constant. More...
 
static float parseFloat (@NotNull final String str) throws IOException
 Parses a float constant. More...
 
static int parseInt (@NotNull final String string, final int defaultValue)
 Converts a string into an int value. More...
 
static int parseInt (@NotNull final String string, final int defaultValue, final int minValue, final int maxValue)
 Converts a string into an int value in the given bounds. More...
 
static long parseLong (@NotNull final String string, final long defaultValue)
 Converts a string into a long value. More...
 

Private Member Functions

 NumberParser ()
 Private constructor to prevent instantiation. More...
 

Detailed Description

Utility class for parsing strings into numbers.

Author
Andreas Kirschbaum

Definition at line 31 of file NumberParser.java.

Constructor & Destructor Documentation

◆ NumberParser()

com.realtime.crossfire.jxclient.util.NumberParser.NumberParser ( )
private

Private constructor to prevent instantiation.

Definition at line 36 of file NumberParser.java.

Member Function Documentation

◆ parseBoolean()

static boolean com.realtime.crossfire.jxclient.util.NumberParser.parseBoolean ( @NotNull final String  str) throws IOException
static

◆ parseEnum()

static <T extends Enum<T> T com.realtime.crossfire.jxclient.util.NumberParser.parseEnum ( @NotNull final Class< T >  class_,
@NotNull final String  name,
@NotNull final String  ident 
) throws IOException
static

Parses an enum constant.

Parameters
<T>the enum class
class_the enum class the enum constant belongs to
namethe enum constant to parse
identthe description of the enum class for building error messages
Returns
the enum constant
Exceptions
IOExceptionif the enum constant does not exist

Definition at line 127 of file NumberParser.java.

Referenced by com.realtime.crossfire.jxclient.skin.io.JXCSkinLoader.parseCommandList(), com.realtime.crossfire.jxclient.skin.io.JXCSkinLoader.parseDialogHide(), com.realtime.crossfire.jxclient.skin.io.CommandParser.parseExecSelection(), com.realtime.crossfire.jxclient.skin.io.JXCSkinLoader.parseLabelSpell(), com.realtime.crossfire.jxclient.skin.io.JXCSkinLoader.parseLabelStat(), and com.realtime.crossfire.jxclient.skin.io.JXCSkinLoader.parseLabelStat2().

+ Here is the caller graph for this function:

◆ parseFloat()

static float com.realtime.crossfire.jxclient.util.NumberParser.parseFloat ( @NotNull final String  str) throws IOException
static

Parses a float constant.

Parameters
strthe floating constant string to parse
Returns
the floating value
Exceptions
IOExceptionif a parsing error occurs

Definition at line 94 of file NumberParser.java.

Referenced by com.realtime.crossfire.jxclient.skin.io.ParseUtils.parseColorNull(), com.realtime.crossfire.jxclient.skin.io.JXCSkinLoader.parseDef(), com.realtime.crossfire.jxclient.skin.io.JXCSkinLoader.parseFill(), com.realtime.crossfire.jxclient.skin.io.JXCSkinLoader.parseFont(), and com.realtime.crossfire.jxclient.skin.io.JXCSkinLoader.parsePicture().

+ Here is the caller graph for this function:

◆ parseInt() [1/2]

static int com.realtime.crossfire.jxclient.util.NumberParser.parseInt ( @NotNull final String  string,
final int  defaultValue 
)
static

Converts a string into an int value.

Parameters
stringthe string to convert
defaultValuethe value to return if the number is not a string
Returns
the int value

Definition at line 45 of file NumberParser.java.

Referenced by com.realtime.crossfire.jxclient.settings.Settings.getInt(), com.realtime.crossfire.jxclient.util.NumberParser.parseInt(), com.realtime.crossfire.jxclient.metaserver.MetaserverEntryParser.parseLine(), and com.realtime.crossfire.jxclient.window.JXCConnection.setHost().

+ Here is the caller graph for this function:

◆ parseInt() [2/2]

static int com.realtime.crossfire.jxclient.util.NumberParser.parseInt ( @NotNull final String  string,
final int  defaultValue,
final int  minValue,
final int  maxValue 
)
static

Converts a string into an int value in the given bounds.

Parameters
stringthe string to convert
defaultValuethe value to return if the number is not a string or not within bounds
minValuethe bound's minimum value
maxValuethe bound's maximum value
Returns
the int value

Definition at line 63 of file NumberParser.java.

References com.realtime.crossfire.jxclient.util.NumberParser.parseInt().

+ Here is the call graph for this function:

◆ parseLong()

static long com.realtime.crossfire.jxclient.util.NumberParser.parseLong ( @NotNull final String  string,
final long  defaultValue 
)
static

Converts a string into a long value.

Parameters
stringthe string to convert
defaultValuethe value to return if the number is not a string
Returns
the long value

Definition at line 79 of file NumberParser.java.

Referenced by com.realtime.crossfire.jxclient.settings.Settings.getLong(), and com.realtime.crossfire.jxclient.metaserver.MetaserverEntryParser.parseLine().

+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: