|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.qedeq.kernel.se.dto.list.DefaultElementList
public final class DefaultElementList
Every Operator must inherit from this class. Its main function is to
provide the standard implementation of equals(java.lang.Object)
and hashCode()
.
Constructor Summary | |
---|---|
DefaultElementList(java.lang.String operator)
Constructs an element list with no elements. |
|
DefaultElementList(java.lang.String operator,
Element[] elements)
Constructs an element list. |
Method Summary | |
---|---|
void |
add(Element element)
TODO 20110327 m31: do we have to use modifying methods like this or ElementList.remove(int)
and so on? If we need them we have to make a deep copy. |
Element |
copy()
Returns an identical object. |
boolean |
equals(java.lang.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. |
java.util.List |
getElements()
Get all arguments as an list. |
ElementList |
getList()
Return this element as an ElementList. |
java.lang.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 Element.equals(java.lang.Object) argument
with a Element.copy() of replacement . |
void |
replace(int position,
Element element)
Replaces an element at specified position. |
int |
size()
Get the number of arguments. |
java.lang.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 |
---|
public DefaultElementList(java.lang.String operator)
operator
- Operator name.
java.lang.IllegalArgumentException
- Element or operator was a NullPointer.public DefaultElementList(java.lang.String operator, Element[] elements)
operator
- Operator name.elements
- the elements to make a list of
java.lang.IllegalArgumentException
- Element or operator was a NullPointer.Method Detail |
---|
public final boolean isAtom()
Element
isAtom
in interface Element
true
if this is an instance of Atom
.public final Atom getAtom()
Element
Atom
.
getAtom
in interface Element
Atom
.public final boolean isList()
Element
ElementList
?
isList
in interface Element
true
if this is an instance of ElementList
.public final ElementList getList()
Element
getList
in interface Element
ElementList
.public final java.lang.String getOperator()
ElementList
getOperator
in interface ElementList
public final int size()
ElementList
size
in interface ElementList
public final Element getElement(int i)
ElementList
getElement
in interface ElementList
i
- Number of argument (starting with 0
).
i
-th part formula.public final java.util.List getElements()
ElementList
getElements
in interface ElementList
public final boolean equals(java.lang.Object object)
Element
equals
in interface Element
equals
in class java.lang.Object
object
- to compare with
object
equal to this one?public final Element copy()
Element
copy
in interface Element
public final Element replace(Element search, Element replacement)
Element
Element.equals(java.lang.Object)
argument
with a Element.copy()
of replacement
.
replace
in interface Element
search
- Check for occurrence of this.replacement
- Replace with this.
public final void add(Element element)
ElementList
ElementList.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.
add
in interface ElementList
element
- Element to add.public final void insert(int position, Element element)
ElementList
insert
in interface ElementList
position
- Position of element to add.element
- Element to add.public final void replace(int position, Element element)
ElementList
replace
in interface ElementList
position
- Position of element to replace.element
- Replacement element.public final void remove(int i)
ElementList
remove
in interface ElementList
i
- Position of element to remove.public final int hashCode()
Element
hashCode
in interface Element
hashCode
in class java.lang.Object
public final java.lang.String toString()
Element
String
form.
toString
in interface Element
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |