|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
ImportVo.java | 100% | 100% | 100% | 100% |
|
1 | /* $Id: ImportVo.java,v 1.4 2006/10/20 20:23:01 m31 Exp $ | |
2 | * | |
3 | * This file is part of the project "Hilbert II" - http://www.qedeq.org | |
4 | * | |
5 | * Copyright 2000-2006, 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.dto.module; | |
19 | ||
20 | import org.qedeq.kernel.base.module.Import; | |
21 | import org.qedeq.kernel.base.module.Specification; | |
22 | import org.qedeq.kernel.utility.EqualsUtility; | |
23 | ||
24 | ||
25 | /** | |
26 | * Module import. Every needed module must be referenced as an module import. | |
27 | * | |
28 | * @version $Revision: 1.4 $ | |
29 | * @author Michael Meyling | |
30 | */ | |
31 | public final class ImportVo implements Import { | |
32 | ||
33 | /** Label for the imported module. All references to that module must have this prefix. */ | |
34 | private String label; | |
35 | ||
36 | /** Specification of imported module. Includes location information. */ | |
37 | private Specification specification; | |
38 | ||
39 | /** | |
40 | * Constructs a new import. | |
41 | * | |
42 | * @param label Label for this import. All references to that module must | |
43 | * have this prefix. | |
44 | * @param specification Import specification. Includes location information. | |
45 | */ | |
46 | 33 | public ImportVo(final String label, final SpecificationVo specification) { |
47 | 33 | this.label = label; |
48 | 33 | this.specification = specification; |
49 | } | |
50 | ||
51 | /** | |
52 | * Constructs an empty import. | |
53 | */ | |
54 | 89 | public ImportVo() { |
55 | // nothing to do | |
56 | } | |
57 | ||
58 | /** | |
59 | * Set label for this import module. All references to this module must have this | |
60 | * prefix. | |
61 | * | |
62 | * @param label Prefix for this imported module. | |
63 | */ | |
64 | 76 | public final void setLabel(final String label) { |
65 | 76 | this.label = label; |
66 | } | |
67 | ||
68 | 500 | public final String getLabel() { |
69 | 500 | return label; |
70 | } | |
71 | ||
72 | /** | |
73 | * Set specification of this imported module. Contains location information. | |
74 | * | |
75 | * @param specification Module specification. | |
76 | */ | |
77 | 76 | public final void setSpecification(final SpecificationVo specification) { |
78 | 76 | this.specification = specification; |
79 | } | |
80 | ||
81 | 552 | public final Specification getSpecification() { |
82 | 552 | return specification; |
83 | } | |
84 | ||
85 | 134 | public boolean equals(final Object obj) { |
86 | 134 | if (!(obj instanceof ImportVo)) { |
87 | 5 | return false; |
88 | } | |
89 | 129 | final ImportVo other = (ImportVo) obj; |
90 | 129 | return EqualsUtility.equals(getLabel(), other.getLabel()) |
91 | && EqualsUtility.equals(getSpecification(), other.getSpecification()); | |
92 | } | |
93 | ||
94 | 116 | public int hashCode() { |
95 | 116 | return (getLabel() != null ? getLabel().hashCode() : 0) |
96 | 116 | ^ (getSpecification() != null ? 1 ^ getSpecification().hashCode() : 0); |
97 | } | |
98 | ||
99 | 81 | public String toString() { |
100 | 81 | return label + ":" + specification; |
101 | } | |
102 | ||
103 | } |
|