Hilbert II - Version 0.03.04

org.qedeq.kernel.dto.list
Class DefaultElementList

java.lang.Object
  extended byorg.qedeq.kernel.dto.list.DefaultElementList
All Implemented Interfaces:
Element, ElementList

public final class DefaultElementList
extends Object
implements ElementList

Every Operator must inherit from this class. Its main function is to provide the standard implementation of equals(java.lang.Object) and hashCode().

Version:
$Revision: 1.1 $

Constructor Summary
DefaultElementList(String operator, Element[] elements)
          Constructs a element list.
 
Method Summary
 void add(Element element)
          Adds an element to end of list.
 Element copy()
          Returns an identical object (maybe "this").
 boolean equals(Object object)
          Is this object equal to the given one?
 Atom getAtom()
          Return this element as an Atom.
 Element getElement(int i)
          Get the requested argument.
 List getElements()
          Get all arguments as an list.
 ElementList getList()
          Return this element as a Atom.
 String getOperator()
          Get the operator.
 int hashCode()
          Calculates the hash code.
 void insert(int position, Element element)
          Inserts an element to specified position.
 boolean isAtom()
          Is this an atom?
 boolean isList()
          Is this an ElementList?
 void remove(int i)
          Deletes an element of element list.
 Element replace(Element search, Element replacement)
          Creates and returns a copy of this object, but replaces anything that equals(java.lang.Object) argument with a copy() of replacement.
 void replace(int position, Element element)
          Replaces an element at specified position.
 int size()
          Get the number of arguments.
 String toString()
          Get show this in String form.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultElementList

public DefaultElementList(String operator,
                          Element[] elements)
Constructs a element list.

Parameters:
operator - Operator name.
elements - the elements to make a list of
Throws:
IllegalArgumentException - Element or operator was a NullPointer.
Method Detail

isAtom

public final boolean isAtom()
Description copied from interface: Element
Is this an atom?

Specified by:
isAtom in interface Element
Returns:
true if this is an instance of Atom.

getAtom

public final Atom getAtom()
Description copied from interface: Element
Return this element as an Atom.

Specified by:
getAtom in interface Element
Returns:
This is an instance of Atom.

isList

public final boolean isList()
Description copied from interface: Element
Is this an ElementList?

Specified by:
isList in interface Element
Returns:
true if this is an instance of ElementList.

getList

public final ElementList getList()
Description copied from interface: Element
Return this element as a Atom.

Specified by:
getList in interface Element
Returns:
This as an instance of Atom.

getOperator

public final String getOperator()
Description copied from interface: ElementList
Get the operator.

Specified by:
getOperator in interface ElementList
Returns:
Operator.

size

public final int size()
Description copied from interface: ElementList
Get the number of arguments.

Specified by:
size in interface ElementList
Returns:
Number of arguments.

getElement

public final Element getElement(int i)
Description copied from interface: ElementList
Get the requested argument.

Specified by:
getElement in interface ElementList
Parameters:
i - Number of argument (starting with 0).
Returns:
i-th part formula.

getElements

public final List getElements()
Description copied from interface: ElementList
Get all arguments as an list.

Specified by:
getElements in interface ElementList
Returns:
All elements.

equals

public final boolean equals(Object object)
Description copied from interface: Element
Is this object equal to the given one?

Specified by:
equals in interface Element

copy

public final Element copy()
Description copied from interface: Element
Returns an identical object (maybe "this").

Specified by:
copy in interface Element
Returns:
Copy of this object.

replace

public final Element replace(Element search,
                             Element replacement)
Description copied from interface: Element
Creates and returns a copy of this object, but replaces anything that Element.equals(java.lang.Object) argument with a Element.copy() of replacement.

Specified by:
replace in interface Element
Parameters:
search - Check for occurrence of this.
replacement - Replace with this.
Returns:
Copy with replacements.

add

public final void add(Element element)
Description copied from interface: ElementList
Adds an element to end of list.

Specified by:
add in interface ElementList
Parameters:
element - Element to add.

insert

public final void insert(int position,
                         Element element)
Description copied from interface: ElementList
Inserts an element to specified position.

Specified by:
insert in interface ElementList
Parameters:
position - Position of element to add.
element - Element to add.

replace

public final void replace(int position,
                          Element element)
Description copied from interface: ElementList
Replaces an element at specified position.

Specified by:
replace in interface ElementList
Parameters:
position - Position of element to replace.
element - Replacement element.

remove

public final void remove(int i)
Description copied from interface: ElementList
Deletes an element of element list.

Specified by:
remove in interface ElementList
Parameters:
i - Position of element to remove.

hashCode

public final int hashCode()
Description copied from interface: Element
Calculates the hash code.

Specified by:
hashCode in interface Element

toString

public final String toString()
Description copied from interface: Element
Get show this in String form.

Specified by:
toString in interface Element

Hilbert II - Version 0.03.04

©left GNU General Public Licence
All Rights Reserved.