|
Jadex 0.96-beta1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjadex.util.SUtil
public class SUtil
This class provides several useful static util methods.
Field Summary | |
---|---|
static int |
CONVERT_ALL
Constant that indicates a conversion of all known characters. |
static int |
CONVERT_ALL_EXCEPT_AMP
Constant that indicates a conversion of all known characters except &. |
static int |
CONVERT_NONE
Constant that indicates a conversion of no characters. |
static String |
NULL
A Null value. |
static int |
SORT_DOWN
Constant for sorting down. |
static int |
SORT_UP
Constant for sorting up. |
Constructor Summary | |
---|---|
SUtil()
|
Method Summary | |
---|---|
static boolean |
arrayContains(Object array,
Object value)
Check if an element is contained in an array. |
static boolean |
arrayEquals(Object array1,
Object array2)
|
static List |
arrayToList(Object a)
Transform an array to a vector. |
static Set |
arrayToSet(Object a)
Transform an array to a vector. |
static String |
arrayToString(Object array)
Get a string representation for an array. |
static List |
calculateCartesianProduct(String[] names,
Object[] values)
Calculate the cartesian product of parameters. |
static String |
colorToHTML(Color color)
Convert a color to an html representation. |
static int |
compareTo(String a,
String b)
Compares two strings, ignoring case. |
static String |
convertPathToPackage(String path)
Find a package name from a path. |
static Object |
cutArrays(Object a1,
Object a2)
Cut two arrays. |
static boolean |
equals(Object val1,
Object val2)
|
static String |
fontToHTML(Font font)
Convert a font to an html representation. |
static String |
getDurationHMS(long ms)
Get a string representation for a duration. |
static String |
getPlural(String s)
Get the plural of a word in singular. |
static String |
getRelativePath(String startdir,
String destdir)
Find the relativ path from a start directory to a destination directory. |
static InputStream |
getResource(String name)
Get an input stream for whatever provided. 1. |
static InputStream |
getResource0(String name)
Get an input stream for whatever provided. 1. |
static ResourceInfo |
getResourceInfo0(String name)
Get an input stream for whatever provided. 1. |
static String |
getSingular(String s)
Get the singular of a word in plural. |
static String[] |
getStringArray(String key,
Properties props)
Get a string array of properties that are separated by commas. |
static boolean |
isInRange(Date date,
Date start,
Date end)
Test if the date is in the range. |
static Object[] |
iteratorToArray(Iterator it,
Class clazz)
Transform an iterator to an array. |
static List |
iteratorToList(Iterator it)
Transform an iterator to a list. |
static List |
iteratorToList(Iterator it,
List ret)
Transform an iterator to a list. |
static Object[] |
joinArbitraryArrays(Object[] as)
Joins any arrays of (possibly) different type. |
static Object |
joinArrays(Object a1,
Object a2)
Joins two arrays of the same type. |
static String |
makeConform(String input)
Convert an output to html/wml conform presentation. |
static String |
makeConform(String input,
int flag)
Convert an output to html/wml conform presentation. |
static String |
makeEnglishConform(String input)
Convert an output readable in english. |
static String |
removeExtension(String fn)
Remove file extension. |
static void |
replace(String source,
StringBuffer dest,
String old,
String newstring)
Parse a source string replacing occurrences and storing the result in the given string buffer. |
static String |
replace(String source,
String old,
String newstring)
Parse a source string replacing occurrences and returning the result. |
static String |
stripTags(String source)
Strip tags (e.g. html) from a string, leaving only the text content. |
static Object |
substractArrays(Object a1,
Object a2)
First array minus second array. |
static String |
wrapText(String text)
Wrap a text at a given line length. |
static String |
wrapText(String text,
int wrap)
Wrap a text at a given line length. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int CONVERT_ALL
public static final int CONVERT_ALL_EXCEPT_AMP
public static final int CONVERT_NONE
public static final String NULL
public static final int SORT_UP
public static final int SORT_DOWN
Constructor Detail |
---|
public SUtil()
Method Detail |
---|
public static String[] getStringArray(String key, Properties props)
key
- The key.props
- The properties.
public static Object joinArrays(Object a1, Object a2)
a1
- The first array.a2
- The second array.
public static Object[] joinArbitraryArrays(Object[] as)
as
- The array of arrays to join..
public static Object cutArrays(Object a1, Object a2)
a1
- The first array.a2
- The second array.
public static Object substractArrays(Object a1, Object a2)
a1
- The first array.a2
- The second array.
public static List arrayToList(Object a)
a
- The array.
public static Set arrayToSet(Object a)
a
- The array.
public static List iteratorToList(Iterator it)
public static List iteratorToList(Iterator it, List ret)
public static Object[] iteratorToArray(Iterator it, Class clazz)
public static boolean arrayContains(Object array, Object value)
array
- The array.value
- The value.public static boolean equals(Object val1, Object val2)
public static boolean arrayEquals(Object array1, Object array2)
public static String arrayToString(Object array)
array
- The array.
public static String getSingular(String s)
s
- The plural word.
public static String getPlural(String s)
s
- The word.
public static int compareTo(String a, String b)
a
- The first string.b
- The second string.
public static boolean isInRange(Date date, Date start, Date end)
date
- The date.start
- The start.end
- The end.
public static String removeExtension(String fn)
fn
- The filename..
public static String wrapText(String text)
text
- The text to wrap.public static String wrapText(String text, int wrap)
text
- The text to wrap.wrap
- The column width.public static String makeConform(String input)
input
- The input string.
public static String makeConform(String input, int flag)
input
- The input string.flag
- CONVERT_ALL, CONVERT_NONE, CONVERT_ALL_EXCEPT_AMP;
public static String stripTags(String source)
public static String makeEnglishConform(String input)
input
- The input string.
public static String colorToHTML(Color color)
color
- The color.
public static String fontToHTML(Font font)
font
- The font.
public static void replace(String source, StringBuffer dest, String old, String newstring)
source
- The source string.dest
- The destination string buffer.old
- The string to replace.newstring
- The string to use as replacement.public static String replace(String source, String old, String newstring)
source
- The source string.old
- The string to replace.newstring
- The string to use as replacement.public static InputStream getResource(String name) throws IOException
name
- The resource description.
IOException
- when the resource was not found.public static InputStream getResource0(String name)
name
- The resource description.
public static ResourceInfo getResourceInfo0(String name)
name
- The resource description.
public static String getDurationHMS(long ms)
ms
- The duration in ms.
public static String convertPathToPackage(String path)
path
- The directory.
public static List calculateCartesianProduct(String[] names, Object[] values)
names
- The names.values
- The values (must be some form of collection, i.e. array, list, iterator etc.)public static String getRelativePath(String startdir, String destdir)
startdir
- The start directory.destdir
- The destination directory.
|
Jadex 0.96-beta1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright (C) 2002-2007 Lars Braubach, Alexander Pokahr - University of Hamburg. Use is subject to license terms.