|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Element | Line # 28 | 0 | 0 | - |
-1.0
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| No Tests | |||
| 1 | /* This file is part of the project "Hilbert II" - http://www.qedeq.org | |
| 2 | * | |
| 3 | * Copyright 2000-2010, Michael Meyling <mime@qedeq.org>. | |
| 4 | * | |
| 5 | * "Hilbert II" is free software; you can redistribute | |
| 6 | * it and/or modify it under the terms of the GNU General Public | |
| 7 | * License as published by the Free Software Foundation; either | |
| 8 | * version 2 of the License, or (at your option) any later version. | |
| 9 | * | |
| 10 | * This program is distributed in the hope that it will be useful, | |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 13 | * GNU General Public License for more details. | |
| 14 | */ | |
| 15 | ||
| 16 | package org.qedeq.kernel.base.list; | |
| 17 | ||
| 18 | ||
| 19 | /** | |
| 20 | * An element is either a list or an atom. Each list has an operator and | |
| 21 | * contains elements which are also elements. A list has a size and their | |
| 22 | * elements can be accessed by their position. An atom carries textual | |
| 23 | * data, has no operator and no size in the previous sense. | |
| 24 | * | |
| 25 | * @version $Revision: 1.3 $ | |
| 26 | * @author Michael Meyling | |
| 27 | */ | |
| 28 | public interface Element { | |
| 29 | ||
| 30 | /** | |
| 31 | * Is this an atom? | |
| 32 | * | |
| 33 | * @return <code>true</code> if this is an instance of {@link Atom}. | |
| 34 | */ | |
| 35 | public boolean isAtom(); | |
| 36 | ||
| 37 | /** | |
| 38 | * Return this element as an {@link Atom}. | |
| 39 | * | |
| 40 | * @return This is an instance of {@link Atom}. | |
| 41 | * @throws ClassCastException This is no instance of {@link Atom}. | |
| 42 | */ | |
| 43 | public Atom getAtom(); | |
| 44 | ||
| 45 | /** | |
| 46 | * Is this an {@link ElementList}? | |
| 47 | * | |
| 48 | * @return <code>true</code> if this is an instance of {@link ElementList}. | |
| 49 | */ | |
| 50 | public boolean isList(); | |
| 51 | ||
| 52 | /** | |
| 53 | * Return this element as a Atom. | |
| 54 | * | |
| 55 | * @return This as an instance of {@link Atom}. | |
| 56 | * @throws ClassCastException This is no instance of {@link Atom}. | |
| 57 | */ | |
| 58 | public ElementList getList(); | |
| 59 | ||
| 60 | /** | |
| 61 | * Is this object equal to the given one? | |
| 62 | * | |
| 63 | * @param object to compare with | |
| 64 | * @return Is <code>object</code> equal to this one? | |
| 65 | */ | |
| 66 | public boolean equals(Object object); | |
| 67 | ||
| 68 | /** | |
| 69 | * Calculates the hash code. | |
| 70 | * | |
| 71 | * @return Hash code of this object | |
| 72 | */ | |
| 73 | public int hashCode(); | |
| 74 | ||
| 75 | /** | |
| 76 | * Returns an identical object (maybe "this"). | |
| 77 | * | |
| 78 | * @return Copy of this object. | |
| 79 | */ | |
| 80 | public Element copy(); | |
| 81 | ||
| 82 | /** | |
| 83 | * Creates and returns a copy of this object, but | |
| 84 | * replaces anything that {@link #equals} <code>argument</code> | |
| 85 | * with a {@link #copy} of <code>replacement</code>. | |
| 86 | * | |
| 87 | * @param search Check for occurrence of this. | |
| 88 | * @param replacement Replace with this. | |
| 89 | * @return Copy with replacements. | |
| 90 | */ | |
| 91 | public Element replace(Element search, Element replacement); | |
| 92 | ||
| 93 | /** | |
| 94 | * Get show this in <code>String</code> form. | |
| 95 | * | |
| 96 | * @return Readable list. | |
| 97 | */ | |
| 98 | public String toString(); | |
| 99 | ||
| 100 | } | |
|
||||||||||