rails.util
Class Util

java.lang.Object
  extended by rails.util.Util

public final class Util
extends java.lang.Object


Field Summary
protected static org.apache.log4j.Logger log
           
 
Method Summary
static
<T extends Moveable,U extends T>
boolean
addToList(java.util.List<T> objects, U object, int position)
          Safely add an object to a List at a given position
static java.lang.String appendWithDelimiter(java.lang.String s1, java.lang.String s2, java.lang.String delimiter)
           
static boolean bitSet(int value, int bitmask)
           
static java.lang.String convertToHtml(java.lang.String javaString)
          Convert java string to html string Transformations: - Converts \n to
static org.apache.log4j.Logger getLogger()
           
static boolean hasValue(java.lang.String s)
           
static boolean isDark(java.awt.Color c)
          Is a colour dark? (to check if FG colour needs be reversed)
static java.lang.String joinWithDelimiter(int[] sa, java.lang.String delimiter)
           
static java.lang.String joinWithDelimiter(java.lang.String[] sa, java.lang.String delimiter)
           
static java.lang.String lowerCaseFirst(java.lang.String text)
           
static
<T extends Moveable>
void
moveObjects(java.util.List<T> objects, MoveableHolder to)
          Safely move a list of objects from one holder to another, avoiding ConcurrentModificationExceptions.
static boolean parseBoolean(java.lang.String s)
          Parse a boolean value for Rails
static java.awt.Color parseColour(java.lang.String s)
          Parse a colour definition string.
static int parseInt(java.lang.String value)
           
static int setBit(int value, int bitmask, boolean set)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.log4j.Logger log
Method Detail

hasValue

public static boolean hasValue(java.lang.String s)

appendWithDelimiter

public static java.lang.String appendWithDelimiter(java.lang.String s1,
                                                   java.lang.String s2,
                                                   java.lang.String delimiter)

joinWithDelimiter

public static java.lang.String joinWithDelimiter(java.lang.String[] sa,
                                                 java.lang.String delimiter)

joinWithDelimiter

public static java.lang.String joinWithDelimiter(int[] sa,
                                                 java.lang.String delimiter)

parseInt

public static int parseInt(java.lang.String value)
                    throws ConfigurationException
Throws:
ConfigurationException

bitSet

public static boolean bitSet(int value,
                             int bitmask)

setBit

public static int setBit(int value,
                         int bitmask,
                         boolean set)

convertToHtml

public static java.lang.String convertToHtml(java.lang.String javaString)
Convert java string to html string Transformations: - Converts \n to


moveObjects

public static <T extends Moveable> void moveObjects(java.util.List<T> objects,
                                                    MoveableHolder to)
Safely move a list of objects from one holder to another, avoiding ConcurrentModificationExceptions.

Parameters:
from -
to -
objects -

addToList

public static <T extends Moveable,U extends T> boolean addToList(java.util.List<T> objects,
                                                                 U object,
                                                                 int position)
Safely add an object to a List at a given position

Parameters:
objects - The List to add the object to.
object - The object to be added.
position - The position at which the object must be added.
If between 0 and the current list size (inclusive), the object is inserted at the given position.
If -1, the object is inserted at the end.
If any other value, nothing is done.
Returns:
True if the insertion was successful.

parseBoolean

public static boolean parseBoolean(java.lang.String s)
Parse a boolean value for Rails

Parameters:
value - string (allowed values for true: standard Boolean.parseBoolean and yes (after conversion to lowercase)
Returns:
parsed value

parseColour

public static java.awt.Color parseColour(java.lang.String s)
                                  throws ConfigurationException
Parse a colour definition string. Currently supported formats: "RRGGBB" - each character being a hexadecimal digit "r,g,b" - each letter representing an integer 0..255

Parameters:
s -
Returns:
Throws:
ConfigurationException

isDark

public static boolean isDark(java.awt.Color c)
Is a colour dark? (to check if FG colour needs be reversed)


getLogger

public static org.apache.log4j.Logger getLogger()

lowerCaseFirst

public static java.lang.String lowerCaseFirst(java.lang.String text)