////////////////////////////////////////////////////////////////// // LEDMessage.java -- LED Sign V1.0f // // The class that takes care of parsing the message, // storage and retrieval of the message data structure. // // Revisions: // V1.0f: 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 LED.*; ////////////////////////////////////////////////////////////////// // 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) c = fi.color.charAt(i); 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; } }