APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.badlogic.gdx.graphics.g3d.particles

public Class ParallelArray

extends Object
Class Inheritance
Imports
com.badlogic.gdx.utils.Array, .ArraySupplier, .GdxRuntimeException, com.badlogic.gdx.utils.reflect.ArrayReflection, java.util.Arrays

This class represents an group of elements like an array, but the properties of the elements are stored as separate arrays. These arrays are called Channel and are represented by ChannelDescriptor. It's not necessary to store primitive types in the channels but doing so will "exploit" data locality in the JVM, which is ensured for primitive types. Use FloatChannel, IntChannel, ObjectChannel to store the data.
Author
inferno

Nested and Inner Type Summary

Modifier and TypeClass and Description
public abstract class
ParallelArray.Channel

This class represents a container of values for all the elements for a given property

public static class
ParallelArray.ChannelDescriptor

This class describes the content of a Channel

public static interface
ParallelArray.ChannelInitializer<T extends ParallelArray.Channel>

This interface is used to provide custom initialization of the Channel data

public class
public class
public class

Field Summary

Modifier and TypeField and Description
pack-priv Array<ParallelArray.Channel>
arrays

the channels added to the array

public int
capacity

the maximum amount of elements that this array can hold

public int
size

the current amount of defined elements, do not change manually unless you know what you are doing.

Constructor Summary

AccessConstructor and Description
public
ParallelArray(int capacity)

Method Summary

Modifier and TypeMethod and Description
public <T extends ParallelArray.Channel> T
addChannel(ParallelArray.ChannelDescriptor channelDescriptor)

Adds and returns a channel described by the channel descriptor parameter.

public <T extends ParallelArray.Channel> T
addChannel(ParallelArray.ChannelDescriptor channelDescriptor, ParallelArray.ChannelInitializer<T> initializer)

Adds and returns a channel described by the channel descriptor parameter.

public void
addElement(Object... values)

Adds an element considering the values in the same order as the current channels in the array.

private <T extends ParallelArray.Channel> T
public void
clear()

Removes all the channels and sets size to 0

private int
findIndex(int id)

public <T extends ParallelArray.Channel> T
getChannel(ParallelArray.ChannelDescriptor descriptor)

Returns: the channel with the same id as the one in the descriptor

public <T> void
removeArray(int id)

Removes the channel with the given id

public void
removeElement(int index)

Removes the element at the given index and swaps it with the last available element

public void
setCapacity(int requiredCapacity)

Sets the capacity.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

arraysback to summary
pack-priv Array<ParallelArray.Channel> arrays

the channels added to the array

capacityback to summary
public int capacity

the maximum amount of elements that this array can hold

sizeback to summary
public int size

the current amount of defined elements, do not change manually unless you know what you are doing.

Constructor Detail

ParallelArrayback to summary
public ParallelArray(int capacity)

Method Detail

addChannelback to summary
public <T extends ParallelArray.Channel> T addChannel(ParallelArray.ChannelDescriptor channelDescriptor)

Adds and returns a channel described by the channel descriptor parameter. If a channel with the same id already exists, no allocation is performed and that channel is returned.

addChannelback to summary
public <T extends ParallelArray.Channel> T addChannel(ParallelArray.ChannelDescriptor channelDescriptor, ParallelArray.ChannelInitializer<T> initializer)

Adds and returns a channel described by the channel descriptor parameter. If a channel with the same id already exists, no allocation is performed and that channel is returned. Otherwise a new channel is allocated and initialized with the initializer.

addElementback to summary
public void addElement(Object... values)

Adds an element considering the values in the same order as the current channels in the array. The n_th value must have the same type and stride of the given channel at position n

allocateChannelback to summary
private <T extends ParallelArray.Channel> T allocateChannel(ParallelArray.ChannelDescriptor channelDescriptor)
Annotations
@SuppressWarnings:unchecked, rawtypes
clearback to summary
public void clear()

Removes all the channels and sets size to 0

