01: /*
02: * This file is part of PFIXCORE.
03: *
04: * PFIXCORE is free software; you can redistribute it and/or modify
05: * it under the terms of the GNU Lesser General Public License as published by
06: * the Free Software Foundation; either version 2 of the License, or
07: * (at your option) any later version.
08: *
09: * PFIXCORE is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: * GNU Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public License
15: * along with PFIXCORE; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: *
18: */
19:
20: package de.schlund.pfixxml.targets;
21:
22: /**
23: * PageInfo.java
24: *
25: *
26: * Created: Mon Jul 23 19:17:02 2001
27: *
28: * @author <a href="mailto: "Jens Lautenbacher</a>
29: *
30: *
31: */
32:
33: public class PageInfo implements Comparable<PageInfo> {
34: private String name;
35: private String variant;
36: private TargetGenerator generator;
37:
38: protected PageInfo(TargetGenerator gen, String pagename,
39: String pagevariant) {
40: name = pagename;
41: variant = pagevariant;
42: generator = gen;
43: }
44:
45: public String getName() {
46: return name;
47: }
48:
49: public String getVariant() {
50: return variant;
51: }
52:
53: public TargetGenerator getTargetGenerator() {
54: return generator;
55: }
56:
57: public int compareTo(PageInfo in) {
58: if (getTargetGenerator().getName().compareTo(
59: in.getTargetGenerator().getName()) != 0) {
60: return getTargetGenerator().getName().compareTo(
61: in.getTargetGenerator().getName());
62: } else {
63: if (!getName().equals(in.getName())) {
64: return getName().compareTo(in.getName());
65: } else {
66: if (getVariant() == null && in.getVariant() == null) {
67: return 0;
68: } else if (getVariant() == null
69: && in.getVariant() != null) {
70: return 1;
71: } else if (getVariant() != null
72: && in.getVariant() == null) {
73: return -1;
74: } else {
75: return getVariant().compareTo(in.getVariant());
76: }
77: }
78: }
79: }
80:
81: public String toString() {
82: return "[PAGE: " + name + " " + generator.getName() + "/"
83: + getVariant() + "]";
84: }
85:
86: }// PageInfo
|