pslib
Class BufferedObject

java.lang.Object
  extended by pslib.BufferedObject

public class BufferedObject
extends java.lang.Object

BufferedObject Class

The BufferedObject object allows input objects to be buffered. The buffer will dynamically restructure itself to preserve ordering.

This library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library. If not, see http://www.gnu.org/licenses/.


Constructor Summary
BufferedObject(int s)
          Create a new object instance with the specified buffer size
 
Method Summary
 void clear()
          Clear the buffer contents
 java.lang.Object get()
          Return the most recently stored object reference
 java.lang.Object get(int i)
          Return the object reference stored at the specified index
 boolean isInitialised()
          Return true if the buffer has been initialised
 void resize(int s)
          Resize the buffer
 void set(java.lang.Object obj)
          Store the specified object reference
 int size()
          Return the current buffer size
 java.lang.Object[] toArray(java.lang.Object[] arr_n)
          Store the contents of the buffer in the specified array
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BufferedObject

public BufferedObject(int s)
Create a new object instance with the specified buffer size

Parameters:
s - buffer size
Method Detail

set

public final void set(java.lang.Object obj)
Store the specified object reference

Parameters:
obj - object

get

public final java.lang.Object get()
Return the most recently stored object reference

Returns:
the most recently stored object reference

get

public final java.lang.Object get(int i)
Return the object reference stored at the specified index

Parameters:
i - index
Returns:
the object reference stored at the specified index

toArray

public final java.lang.Object[] toArray(java.lang.Object[] arr_n)
Store the contents of the buffer in the specified array

If the input array size differs from the buffer size, values will be removed or duplicated as required.

Parameters:
arr_n - object array
Returns:
the modified object array

size

public final int size()
Return the current buffer size

Returns:
the current buffer size

resize

public final void resize(int s)
Resize the buffer

Parameters:
s - size

clear

public final void clear()
Clear the buffer contents


isInitialised

public final boolean isInitialised()
Return true if the buffer has been initialised

Returns:
true if the buffer has been initialised