findIndexback to summary
private int findIndex(int id)
getChannelback to summary
public <T extends ParallelArray.Channel> T getChannel(ParallelArray.ChannelDescriptor descriptor)
Returns:T

the channel with the same id as the one in the descriptor

Annotations
@SuppressWarnings:unchecked
removeArrayback to summary
public <T> void removeArray(int id)

Removes the channel with the given id

removeElementback to summary
public void removeElement(int index)

Removes the element at the given index and swaps it with the last available element

setCapacityback to summary
public void setCapacity(int requiredCapacity)

Sets the capacity. Each contained channel will be resized to match the required capacity and the current data will be preserved.

com.badlogic.gdx.graphics.g3d.particles back to summary

public abstract Class ParallelArray.Channel

extends Object
Class Inheritance
  • java.lang.Object
  • com.badlogic.gdx.graphics.g3d.particles.ParallelArray.Channel
Known Direct Subclasses
com.badlogic.gdx.graphics.g3d.particles.ParallelArray.FloatChannel, com.badlogic.gdx.graphics.g3d.particles.ParallelArray.IntChannel, com.badlogic.gdx.graphics.g3d.particles.ParallelArray.ObjectChannel

This class represents a container of values for all the elements for a given property

Field Summary

Modifier and TypeField and Description
public Object
public int
public int

Constructor Summary

AccessConstructor and Description
public
Channel(int id, Object data, int strideSize)

Method Summary

Modifier and TypeMethod and Description
public abstract void
add(int index, Object... objects)

protected abstract void
setCapacity(int requiredCapacity)

public abstract void
swap(int i, int k)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

databack to summary
public Object data
idback to summary
public int id
strideSizeback to summary
public int strideSize

Constructor Detail

Channelback to summary
public Channel(int id, Object data, int strideSize)

Method Detail

addback to summary
public abstract void add(int index, Object... objects)
setCapacityback to summary
protected abstract void setCapacity(int requiredCapacity)
swapback to summary
public abstract void swap(int i, int k)
com.badlogic.gdx.graphics.g3d.particles back to summary

public Class ParallelArray.ChannelDescriptor

extends Object
Class Inheritance
  • java.lang.Object
  • com.badlogic.gdx.graphics.g3d.particles.ParallelArray.ChannelDescriptor

This class describes the content of a Channel

Field Summary

Modifier and TypeField and Description
public ArraySupplier<?>
public int
public int
public Class<?>

Constructor Summary

AccessConstructor and Description
public
ChannelDescriptor(int id, Class<?> type, int count)
Deprecated

public
ChannelDescriptor(int id, ArraySupplier<?> arraySupplier, int count)

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

arraySupplierback to summary
public ArraySupplier<?> arraySupplier
countback to summary
public int count
idback to summary
public int id
typeback to summary
public Class<?> type

Constructor Detail

ChannelDescriptorback to summary
public ChannelDescriptor(int id, Class<?> type, int count)

Deprecated

Annotations
@Deprecated
ChannelDescriptorback to summary
public ChannelDescriptor(int id, ArraySupplier<?> arraySupplier, int count)
com.badlogic.gdx.graphics.g3d.particles back to summary

public Interface ParallelArray.ChannelInitializer<T extends ParallelArray.Channel>

Known Direct Implementers
com.badlogic.gdx.graphics.g3d.particles.ParticleChannels.TextureRegionInitializer, com.badlogic.gdx.graphics.g3d.particles.ParticleChannels.ColorInitializer, com.badlogic.gdx.graphics.g3d.particles.ParticleChannels.ScaleInitializer, com.badlogic.gdx.graphics.g3d.particles.ParticleChannels.Rotation2dInitializer, com.badlogic.gdx.graphics.g3d.particles.ParticleChannels.Rotation3dInitializer

This interface is used to provide custom initialization of the Channel data

Method Summary

Modifier and TypeMethod and Description
public void
init(T channel)

Method Detail

initback to summary
public void init(T channel)
com.badlogic.gdx.graphics.g3d.particles back to summary

public Class ParallelArray.FloatChannel

