info.textgrid.utils.linkrewriter
Class TokenReplacement

java.lang.Object
  extended by info.textgrid.utils.linkrewriter.AbstractReplacement
      extended by info.textgrid.utils.linkrewriter.TokenReplacement

public class TokenReplacement
extends AbstractReplacement

A replacement that replaces on a token-by-token basis.

Author:
vitt

Field Summary
Modifier and Type Field and Description
 
Fields inherited from class info.textgrid.utils.linkrewriter.AbstractReplacement
from, to
 
Constructor Summary
Constructor and Description
TokenReplacement(String from, String to)
           
 
Method Summary
Modifier and Type Method and Description
 String apply(String in)
          applies this replacement to the given string.
 
Methods inherited from class info.textgrid.utils.linkrewriter.AbstractReplacement
apply, create, create
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TokenReplacement

public TokenReplacement(String from,
                        String to)
Method Detail

apply

public String apply(String in)
applies this replacement to the given string. The TokenReplacement implementation first tokenizes the given string and then checks each token whether it matches either the from string or the from string + '#' + a fragment. If so, the the replacement is applied. Everything else is passed in unchanged.

Specified by:
apply in class AbstractReplacement


Copyright © 2012 TextGrid. All Rights Reserved.