View Javadoc
1 /* ====================================================================
2 * License:
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in
13 * the documentation and/or other materials provided with the
14 * distribution.
15 *
16 * 3. The end-user documentation included with the redistribution,
17 * if any, must include the following acknowledgment:
18 * "This product includes software developed by
19 * Robert Half International (http://www.rhi.com/)."
20 * Alternately, this acknowledgment may appear in the software itself,
21 * if and wherever such third-party acknowledgments normally appear.
22 *
23 * 4. The names "Parc", "RHI", and "Robert Half International" must
24 * not be used to endorse or promote products derived from this
25 * software without prior written permission. For written
26 * permission, please contact pete.mckinstry@rhi.com.
27 *
28 * 5. Products derived from this software may not be called "PARC",
29 * nor may "PARC" appear in their name, without prior written
30 * permission of Robert Half International.
31 *
32 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
33 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
34 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
35 * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
36 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
37 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
38 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
39 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
40 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
41 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
42 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
43 * SUCH DAMAGE.
44 * ====================================================================
45 *
46 */
47 package com.rhi.architecture.resource;
48
49 /***
50 * ResourceEntry.java
51 *
52 * @author <a href="mailto:pete_mckinstry@yahoo.com">Pete McKinstry</a>
53 * @copyright 2002, Robert Half International, All rights reserved.
54 *
55 * @version 1.0
56 */
57 public class ResourceEntry implements Comparable {
58
59 private String key = null;
60 private String type = null;
61 private int priority = 0;
62
63 /***
64 * Constructor for ResourceEntry.
65 */
66 public ResourceEntry() {
67 super();
68 }
69
70 /***
71 * priority comparison of ResourceEntries.
72 * If priority of obj1 < priority of obj2, return -1
73 * If priority of obj1 > priority of obj2, return 1
74 * Otherwise (priority matches), return the results of
75 * getKey().compareTo()
76 * @param o
77 * @return int
78 * @see java.lang.Comparable#compareTo(Object)
79 */
80 public int compareTo(Object o) {
81 ResourceEntry other = (ResourceEntry) o;
82 if (this.priority < other.priority) {
83 return -1;
84 }
85 if (this.priority > other.priority) {
86 return 1;
87 }
88 return this.key.compareTo(this.key);
89 }
90
91 /***
92 * Returns the key.
93 * @return String
94 */
95 public String getKey() {
96 return key;
97 }
98 /***
99 * Sets the key.
100 * @param key The key to set
101 */
102 public void setKey(String key) {
103 this.key = key;
104 }
105
106 /***
107 * Returns the priority.
108 * @return int
109 */
110 public int getPriority() {
111 return priority;
112 }
113 /***
114 * Sets the priority.
115 * @param priority The priority to set
116 */
117 public void setPriority(int priority) {
118 this.priority = priority;
119 }
120
121 /***
122 * Returns the type.
123 * @return String
124 */
125 public String getType() {
126 return type;
127 }
128 /***
129 * Sets the type.
130 * @param type The type to set
131 */
132 public void setType(String type) {
133 this.type = type;
134 }
135
136 /***
137 * @see java.lang.Object#toString()
138 * @return String
139 */
140 public String toString() {
141 return "Resource: "
142 + "\n\tkey = "
143 + key
144 + "\n\ttype = "
145 + type
146 + "\n\tpriority = "
147 + priority
148 + "\n";
149 }
150
151 }
This page was automatically generated by Maven