extends Channel
Class Inheritance

Field Summary

Modifier and TypeField and Description
public float[]
Inherited from com.badlogic.gdx.graphics.g3d.particles.ParallelArray.Channel:
idstrideSize

Constructor Summary

AccessConstructor and Description
public
FloatChannel(int id, int strideSize, int size)

Method Summary

Modifier and TypeMethod and Description
public void
public void
public void

Field Detail

databack to summary
public float[] data

Hides com.badlogic.gdx.graphics.g3d.particles.ParallelArray.Channel.data.

Constructor Detail

FloatChannelback to summary
public FloatChannel(int id, int strideSize, int size)

Method Detail

addback to summary
public void add(int index, Object... objects)

Implements abstract com.badlogic.gdx.graphics.g3d.particles.ParallelArray.Channel.add.

Annotations
@Override
setCapacityback to summary
public void setCapacity(int requiredCapacity)

Implements abstract com.badlogic.gdx.graphics.g3d.particles.ParallelArray.Channel.setCapacity.

Annotations
@Override
swapback to summary
public void swap(int i, int k)

Implements abstract com.badlogic.gdx.graphics.g3d.particles.ParallelArray.Channel.swap.

Annotations
@Override
com.badlogic.gdx.graphics.g3d.particles back to summary

public Class ParallelArray.IntChannel

extends Channel
Class Inheritance

Field Summary

Modifier and TypeField and Description
public int[]
Inherited from com.badlogic.gdx.graphics.g3d.particles.ParallelArray.Channel:
idstrideSize

Constructor Summary

AccessConstructor and Description
public
IntChannel(int id, int strideSize, int size)

Method Summary

Modifier and TypeMethod and Description
public void
public void
public void

Field Detail

databack to summary
public int[] data

Hides com.badlogic.gdx.graphics.g3d.particles.ParallelArray.Channel.data.

Constructor Detail

IntChannelback to summary
public IntChannel(int id, int strideSize, int size)

Method Detail

addback to summary
public void add(int index, Object... objects)

Implements abstract com.badlogic.gdx.graphics.g3d.particles.ParallelArray.Channel.add.

Annotations
@Override
setCapacityback to summary
public void setCapacity(int requiredCapacity)

Implements abstract com.badlogic.gdx.graphics.g3d.particles.ParallelArray.Channel.setCapacity.

Annotations
@Override
swapback to summary
public void swap(int i, int k)

Implements abstract com.badlogic.gdx.graphics.g3d.particles.ParallelArray.Channel.swap.

Annotations
@Override
com.badlogic.gdx.graphics.g3d.particles back to summary

public Class ParallelArray.ObjectChannel<T>

extends Channel
Class Inheritance
Annotations
@SuppressWarnings:unchecked

Field Summary

Modifier and TypeField and Description
public T[]
Inherited from com.badlogic.gdx.graphics.g3d.particles.ParallelArray.Channel:
idstrideSize

Constructor Summary

AccessConstructor and Description
public
ObjectChannel(int id, int strideSize, int size, ArraySupplier<T[]> arraySupplier)

Method Summary

Modifier and TypeMethod and Description
public void
public void
public void

Field Detail

databack to summary
public T[] data

Hides com.badlogic.gdx.graphics.g3d.particles.ParallelArray.Channel.data.

Constructor Detail

ObjectChannelback to summary
public ObjectChannel(int id, int strideSize, int size, ArraySupplier<T[]> arraySupplier)

Method Detail

addback to summary
public void add(int index, Object... objects)

Implements abstract com.badlogic.gdx.graphics.g3d.particles.ParallelArray.Channel.add.

Annotations
@Override
setCapacityback to summary
public void setCapacity(int requiredCapacity)

Implements abstract com.badlogic.gdx.graphics.g3d.particles.ParallelArray.Channel.setCapacity.

Annotations
@Override
swapback to summary
public void swap(int i, int k)

Implements abstract com.badlogic.gdx.graphics.g3d.particles.ParallelArray.Channel.swap.

Annotations
@Override