01: /* ====================================================================
02: Licensed to the Apache Software Foundation (ASF) under one or more
03: contributor license agreements. See the NOTICE file distributed with
04: this work for additional information regarding copyright ownership.
05: The ASF licenses this file to You under the Apache License, Version 2.0
06: (the "License"); you may not use this file except in compliance with
07: the License. You may obtain a copy of the License at
08:
09: http://www.apache.org/licenses/LICENSE-2.0
10:
11: Unless required by applicable law or agreed to in writing, software
12: distributed under the License is distributed on an "AS IS" BASIS,
13: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: See the License for the specific language governing permissions and
15: limitations under the License.
16: ==================================================================== */
17:
18: package org.apache.poi.hwpf.model;
19:
20: /**
21: * A single entry in the {@link SavedByTable}.
22: *
23: * @author Daniel Noll
24: */
25: public class SavedByEntry {
26: private String userName;
27: private String saveLocation;
28:
29: public SavedByEntry(String userName, String saveLocation) {
30: this .userName = userName;
31: this .saveLocation = saveLocation;
32: }
33:
34: public String getUserName() {
35: return userName;
36: }
37:
38: public String getSaveLocation() {
39: return saveLocation;
40: }
41:
42: /**
43: * Compares this object with another, for equality.
44: *
45: * @param other the object to compare to this one.
46: * @return <code>true</code> iff the other object is equal to this one.
47: */
48: public boolean equals(Object other) {
49: if (other == this )
50: return true;
51: if (!(other instanceof SavedByEntry))
52: return false;
53: SavedByEntry that = (SavedByEntry) other;
54: return that.userName.equals(userName)
55: && that.saveLocation.equals(saveLocation);
56: }
57:
58: /**
59: * Generates a hash code for consistency with {@link #equals(Object)}.
60: *
61: * @return the hash code.
62: */
63: public int hashCode() {
64: int hash = 29;
65: hash = hash * 13 + userName.hashCode();
66: hash = hash * 13 + saveLocation.hashCode();
67: return hash;
68: }
69:
70: /**
71: * Returns a string for display.
72: *
73: * @return the string.
74: */
75: public String toString() {
76: return "SavedByEntry[userName=" + getUserName()
77: + ",saveLocation=" + getSaveLocation() + "]";
78: }
79: }
|