choco.kernel.common.util.tools
Class StringUtils

java.lang.Object
  extended by choco.kernel.common.util.tools.StringUtils

public class StringUtils
extends Object


Method Summary
static String dirName(String n1, String n2)
           
static String dirRandomName(String n1, String n2)
           
static String format(IntDomainVar iv)
           
static String format(IntegerVariable iv)
           
static String format(int lb, int ub)
           
static DisposableIterator<String> getOptionIterator(String options)
           
static String pad(String str, int padlen, String pad)
          Pads out a string upto padlen with pad chars
static String pretty(Collection<? extends IPretty> elems)
           
static String pretty(int c)
           
static String pretty(int[] lval)
           
static String pretty(int[][] lvals)
           
static String pretty(IPretty... elems)
           
static String pretty(IPretty[] elems, int begin, int end)
           
static String pretty(ISearchMeasures measures)
           
static String pretty(ITask t)
           
static String pretty(Iterator<? extends IPretty> iter)
           
static String prettyOnePerLine(Collection<? extends IPretty> elems)
           
static String prettyOnePerLine(ISearchMeasures measures)
           
static String prettyOnePerLine(Iterator<? extends IPretty> iter)
          Pretty print of elements on 1 line
static String randomName()
          Return a generated short, random string
static String toCharExp(String strRegExp)
          Convert a regexp formed with integer charachter into a char formed regexp for instance, "12%12%" which stands for 1 followed by 2 followed by 12 would be misinterpreted by regular regular expression parser.
static String toDotty(ITask t, String label, boolean format, String... options)
          convert a task into .dot format.
static String toIntExp(String charExp)
          Transform a char regexp into an int regexp w.r.t. the asci code of each character.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

pad

public static String pad(String str,
                         int padlen,
                         String pad)
Pads out a string upto padlen with pad chars

Parameters:
str - string to be padded
padlen - length of pad (+ve = pad on right, -ve pad on left)
pad - character
Returns:
padded string

getOptionIterator

public static DisposableIterator<String> getOptionIterator(String options)

pretty

public static String pretty(IPretty[] elems,
                            int begin,
                            int end)

pretty

public static String pretty(IPretty... elems)

prettyOnePerLine

public static String prettyOnePerLine(Collection<? extends IPretty> elems)

prettyOnePerLine

public static String prettyOnePerLine(Iterator<? extends IPretty> iter)
Pretty print of elements on 1 line

Parameters:
iter - iterator over element
Returns:
pretty print of elements into a String

pretty

public static String pretty(Collection<? extends IPretty> elems)

pretty

public static String pretty(Iterator<? extends IPretty> iter)

pretty

public static String pretty(int[] lval)

pretty

public static String pretty(int[][] lvals)

pretty

public static String pretty(int c)

prettyOnePerLine

public static String prettyOnePerLine(ISearchMeasures measures)

pretty

public static String pretty(ISearchMeasures measures)

toCharExp

public static String toCharExp(String strRegExp)
Convert a regexp formed with integer charachter into a char formed regexp for instance, "12%12%" which stands for 1 followed by 2 followed by 12 would be misinterpreted by regular regular expression parser. We use here the asci code to encode everything as a single char. Due to char encoding limits, we cannot parse int greater than 2^16-1

Parameters:
strRegExp - a regexp of integer
Returns:
a char regexp

toIntExp

public static String toIntExp(String charExp)
Transform a char regexp into an int regexp w.r.t. the asci code of each character.

Parameters:
charExp - a char regexp
Returns:
an int regexp

randomName

public static String randomName()
Return a generated short, random string

Returns:
String

format

public static String format(int lb,
                            int ub)

format

public static String format(IntegerVariable iv)

format

public static String format(IntDomainVar iv)

pretty

public static String pretty(ITask t)

toDotty

public static String toDotty(ITask t,
                             String label,
                             boolean format,
                             String... options)
convert a task into .dot format.

Parameters:
label - information appended to the default label
format - if true then format the node, else do nothing
options - the options passed to the .dot node.
Returns:

dirName

public static String dirName(String n1,
                             String n2)

dirRandomName

public static String dirRandomName(String n1,
                                   String n2)


Copyright © 2012. All Rights Reserved.