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