package nxm.sys.inc;

/** This identifies an object that is indexable. These methods are of minimal value, except when
    making a class that can be indexed into from the NeXtMidas macro language.

    @see Keyable
    @see nxm.sys.lib.KeyObject

    @author  J. Czechowski IV
    @version $Id: Indexable.java,v 1.3 2014/10/21 19:01:12 ntn Exp $
    @since   NeXtMidas 2.3.0
 */
public interface Indexable {
  /** Gets the value at a given index.
      @param index The index of the object (0..N-1).
      @return The value at the given index.
      @throws RuntimeException If the index is invalid.
   */
  Object getIndex(int index);

  /** Sets the value at a given index.
      @param index The index of the object (0..N-1).
      @param value The new value for the object.
      @throws RuntimeException If the index is invalid.
   */
  void setIndex(int index, Object value);

  /** Gets the size of the indexable object.
      @return The number of indexable elements in the object.
   */
  int getSize();
}
