org.sadun.util
Class RotationalCharBuffer

java.lang.Object
  extended byorg.sadun.util.RotationalCharBuffer

public class RotationalCharBuffer
extends java.lang.Object

A rotational character buffer.

Version:
1.0
Author:
Cristiano Sadun

Constructor Summary
RotationalCharBuffer(int length)
          Create a buffer with the given lenght.
 
Method Summary
 void addToLeft(char c)
          Add a character to the left of the current position.
 void addToLeft(java.lang.String s)
          Invoke addToLeft(char)on an entire string, one character at a time, starting from the left.
 void addToRight(char c)
          Add a character to the right of the current position.
 void addToRight(java.lang.String s)
          Invoke addToRight(char)on an entire string, one character at a time, starting from the left.
 boolean equals(java.lang.Object obj)
           
 int size()
          Return the size of the buffer.
 java.lang.String toString()
          Return a string image of the buffer.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RotationalCharBuffer

public RotationalCharBuffer(int length)
Create a buffer with the given lenght.

Parameters:
length - the lenght of the buffer
Method Detail

addToRight

public void addToRight(char c)
Add a character to the right of the current position.

The characters on the left are shifted one position and the leftmost discarded, if needed.

Parameters:
c - the character to add

addToRight

public void addToRight(java.lang.String s)
Invoke addToRight(char)on an entire string, one character at a time, starting from the left.

Parameters:
s - the string to add.

addToLeft

public void addToLeft(char c)
Add a character to the left of the current position.

The characters on the right are shifted one position and the rightmost discarded, if needed.

Parameters:
c - the character to add

addToLeft

public void addToLeft(java.lang.String s)
Invoke addToLeft(char)on an entire string, one character at a time, starting from the left.

Parameters:
s - the string to add.

size

public int size()
Return the size of the buffer.

Returns:
the size of the buffer.

toString

public java.lang.String toString()
Return a string image of the buffer.

Returns:
a string image of the buffer.

equals

public boolean equals(java.lang.Object obj)