org.qedeq.kernel.se.base.list
Interface ElementList

All Superinterfaces:
Element
All Known Implementing Classes:
DefaultElementList

public interface ElementList
extends Element

Every Operator must implement this interface. Each operator deals with arguments. These arguments form an ordered list. So there is the number of arguments, which is told by size() and the i-th argument, accessible by getElement(int).

Author:
Michael Meyling

Method Summary
 void add(Element element)
          TODO 20110327 m31: do we have to use modifying methods like this or remove(int) and so on? If we need them we have to make a deep copy.
 Element getElement(int i)
          Get the requested argument.
 java.util.List getElements()
          Get all arguments as an list.
 java.lang.String getOperator()
          Get the operator.
 void insert(int position, Element element)
          Inserts an element to specified position.
 void remove(int i)
          Deletes an element of element list.
 void replace(int position, Element element)
          Replaces an element at specified position.
 int size()
          Get the number of arguments.
 
Methods inherited from interface org.qedeq.kernel.se.base.list.Element
copy, equals, getAtom, getList, hashCode, isAtom, isList, replace, toString
 

Method Detail

size

int size()
Get the number of arguments.

Returns:
Number of arguments.

getOperator

java.lang.String getOperator()
Get the operator.

Returns:
Operator.

getElement

Element getElement(int i)
Get the requested argument.

Parameters:
i - Number of argument (starting with 0).
Returns:
i-th part formula.
Throws:
java.lang.IllegalArgumentException - i is not between 0 and size() - 1

getElements

java.util.List getElements()
Get all arguments as an list.

Returns:
All elements.

add

void add(Element element)
TODO 20110327 m31: do we have to use modifying methods like this or remove(int) and so on? If we need them we have to make a deep copy. Otherwise we can save lots of space! Adds an element to end of list.

Parameters:
element - Element to add.
Throws:
java.lang.IllegalArgumentException - The given element was a NullPointer.

insert

void insert(int position,
            Element element)
Inserts an element to specified position.

Parameters:
position - Position of element to add.
element - Element to add.
Throws:
java.lang.IllegalArgumentException - The given element was a NullPointer or the position was not valid.

replace

void replace(int position,
             Element element)
Replaces an element at specified position.

Parameters:
position - Position of element to replace.
element - Replacement element.
Throws:
java.lang.IllegalArgumentException - The given element was a NullPointer or the position was not valid.

remove

void remove(int i)
Deletes an element of element list.

Parameters:
i - Position of element to remove.
Throws:
java.lang.IllegalArgumentException - The given position was not valid.


Copyright © 2014. All Rights Reserved.