cdx.scorebot.util
Class StringFIFO

java.lang.Object
  extended by cdx.scorebot.util.StringFIFO

public class StringFIFO
extends java.lang.Object

This class contains a String which is limited to a certain number lines.

Author:
David Underhill

Constructor Summary
StringFIFO(int maxLines)
          initialize the FIFO string (will hide a trailing blank line if one exists)
StringFIFO(int maxLines, int maxCharsPerLine)
          initialize the FIFO string (will hide a trailing blank line if one exists)
StringFIFO(int maxLines, int maxCharsPerLine, boolean hideEndingBlankLines)
          initialize the FIFO string
 
Method Summary
 void addLine(java.lang.String s)
          adds the specified string plus a newline to this object
 void addText(java.lang.String s)
          adds the specified string to this object
 void clear()
          Clear the text from the string
 int getMaxColumns()
          gets the current max number of columns a line may have
 int getMaxLines()
          gets the current max number of lines
 int length()
          gets the length string (number of characters)
 void setMaxLines(int maxLines)
          sets the current max number of lines
 int size()
          gets the number of lines in this string
 java.lang.String text()
          gets the current value of the string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringFIFO

public StringFIFO(int maxLines)
initialize the FIFO string (will hide a trailing blank line if one exists)

Parameters:
maxLines - the maximum number of lines the string may contain (if there are too many lines, those at the top of the string are removed)

StringFIFO

public StringFIFO(int maxLines,
                  int maxCharsPerLine)
initialize the FIFO string (will hide a trailing blank line if one exists)

Parameters:
maxLines - the maximum number of lines the string may contain (if there are too many lines, those at the top of the string are removed)
maxCharsPerLine - the maximum number of columns any line may contain (if there are too many columns, the line will be split up into multiple lines)

StringFIFO

public StringFIFO(int maxLines,
                  int maxCharsPerLine,
                  boolean hideEndingBlankLines)
initialize the FIFO string

Parameters:
maxLines - the maximum number of lines the string may contain (if there are too many lines, those at the top of the string are removed)
maxCharsPerLine - the maximum number of columns any line may contain (if there are too many columns, the line will be split up into multiple lines)
hideEndingBlankLines - whether or not a trailing, blank line should count against the limit and be shown in the string. If true, if there is a trailing blank line at the end of a string being added, it will be queued (not in the string) until text is added to that line. Only the last blank white line is treated in this manner; if there are multiple blank white lines, all of them except the last one will be part of the string.
Method Detail

addLine

public void addLine(java.lang.String s)
adds the specified string plus a newline to this object

Parameters:
s - the string to add

addText

public void addText(java.lang.String s)
adds the specified string to this object

Parameters:
s - the string to add

clear

public void clear()
Clear the text from the string


length

public int length()
gets the length string (number of characters)


size

public int size()
gets the number of lines in this string


getMaxColumns

public int getMaxColumns()
gets the current max number of columns a line may have

Returns:
current maximum characters each line in the string is limited to

getMaxLines

public int getMaxLines()
gets the current max number of lines

Returns:
current maximum number of lines the string is limited to

setMaxLines

public void setMaxLines(int maxLines)
sets the current max number of lines

Parameters:
maxLines - maximum number of lines to limit this string to

text

public java.lang.String text()
gets the current value of the string