package com.readytalk.swt.text.tokenizer;

import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;

import com.readytalk.swt.text.painter.TextType;

class PlainTextTokenizer implements TextTokenizer {
  
  private List<TextToken> tokens = new ArrayList<TextToken>();
  private Charset encoding = Charset.defaultCharset(); 
      
  @Override
  public TextTokenizer setEncoding(Charset encoding) {
    this.encoding = encoding;
    return this;
  }
  
  @Override
  public Charset getEncoding() {
    return encoding;
  }
  
  @Override
  public TextTokenizer reset() {
    tokens.clear();
    return this;
  }
  
  public List<TextToken> tokenize(String text) {
	
	if(text == null || "".equals(text)) {
		return tokens;
	}
	
    TextToken textToken = new TextToken(TextType.TEXT, text);
    tokens.add(textToken);
    return tokens;
  }
}

@@ -222,19 +222,17 @@
 nizer %7B%0A
-  
 %0A
+
   privat
@@ -344,16 +344,9 @@
 t();
- %0A      
+%0A
 %0A  @
@@ -456,27 +456,25 @@
 n this;%0A  %7D%0A
-  
 %0A
+
   @Override%0A
@@ -531,19 +531,17 @@
 ng;%0A  %7D%0A
-  
 %0A
+
   @Overr
@@ -622,11 +622,9 @@
   %7D%0A
-  
 %0A
+
   pu
@@ -672,13 +672,16 @@
 ) %7B%0A
-%09%0A%09
+%0A    
 if
+ 
 (tex
@@ -716,10 +716,14 @@
 ) %7B%0A
-%09%09
+      
 retu
@@ -737,12 +737,14 @@
 ns;%0A
-%09
+    
 %7D%0A
-%09
 %0A   

clean up