Top Description Fields Constructors Methods
com.jogamp.common.util

public Class FloatStack

extends Object
implements PrimitiveStack
Class Inheritance
All Implemented Interfaces
com.jogamp.common.util.PrimitiveStack
Imports
java.nio.BufferOverflowException, .BufferUnderflowException, .FloatBuffer

Simple primitive-type stack.

Implemented operations:

Field Summary

Modifier and TypeField and Description
private float[]
private int
private int

Constructor Summary

AccessConstructor and Description
public
FloatStack(final int
initial size, must be > zero
initialSize
,
final int
grow size if position() is reached, maybe 0 in which case an IndexOutOfBoundsException is thrown.
growSize
)

Method Summary

Modifier and TypeMethod and Description
public final float[]
public final int
capacity()

Implements com.jogamp.common.util.PrimitiveStack.capacity.

Returns this stack's current capacity.
public final float[]

Returns:

the dest float[]
getFromTop
(final float[]
destination buffer
dest
,
final int
offset of dest
destOffset
,
final int
number of float elements to get from-top this stack to dest.
length
)

FILO get operation

public final FloatBuffer

Returns:

the dest FloatBuffer
getFromTop
(final FloatBuffer
destination buffer, it's position is incremented by length.
dest
,
final int
number of float elements to get from-top this stack to dest.
length
)

FILO get operation

public final int
private final void
growIfNecessary(final int length)

public final int
position()

Implements com.jogamp.common.util.PrimitiveStack.position.

Returns the current position of this stack.
public final void
position(final int
the new position
newPosition
)

Implements com.jogamp.common.util.PrimitiveStack.position.

Sets the position of this stack.
public final float[]

Returns:

the src float[]
putOnTop
(final float[]
source buffer
src
,
final int
offset of src
srcOffset
,
final int
number of float elements to put from src on-top this stack
length
)

FILO put operation

public final FloatBuffer

Returns:

the src FloatBuffer
putOnTop
(final FloatBuffer
source buffer, it's position is incremented by length
src
,
final int
number of float elements to put from src on-top this stack
length
)

FILO put operation

public final int
remaining()

Implements com.jogamp.common.util.PrimitiveStack.remaining.

Returns the remaining elements left before stack will grow about getGrowSize().
public final void
setGrowSize(final int newGrowSize)

Implements com.jogamp.common.util.PrimitiveStack.setGrowSize.

Set new {@link #growSize().
public final String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

bufferback to summary
private float[] buffer
growSizeback to summary
private int growSize
positionback to summary
private int position

Constructor Detail

FloatStackback to summary
public FloatStack(final int initialSize, final int growSize)
Parameters
initialSize:int

initial size, must be > zero

growSize:int

grow size if position() is reached, maybe 0 in which case an IndexOutOfBoundsException is thrown.

Method Detail

bufferback to summary
public final float[] buffer()
capacityback to summary
public final int capacity()

Implements com.jogamp.common.util.PrimitiveStack.capacity.

Doc from com.jogamp.common.util.PrimitiveStack.capacity.

Returns this stack's current capacity.

The capacity may grow with a put operation w/ insufficient remaining() elements left, if getGrowSize() > 0.

Annotations
@Override
getFromTopback to summary
public final float[] getFromTop(final float[] dest, final int destOffset, final int length) throws IndexOutOfBoundsException

FILO get operation

Parameters
dest:float[]

destination buffer

destOffset:int

offset of dest

length:int

number of float elements to get from-top this stack to dest.

Returns:float[]

the dest float[]

Exceptions
IndexOutOfBoundsException:
if stack or dest has less elements than length.
getFromTopback to summary
public final FloatBuffer getFromTop(final FloatBuffer dest, final int length) throws IndexOutOfBoundsException, BufferOverflowException

FILO get operation

Parameters
dest:FloatBuffer

destination buffer, it's position is incremented by length.

length:int

number of float elements to get from-top this stack to dest.

Returns:FloatBuffer

the dest FloatBuffer

Exceptions
IndexOutOfBoundsException:
if stack has less elements than length
BufferOverflowException:
if src FloatBuffer has less remaining elements than length.
getGrowSizeback to summary
public final int getGrowSize()

Implements com.jogamp.common.util.PrimitiveStack.getGrowSize.

Doc from com.jogamp.common.util.PrimitiveStack.getGrowSize.

Returns the grow size. A stack grows by this size in case a put operation exceeds it's capacity().

Annotations
@Override
growIfNecessaryback to summary
private final void growIfNecessary(final int length) throws IndexOutOfBoundsException
positionback to summary
public final int position()

Implements com.jogamp.common.util.PrimitiveStack.position.

Doc from com.jogamp.common.util.PrimitiveStack.position.

Returns the current position of this stack.

Position is in the range: 0 ≤ position < capacity().

The position equals to the number of elements stored.

Annotations
@Override
positionback to summary
public final void position(final int newPosition) throws IndexOutOfBoundsException

Implements com.jogamp.common.util.PrimitiveStack.position.

Doc from com.jogamp.common.util.PrimitiveStack.position.

Sets the position of this stack.

Parameters
newPosition:int

the new position

Annotations
@Override
Exceptions
IndexOutOfBoundsException:
if newPosition is outside of range: 0 ≤ position < capacity().
putOnTopback to summary
public final float[] putOnTop(final float[] src, final int srcOffset, final int length) throws IndexOutOfBoundsException

FILO put operation

Parameters
src:float[]

source buffer

srcOffset:int

offset of src

length:int

number of float elements to put from src on-top this stack

Returns:float[]

the src float[]

Exceptions
IndexOutOfBoundsException:
if stack cannot grow due to zero grow-size or offset+length exceeds src.
putOnTopback to summary
public final FloatBuffer putOnTop(final FloatBuffer src, final int length) throws IndexOutOfBoundsException, BufferUnderflowException

FILO put operation

Parameters
src:FloatBuffer

source buffer, it's position is incremented by length

length:int

number of float elements to put from src on-top this stack

Returns:FloatBuffer

the src FloatBuffer

Exceptions
IndexOutOfBoundsException:
if stack cannot grow due to zero grow-size
BufferUnderflowException:
if src FloatBuffer has less remaining elements than length.
remainingback to summary
public final int remaining()

Implements com.jogamp.common.util.PrimitiveStack.remaining.

Doc from com.jogamp.common.util.PrimitiveStack.remaining.

Returns the remaining elements left before stack will grow about getGrowSize().

  remaining := capacity() - position();

0 denotes a full stack.

Annotations
@Override
setGrowSizeback to summary
public final void setGrowSize(final int newGrowSize)

Implements com.jogamp.common.util.PrimitiveStack.setGrowSize.

Doc from com.jogamp.common.util.PrimitiveStack.setGrowSize.

Set new {@link #growSize().

Annotations
@Override
toStringback to summary
public final String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override