]> WPIA git - gigi.git/commitdiff
Make Name.equals, User.getMaxAssurancePoints()
authorFelix Dörre <felix@dogcraft.de>
Fri, 27 Jun 2014 16:06:17 +0000 (18:06 +0200)
committerFelix Dörre <felix@dogcraft.de>
Fri, 27 Jun 2014 16:06:17 +0000 (18:06 +0200)
src/org/cacert/gigi/Name.java
src/org/cacert/gigi/User.java

index 4e748954127bcfef71dc9003eec51986df104597..933982e980ce0565af9e23519714b075c8dfc719 100644 (file)
@@ -27,4 +27,30 @@ public class Name implements Outputable {
                out.print("</span>");
                out.println("</span>");
        }
                out.print("</span>");
                out.println("</span>");
        }
+       @Override
+       public boolean equals(Object obj) {
+               if (!(obj instanceof Name)) {
+                       return false;
+               }
+               Name n = (Name) obj;
+               if (!(n.fname.equals(fname) && n.lname.equals(lname))) {
+                       return false;
+               }
+               if (mname == null) {
+                       if (n.mname != null) {
+                               return false;
+                       }
+               } else if (!mname.equals(n.mname)) {
+                       return false;
+               }
+               if (suffix == null) {
+                       if (n.suffix != null) {
+                               return false;
+                       }
+               } else if (!suffix.equals(n.suffix)) {
+                       return false;
+               }
+               return true;
+
+       }
 }
 }
index 2dba0c5c7f4d72c3f2b79565a031f4beef30fe8a..96e0a111670a6161bc55b428efc3216f007a078e 100644 (file)
@@ -156,4 +156,24 @@ public class User {
                return name.equals(s.name) && email.equals(s.email)
                                && dob.equals(s.dob);
        }
                return name.equals(s.name) && email.equals(s.email)
                                && dob.equals(s.dob);
        }
+       public int getMaxAssurePoints() throws SQLException {
+               int exp = getExperiencePoints();
+               int points = 10;
+               if (exp >= 10) {
+                       points += 5;
+               }
+               if (exp >= 20) {
+                       points += 5;
+               }
+               if (exp >= 30) {
+                       points += 5;
+               }
+               if (exp >= 40) {
+                       points += 5;
+               }
+               if (exp >= 50) {
+                       points += 5;
+               }
+               return points;
+       }
 }
 }