org.qedeq.kernel.se.dto.list
Class DefaultAtom

java.lang.Object
  extended by org.qedeq.kernel.se.dto.list.DefaultAtom
All Implemented Interfaces:
Atom, Element

public final class DefaultAtom
extends java.lang.Object
implements Atom

An object of this class represents a text string.

Author:
Michael Meyling

Constructor Summary
DefaultAtom(java.lang.String text)
          Constructs an Atom.
 
Method Summary
 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.
 ElementList getList()
          Return this element as an ElementList.
 java.lang.String getString()
          Get the text.
 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 Element.equals(java.lang.Object) argument with a Element.copy() of replacement.
 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

DefaultAtom

public DefaultAtom(java.lang.String text)
Constructs an Atom.

Parameters:
text - Atom string.
Throws:
java.lang.IllegalArgumentException - text is a NullPointer.
Method Detail

getString

public final java.lang.String getString()
Description copied from interface: Atom
Get the text.

Specified by:
getString in interface Atom
Returns:
text Atom data.

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 an ElementList.

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

copy

public final Element copy()
Description copied from interface: Element
Returns an identical object. This is a deep copy so later changes of the original element (or its sub parts) are not reflected in the copy.

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.

toString

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

Specified by:
toString in interface Element
Overrides:
toString in class java.lang.Object
Returns:
Readable list.

equals

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

Specified by:
equals in interface Element
Overrides:
equals in class java.lang.Object
Parameters:
object - to compare with
Returns:
Is object equal to this one?

hashCode

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

Specified by:
hashCode in interface Element
Overrides:
hashCode in class java.lang.Object
Returns:
Hash code of this object


Copyright © 2014. All Rights Reserved.