org.fraid.utils
Class Utils

java.lang.Object
  extended by org.fraid.utils.Utils

public class Utils
extends java.lang.Object

Variuos utilities used in the system.


Field Summary
protected static boolean sIsDebugParser
          Indicator if debug parser is used.
 
Constructor Summary
Utils()
           
 
Method Summary
static int count(char aChar, java.lang.String aString)
          Helper.
static java.lang.String fileToString(java.lang.String aFileName)
          Helper.
static java.lang.Object getMapKeyOf(java.util.Map aMap, java.lang.Object aMapped)
          Reverse mapping.
static java.lang.String getRelativePath(java.lang.String aAbsolutePath, java.lang.String aPrefixPath)
          Helper function.
static boolean isDebugParser()
          Checks if in debug mode;
static java.lang.String normalizeFileName(java.lang.String aFileName)
           
static void setDebugParser(boolean aMode)
          Sets debug mode on or off;
static java.lang.String trimDouble(java.lang.String aDoubleString, int aNumberDigits)
          Formats a string representation of a double.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sIsDebugParser

protected static boolean sIsDebugParser
Indicator if debug parser is used. If true, the info stream will print the transformations of the parsing tree

Constructor Detail

Utils

public Utils()
Method Detail

isDebugParser

public static boolean isDebugParser()
Checks if in debug mode;

Returns:
a boolean value

setDebugParser

public static void setDebugParser(boolean aMode)
Sets debug mode on or off;

Parameters:
aMode - a boolean value

fileToString

public static java.lang.String fileToString(java.lang.String aFileName)
                                     throws java.io.IOException
Helper. Reads the content of a file into a String.

Parameters:
aFileName - a String value
Returns:
a String value
Throws:
java.io.IOException

getRelativePath

public static java.lang.String getRelativePath(java.lang.String aAbsolutePath,
                                               java.lang.String aPrefixPath)
Helper function.

Parameters:
aAbsolutePath - a String value
aPrefixPath - a String value
Returns:
a String value

trimDouble

public static java.lang.String trimDouble(java.lang.String aDoubleString,
                                          int aNumberDigits)
Formats a string representation of a double. Helper function.

Parameters:
aDoubleString - a String value
aNumberDigits - an int value
Returns:
a String value

getMapKeyOf

public static java.lang.Object getMapKeyOf(java.util.Map aMap,
                                           java.lang.Object aMapped)
Reverse mapping. Returns the key of an object stored in a Map. Use only if there is one to one correspondence between keys and objects.

Parameters:
aMap - a Map value
aMapped - an Object value
Returns:
the key for aMapped or null

count

public static int count(char aChar,
                        java.lang.String aString)
Helper.

Parameters:
aChar - a char value
aString - a String value
Returns:
an int value

normalizeFileName

public static java.lang.String normalizeFileName(java.lang.String aFileName)


Fraid (system and language). (C) 2003-2007 Ivaylo Iliev
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.