de.ls5.jlearn.util
Class WordUtil

java.lang.Object
  extended by de.ls5.jlearn.util.WordUtil

public class WordUtil
extends Object

Author:
fh

Constructor Summary
WordUtil()
           
 
Method Summary
static Word canonicalNext(Word w, Alphabet sigma)
           
static Word clone(Word w)
           
static Word concat(Word w1, Symbol s)
          returns a copy of the original Word with one Symbol attached
static Word concat(Word w1, Symbol s1, Symbol s2)
          retuerns a copy of the original Word with two Symbols attached
static Word concat(Word w1, Word w2)
          concatenates two words and returns a corresponding NEW word
static Word flattenTrace(Word trace)
          Fold "virtual" letters (splitters) back to the normal alphabet
static boolean isPrefixOf(Word w1, Word w2)
          Checks if the first given Word is a prefix of the second given Word
static Symbol lastSymbol(Word w)
           
static Word prefix(Word w1, int length)
           
static Word suffix(Word w1, int length)
           
static Word toWord(Symbol s)
          cast symbol to word
static Symbol turnWordIntoSymbol(Word w)
          Turn word into a symbol, which has a list of the symbols of the input word as user object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WordUtil

public WordUtil()
Method Detail

toWord

public static Word toWord(Symbol s)
cast symbol to word

Parameters:
s -
Returns:

concat

public static Word concat(Word w1,
                          Word w2)
concatenates two words and returns a corresponding NEW word

Parameters:
w1 -
w2 -
Returns:

concat

public static Word concat(Word w1,
                          Symbol s)
returns a copy of the original Word with one Symbol attached

Parameters:
w1 -
s -
Returns:

concat

public static Word concat(Word w1,
                          Symbol s1,
                          Symbol s2)
retuerns a copy of the original Word with two Symbols attached

Parameters:
w1 -
s1 -
s2 -
Returns:

suffix

public static Word suffix(Word w1,
                          int length)
Parameters:
w1 -
length -
Returns:

prefix

public static Word prefix(Word w1,
                          int length)
Parameters:
w1 -
length -
Returns:

lastSymbol

public static Symbol lastSymbol(Word w)

flattenTrace

public static Word flattenTrace(Word trace)
Fold "virtual" letters (splitters) back to the normal alphabet


clone

public static Word clone(Word w)

canonicalNext

public static Word canonicalNext(Word w,
                                 Alphabet sigma)

turnWordIntoSymbol

public static Symbol turnWordIntoSymbol(Word w)
Turn word into a symbol, which has a list of the symbols of the input word as user object

Parameters:
w - word to be turned into a symbol
Returns:
symbol with list of symbols as user object

isPrefixOf

public static boolean isPrefixOf(Word w1,
                                 Word w2)
Checks if the first given Word is a prefix of the second given Word

Parameters:
w1 - Word for which the prefix property is to be evaluated
w2 - Word against which w1 is checked against
Returns:
boolean flag indicating prefix property


Copyright © 2011. All Rights Reserved.