robocode.robotinterfaces
Interface IComponents

All Known Implementing Classes:
ComponentManager

public interface IComponents

An interface describing the functionalities of manageable components.

Since:
1.8.3 Alpha 1
Version:
0.1
Author:
Thales B.V. / Jiri Waning

Method Summary
 void addComponent(IComponent component)
          Add a component.
 void addComponent(int index, IComponent component)
          Add a component on the specified index.
<T extends IComponent>
T
getComponent(Class<T> componentClass)
          Get the first component that matches the given class.
 IComponent getComponent(int index)
          Get the component at the specified index.
<T extends IComponent>
T[]
getComponents(Class<T> componentClass)
          Get an array of components that match the given class.
<T extends IComponent>
int
indexOf(T value)
          Get the index of the specified component.
 void removeComponent(int index)
          Remove the component at the specified index.
<T extends IComponent>
void
removeComponent(T component)
          Remove the specified component.
<T extends IComponent>
void
removeComponents(Class<T> componentClass)
          Remove the components that match the specified class.
 

Method Detail

indexOf

<T extends IComponent> int indexOf(T value)
Get the index of the specified component.

-1 when the component has not available.

Parameters:
value - The component from whom to get the index.
Returns:
The index of the component.

removeComponent

void removeComponent(int index)
Remove the component at the specified index.

Parameters:
index - The index of the component that has to be removed.

getComponent

IComponent getComponent(int index)
Get the component at the specified index.

Parameters:
index - The index of the component.
Returns:
The component at the specified index.

addComponent

void addComponent(IComponent component)
Add a component.

Parameters:
component - The component that has to be added.

addComponent

void addComponent(int index,
                  IComponent component)
Add a component on the specified index.

Parameters:
index - The index at which the add the component.
component - The component whom has to be added.

removeComponent

<T extends IComponent> void removeComponent(T component)
Remove the specified component.

Parameters:
component - The component to remove.

removeComponents

<T extends IComponent> void removeComponents(Class<T> componentClass)
Remove the components that match the specified class.

Parameters:
componentClass - The class of the objects to remove.

getComponent

<T extends IComponent> T getComponent(Class<T> componentClass)
Get the first component that matches the given class.

null when there is no component of the given class.

Parameters:
componentClass - The class of the component.
Returns:
The first component that matches the given class.

getComponents

<T extends IComponent> T[] getComponents(Class<T> componentClass)
Get an array of components that match the given class.

null when there are no components matching the given class.

Parameters:
componentClass - The common class of the objects.
Returns:
An array of components that match the given class.


Copyright © 2015 Robocode. All Rights Reserved.