Hilbert II - Version 0.03.04

org.qedeq.kernel.base.list
Interface Element

All Known Subinterfaces:
Atom, ElementList
All Known Implementing Classes:
DefaultAtom, DefaultElementList

public interface Element

An element is either a list or an atom. Each list has an operator and contains elements which are also elements. A list has a size and their elements can be accessed by their position. An atom carries textual data, has no operator and no size in the previous sense.

Version:
$Revision: 1.2 $

Method Summary
 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.
 ElementList getList()
          Return this element as a Atom.
 int hashCode()
          Calculates the hash code.
 boolean isAtom()
          Is this an atom?
 boolean isList()
          Is this an ElementList?
 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.
 String toString()
          Get show this in String form.
 

Method Detail

isAtom

public boolean isAtom()
Is this an atom?

Returns:
true if this is an instance of Atom.

getAtom

public Atom getAtom()
Return this element as an Atom.

Returns:
This is an instance of Atom.
Throws:
ClassCastException - This is no instance of Atom.

isList

public boolean isList()
Is this an ElementList?

Returns:
true if this is an instance of ElementList.

getList

public ElementList getList()
Return this element as a Atom.

Returns:
This as an instance of Atom.
Throws:
ClassCastException - This is no instance of Atom.

equals

public boolean equals(Object object)
Is this object equal to the given one?

Parameters:
object - to compare with
Returns:
Is object equal to this one?

hashCode

public int hashCode()
Calculates the hash code.

Returns:
Hash code of this object

copy

public Element copy()
Returns an identical object (maybe "this").

Returns:
Copy of this object.

replace

public 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.

Parameters:
search - Check for occurrence of this.
replacement - Replace with this.
Returns:
Copy with replacements.

toString

public String toString()
Get show this in String form.

Returns:
Readable list.

Hilbert II - Version 0.03.04

©left GNU General Public Licence
All Rights Reserved.