001: /*
002: * This file is part of PFIXCORE.
003: *
004: * PFIXCORE is free software; you can redistribute it and/or modify
005: * it under the terms of the GNU Lesser General Public License as published by
006: * the Free Software Foundation; either version 2 of the License, or
007: * (at your option) any later version.
008: *
009: * PFIXCORE is distributed in the hope that it will be useful,
010: * but WITHOUT ANY WARRANTY; without even the implied warranty of
011: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
012: * GNU Lesser General Public License for more details.
013: *
014: * You should have received a copy of the GNU Lesser General Public License
015: * along with PFIXCORE; if not, write to the Free Software
016: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
017: */
018:
019: package de.schlund.pfixxml.targets;
020:
021: import de.schlund.pfixxml.resources.DocrootResource;
022:
023: /**
024: * Stores information about an include part used by a target.
025: *
026: * @author Sebastian Marsching <sebastian.marsching@1und1.de>
027: * @see de.schlund.pfixxml.targets.DependencyType#TEXT
028: */
029: public class AuxDependencyInclude extends AuxDependencyFile {
030: private String part;
031:
032: private String theme;
033:
034: public AuxDependencyInclude(DocrootResource path, String part,
035: String theme) {
036: super (path);
037: this .type = DependencyType.TEXT;
038: this .part = part;
039: this .theme = theme;
040:
041: String key = type.getTag() + "@" + path.toString() + "@" + part
042: + "@" + theme;
043: this .hashCode = key.hashCode();
044: }
045:
046: /**
047: * Return name of the part that is included
048: *
049: * @return part name
050: */
051: public String getPart() {
052: return part;
053: }
054:
055: /**
056: * Returns name of the theme variant being used
057: *
058: * @return theme name
059: */
060: public String getTheme() {
061: return theme;
062: }
063:
064: public int compareTo(AuxDependency o) {
065: int comp;
066:
067: comp = super .compareTo(o);
068: if (comp != 0) {
069: return comp;
070: }
071:
072: AuxDependencyInclude a = (AuxDependencyInclude) o;
073:
074: comp = part.compareTo(a.part);
075: if (comp != 0) {
076: return comp;
077: }
078:
079: return theme.compareTo(a.theme);
080: }
081:
082: public boolean equals(Object obj) {
083: if (obj instanceof AuxDependencyInclude) {
084: AuxDependencyInclude a = (AuxDependencyInclude) obj;
085: return (this .compareTo(a) == 0);
086: } else {
087: return false;
088: }
089: }
090:
091: public int hashCode() {
092: return hashCode;
093: }
094:
095: public String toString() {
096: return "[AUX/" + getType() + " " + getPath().getRelativePath()
097: + "@" + getPart() + "@" + getTheme() + "]";
098: }
099:
100: }
|