////////////////////////////////////////////////////////////////// // LEDMessage.java -- LED Sign V2.5 // // The class that takes care of parsing the message, // storage and retrieval of the message data structure. // // Revisions: // V2.5: Fixed all known bugs in previous versions! Added // the new feature of ledsize, which allows the user // to specify in pixels how big the LED's (1-4). // Thanks to Robert B. Denny (rdenny@dc3.com) for // code and input! // Modified Dec 20-26, 1995 // // V2.0beta: Modified V1.0 to comply with Pre-Beta java. // A problem with delay causes a jerky display. // Modified Oct 20 - 29, 1995 // // V1.0: Written July 31 - August 4, 1995 // // by Darrick Brown // dbrown@cs.hope.edu // http://www.cs.hope.edu/~dbrown/ // // © Copyright 1995 ////////////////////////////////////////////////////////////////// /*package LED;*/ import java.io.*; import java.util.*; import FuncInfo; import Letters; import Index; ////////////////////////////////////////////////////////////////// // Had to call it LEDMessage instead of Message. Seems as // though class Message is already used :( ////////////////////////////////////////////////////////////////// class LEDMessage { int letcol[]; boolean msg[][]; FuncInfo fi; int h,w; int WIDTH,HEIGHT,TOTAL; Letters let; Index index; ////////////////////////////////////////////////////////////////// // The constructor // set up some variables that we need public LEDMessage(int height, int width, Letters l) { h = height; w = width; HEIGHT = 5*h; WIDTH = 5*w; let = l; } ////////////////////////////////////////////////////////////////// // Set the messege for the current text void setmsg(FuncInfo f) { int a,b; int i,j,k; int p; int len; char c; fi = f; // Find the length of the text in "LED's" len = 0; for(i=0;i 0) try { c = fi.color.charAt(i); } catch(IndexOutOfBoundsException e) { System.out.println("Out of bounds in LEDMessage.setmsg"); } k = index.width; for(a=0;a= 0 && x < TOTAL && y >= 0 && y < h) return msg[x][y]; else return false; } ////////////////////////////////////////////////////////////////// // return the color of the LED int getColor(int x) { if(x >= 0 && x < TOTAL) return letcol[x]; else return 1; // default red } ////////////////////////////////////////////////////////////////// // get the length of the messege in LEDs int length() { return TOTAL; } ////////////////////////////////////////////////////////////////// // Check and see if we're still in the message boolean inRange(int x) { if(x >= 0 && x < TOTAL) return true; else return false; } }