removed LCD class
[des2015.git] / dsl / runtime / src / nl / ru / des / LCDPrinter.java
diff --git a/dsl/runtime/src/nl/ru/des/LCDPrinter.java b/dsl/runtime/src/nl/ru/des/LCDPrinter.java
deleted file mode 100644 (file)
index c041f4d..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-package nl.ru.des;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintStream;
-import java.util.Deque;
-import java.util.LinkedList;
-
-import lejos.hardware.lcd.TextLCD;
-import lejos.utility.Delay;
-
-public class LCDPrinter{
-       public static final int PRINTDELAY = 50;
-       
-       private static class Message{
-               public String msg;
-               public boolean nl;
-               
-               public Message(String msg, boolean nl){
-                       this.msg = msg;
-                       this.nl = nl;
-               }
-       }
-
-       private static Deque<Message> buffer = new LinkedList<Message>();
-
-       public static void startLCDPrinter(final TextLCD glcd) {
-               new Thread(new Runnable(){
-                       @Override
-                       public void run() {
-                               while (true) {
-                                       if (!buffer.isEmpty()) {
-                                               Message c = buffer.remove();
-                                               if(c.msg.length() > glcd.getTextWidth()){
-                                                       buffer.addFirst(new Message(c.msg.substring(glcd.getTextWidth(), c.msg.length()), c.nl));
-                                                       c.msg = c.msg.substring(0, glcd.getTextWidth());
-                                               }
-                                               if(c.nl){
-                                                       glcd.scroll();
-                                               } else {
-                                                       glcd.clear(glcd.getTextHeight()-1);
-                                               }
-                                               glcd.drawString(c.msg, 0, glcd.getTextHeight()-1);
-                                       }
-                                       Delay.msDelay(PRINTDELAY);
-                               }
-                       }
-               }).start();
-               LCDPrinter.print("LCDThread started");
-       }
-       
-       public static void print(String s){
-               print(s, true);
-       }
-       
-       public synchronized static void print(String s, boolean nl){
-               buffer.addLast(new Message(s, nl));
-       }
-       
-       public static PrintStream getPrefixedPrintstream(final String prefix, final TextLCD glcd){
-               return new PrintStream(new OutputStream(){
-                       private char[] line = new char[glcd.getTextWidth()];
-                       private int index = 0;
-                       
-                       @Override
-                       public void write(int b) throws IOException {
-                               if(index == line.length-prefix.length() || b == '\n'){
-                                       LCDPrinter.print(prefix + String.valueOf(line, 0, index));
-                                       index = 0;
-                               } else {
-                                       line[index++] = (char)b;
-                               }
-                       }
-               });
-       }
-}
\ No newline at end of file