org.hops.common
Class util

java.lang.Object
  extended by org.hops.common.util

public class util
extends java.lang.Object


Constructor Summary
util()
           
 
Method Summary
static boolean containsIgnoreCase(java.util.ArrayList ar, java.lang.String v)
          arrylist contains with ignore case
static java.lang.String HopsReplacement(java.lang.String doc, java.lang.String strMark, java.lang.String strText)
          This function is as String.replace() but it does manyally the replacement since the java implementation has problems with certain characters
static java.util.HashMap loadFile(java.lang.String file)
          Loads a file
static java.util.HashMap loadMultiFile(java.lang.String nlgmessages)
          load the file: Each property has more than one value
static java.lang.String Read()
          reads from the console
static java.lang.Object resizeArray(java.lang.Object oldArray, int newSize)
          Reallocates an array with a new size, and copies the contents of the old array to the new array.
static double truncate(double x)
          truncate double
static void Write(java.lang.String _sent)
          writes to the console
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

util

public util()
Method Detail

Write

public static void Write(java.lang.String _sent)
writes to the console

Parameters:
_sent - the message

Read

public static java.lang.String Read()
reads from the console

Returns:
the sentence read

truncate

public static double truncate(double x)
truncate double


resizeArray

public static java.lang.Object resizeArray(java.lang.Object oldArray,
                                           int newSize)
Reallocates an array with a new size, and copies the contents of the old array to the new array.

Parameters:
oldArray - the old array, to be reallocated.
newSize - the new array size.
Returns:
A new array with the same contents.

loadFile

public static java.util.HashMap loadFile(java.lang.String file)
                                  throws java.lang.Exception
Loads a file

Parameters:
file - filename
Returns:
a HashMap table
Throws:
java.lang.Exception

loadMultiFile

public static java.util.HashMap loadMultiFile(java.lang.String nlgmessages)
                                       throws java.lang.Exception
load the file: Each property has more than one value

Parameters:
nlgmessages - the properties file
Returns:
a HashMap with the values of each property
Throws:
java.lang.Exception

containsIgnoreCase

public static boolean containsIgnoreCase(java.util.ArrayList ar,
                                         java.lang.String v)
arrylist contains with ignore case


HopsReplacement

public static java.lang.String HopsReplacement(java.lang.String doc,
                                               java.lang.String strMark,
                                               java.lang.String strText)
This function is as String.replace() but it does manyally the replacement since the java implementation has problems with certain characters

Parameters:
doc - the document to replace
strMark - the mark to find
strText - the new text to put instead of strMark
Returns:
the document with the replacement done. doc.ReplaceAll( strMark, strText )