com.rapidminer.tools.container
Class MultidimensionalArraySet<E>

java.lang.Object
  extended by com.rapidminer.tools.container.MultidimensionalArraySet<E>
Type Parameters:
E - the class of the array elements

public class MultidimensionalArraySet<E>
extends java.lang.Object

This class represents a multidimensional array whose dimensions have to be specified during construction. The multidimensional array is modeled by an underlying single dimension array.

Author:
Tobias Malbrecht

Constructor Summary
MultidimensionalArraySet(int[] dimensions)
          The constructor.
 
Method Summary
 E get(int index)
          Returns the array element at the specified single dimension array position.
 E get(int[] indices)
          Returns the array element at the position specified by the given indices.
 int[] getDimensions()
          Returns an int array holding the dimensions of the multidimensional array.
 int getIndex(int[] indices)
          Computes the single dimension array index from the given multidimensional indices.
 int[] getIndices(int index)
          Computs the multidimensional indices corresponding to a single dimension array index.
 void set(int[] indices, E e)
          Sets the array element at the position specified by the given indices
 void set(int index, E e)
          Sets the array element at the specified single dimension array position.
 int size()
          Returns the number of elements this array can hold.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultidimensionalArraySet

public MultidimensionalArraySet(int[] dimensions)
The constructor.

Parameters:
dimensions - int array which contains the size of each dimension
Method Detail

get

public E get(int index)
Returns the array element at the specified single dimension array position.

Parameters:
index - the index
Returns:
an element

get

public E get(int[] indices)
Returns the array element at the position specified by the given indices.

Parameters:
indices - the indices
Returns:
an element

set

public void set(int index,
                E e)
Sets the array element at the specified single dimension array position.

Parameters:
index - the index
e - an element

set

public void set(int[] indices,
                E e)
Sets the array element at the position specified by the given indices

Parameters:
indices - the indices
e - an element

getIndex

public int getIndex(int[] indices)
Computes the single dimension array index from the given multidimensional indices.

Parameters:
indices - the indices
Returns:
the corresponding index

getIndices

public int[] getIndices(int index)
Computs the multidimensional indices corresponding to a single dimension array index.

Parameters:
index - the index
Returns:
the corresponding indices

size

public int size()
Returns the number of elements this array can hold.

Returns:
size

getDimensions

public int[] getDimensions()
Returns an int array holding the dimensions of the multidimensional array.

Returns:
dimensions


Copyright © 2001-2009 by Rapid-I