net.sf.mmm.util.text.base
Class DefaultLineWrapper.CellBuffer

java.lang.Object
  extended by net.sf.mmm.util.text.base.DefaultLineWrapper.CellBuffer
Enclosing class:
DefaultLineWrapper

protected static class DefaultLineWrapper.CellBuffer
extends Object

This inner class represents the buffer used for the text of a text-cell (a line of content inside a column).


Field Summary
private  StringBuilder buffer
           
private  int maxLength
           
private  int rest
           
 
Constructor Summary
protected DefaultLineWrapper.CellBuffer()
          The constructor.
 
Method Summary
protected  int append(char c)
           
protected  int append(CharSequence text)
           
protected  int append(CharSequence text, int start, int end)
           
 int getMaxLength()
          This method gets the maximum length of this buffer and the according cell.
 int getRest()
          This method gets the rest, which is the number of characters available until the buffer has reached its end.
protected  int length()
          This method gets the length of this buffer.
protected  void reset(int maximumLength)
          This method clears this buffer.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

buffer

private final StringBuilder buffer
See Also:
append(CharSequence)

maxLength

private int maxLength
See Also:
reset(int)

rest

private int rest
See Also:
getRest()
Constructor Detail

DefaultLineWrapper.CellBuffer

protected DefaultLineWrapper.CellBuffer()
The constructor.

Method Detail

reset

protected void reset(int maximumLength)
This method clears this buffer. It has to be called at the beginning of each new cell.

Parameters:
maximumLength - is the maximum length this buffer should reach. It should therefore be set to the space available for the current cell (column-width potentially reduced by indent, etc.).

getMaxLength

public int getMaxLength()
This method gets the maximum length of this buffer and the according cell. It is set when this buffer is reseted.

Returns:
the maximum length.

getRest

public int getRest()
This method gets the rest, which is the number of characters available until the buffer has reached its end.

Returns:
the number of characters left for this buffer (current cell).
See Also:
append(CharSequence)

append

protected int append(CharSequence text)
Parameters:
text - is the text to append.
Returns:
the current rest.
See Also:
Appendable.append(CharSequence)

append

protected int append(CharSequence text,
                     int start,
                     int end)
Parameters:
text - is the CharSequence from which a subsequence will be appended.
start - is the index of the first character in the subsequence.
end - is the index of the character following the last character in the subsequence.
Returns:
the current rest.
See Also:
Appendable.append(CharSequence, int, int)

append

protected int append(char c)
Parameters:
c - is the character to append.
Returns:
the current rest.
See Also:
Appendable.append(char)

length

protected int length()
This method gets the length of this buffer.

Returns:
the number of characters in this buffer.

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2001-2010 mmm-Team. All Rights Reserved.