Class ParallelArray

    • Field Detail

      • capacity

        public int capacity
        the maximum amount of elements that this array can hold
      • size

        public int size
        the current amount of defined elements, do not change manually unless you know what you are doing.
    • Constructor Detail

      • ParallelArray

        public ParallelArray​(int capacity)
    • Method Detail

      • addChannel

        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.
      • addChannel

        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.
      • removeArray

        public <T> void removeArray​(int id)
        Removes the channel with the given id
      • addElement

        public void addElement​(java.lang.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
      • removeElement

        public void removeElement​(int index)
        Removes the element at the given index and swaps it with the last available element
      • clear

        public void clear()
        Removes all the channels and sets size to 0
      • setCapacity

        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.