Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
WikiDocument | 30 | 11 | 0% | 7 | 9 |
1 | /* | |
2 | * See the NOTICE file distributed with this work for additional | |
3 | * information regarding copyright ownership. | |
4 | * | |
5 | * This is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU Lesser General Public License as | |
7 | * published by the Free Software Foundation; either version 2.1 of | |
8 | * the License, or (at your option) any later version. | |
9 | * | |
10 | * This software 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 GNU | |
13 | * Lesser General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU Lesser General Public | |
16 | * License along with this software; if not, write to the Free | |
17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
19 | */ | |
20 | package org.xwiki.refactoring; | |
21 | ||
22 | import org.xwiki.rendering.block.XDOM; | |
23 | ||
24 | /** | |
25 | * Represents an in-memory wiki page used by the {@link org.xwiki.refactoring.splitter.DocumentSplitter} interface. | |
26 | * | |
27 | * @version $Id: edabfe73608e6d45d4a982cba5c225f4936ea7bd $ | |
28 | * @since 1.9M1 | |
29 | */ | |
30 | public class WikiDocument | |
31 | { | |
32 | /** | |
33 | * Full name of the target wiki page. | |
34 | */ | |
35 | private String fullName; | |
36 | ||
37 | /** | |
38 | * The {@link XDOM} of the target wiki page. | |
39 | */ | |
40 | private XDOM xdom; | |
41 | ||
42 | /** | |
43 | * The parent {@link WikiDocument} of this document. | |
44 | */ | |
45 | private WikiDocument parent; | |
46 | ||
47 | /** | |
48 | * Constructs a new {@link WikiDocument}. | |
49 | * | |
50 | * @param fullName full name of the target wiki page. | |
51 | * @param xdom {@link XDOM} for the target wiki page. | |
52 | * @param parent the parent {@link WikiDocument} of this document. | |
53 | */ | |
54 | 11 | public WikiDocument(String fullName, XDOM xdom, WikiDocument parent) |
55 | { | |
56 | 11 | this.fullName = fullName; |
57 | 11 | this.xdom = xdom; |
58 | 11 | this.parent = parent; |
59 | } | |
60 | ||
61 | /** | |
62 | * @return full name of the target wiki page. | |
63 | */ | |
64 | 16 | public String getFullName() |
65 | { | |
66 | 16 | return fullName; |
67 | } | |
68 | ||
69 | /** | |
70 | * @return the {@link XDOM} of the target wiki page. | |
71 | */ | |
72 | 45 | public XDOM getXdom() |
73 | { | |
74 | 45 | return xdom; |
75 | } | |
76 | ||
77 | /** | |
78 | * @return the parent {@link WikiDocument} of this document. | |
79 | */ | |
80 | 11 | public WikiDocument getParent() |
81 | { | |
82 | 11 | return parent; |
83 | } | |
84 | ||
85 | 0 | @Override |
86 | public boolean equals(Object obj) | |
87 | { | |
88 | 0 | boolean equals = false; |
89 | 0 | if (obj instanceof WikiDocument) { |
90 | 0 | equals = ((WikiDocument) obj).getFullName().equals(getFullName()); |
91 | } | |
92 | 0 | return equals; |
93 | } | |
94 | ||
95 | 0 | @Override |
96 | public int hashCode() | |
97 | { | |
98 | 0 | return getFullName().hashCode(); |
99 | } | |
100 | } |