1 package org.cacert.gigi.dbObjects;
3 import java.io.PrintWriter;
6 import org.cacert.gigi.localisation.Language;
7 import org.cacert.gigi.output.Outputable;
9 public class Name implements Outputable, Cloneable {
19 public Name(String fname, String lname, String mname, String suffix) {
27 public void output(PrintWriter out, Language l, Map<String, Object> vars) {
28 out.println("<span class=\"accountdetail\">");
29 out.print("<span class=\"fname\">");
31 out.print("</span> ");
32 out.print("<span class=\"lname\">");
35 out.println("</span>");
39 public String toString() {
40 return fname + " " + lname;
44 public int hashCode() {
47 result = prime * result + ((fname == null) ? 0 : fname.hashCode());
48 result = prime * result + ((lname == null) ? 0 : lname.hashCode());
49 result = prime * result + ((mname == null) ? 0 : mname.hashCode());
50 result = prime * result + ((suffix == null) ? 0 : suffix.hashCode());
55 public boolean equals(Object obj) {
62 if (getClass() != obj.getClass()) {
65 Name other = (Name) obj;
67 if (other.fname != null) {
70 } else if ( !fname.equals(other.fname)) {
74 if (other.lname != null) {
77 } else if ( !lname.equals(other.lname)) {
81 if (other.mname != null) {
84 } else if ( !mname.equals(other.mname)) {
88 if (other.suffix != null) {
91 } else if ( !suffix.equals(other.suffix)) {
97 public boolean matches(String text) {
98 return text.equals(fname + " " + lname) || //
99 (mname != null && text.equals(fname + " " + mname + " " + lname)) || //
100 (suffix != null && text.equals(fname + " " + lname + " " + suffix)) || //
101 (mname != null && suffix != null && text.equals(fname + " " + mname + " " + lname + " " + suffix));
105 protected Name clone() {
107 return (Name) super.clone();
108 } catch (CloneNotSupportedException e) {