diff options
author | Dominik <dominik@dominikschuermann.de> | 2012-03-09 16:27:29 +0100 |
---|---|---|
committer | Dominik <dominik@dominikschuermann.de> | 2012-03-09 16:27:29 +0100 |
commit | 8452fb62b7d80c297395a8d12acd55a0375bff44 (patch) | |
tree | a05f61cf17bb9c58dd4043b465c038b86a8dd685 /src/org/apg/CachedPassPhrase.java | |
parent | df6933bfb83e131f9ed66c35cfdb0cb6268bc480 (diff) | |
download | open-keychain-8452fb62b7d80c297395a8d12acd55a0375bff44.tar.gz open-keychain-8452fb62b7d80c297395a8d12acd55a0375bff44.tar.bz2 open-keychain-8452fb62b7d80c297395a8d12acd55a0375bff44.zip |
renaming whole package to org.apg to simplifiy name
Diffstat (limited to 'src/org/apg/CachedPassPhrase.java')
-rw-r--r-- | src/org/apg/CachedPassPhrase.java | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/org/apg/CachedPassPhrase.java b/src/org/apg/CachedPassPhrase.java new file mode 100644 index 000000000..2d67a300d --- /dev/null +++ b/src/org/apg/CachedPassPhrase.java @@ -0,0 +1,48 @@ +package org.apg; + +public class CachedPassPhrase { + public final long timestamp; + public final String passPhrase; + + public CachedPassPhrase(long timestamp, String passPhrase) { + super(); + this.timestamp = timestamp; + this.passPhrase = passPhrase; + } + + @Override + public int hashCode() { + int hc1 = (int) (this.timestamp & 0xffffffff); + int hc2 = (this.passPhrase == null ? 0 : this.passPhrase.hashCode()); + return (hc1 + hc2) * hc2 + hc1; + } + + @Override + public boolean equals(Object other) { + if (!(other instanceof CachedPassPhrase)) { + return false; + } + + CachedPassPhrase o = (CachedPassPhrase) other; + if (timestamp != o.timestamp) { + return false; + } + + if (passPhrase != o.passPhrase) { + if (passPhrase == null || o.passPhrase == null) { + return false; + } + + if (!passPhrase.equals(o.passPhrase)) { + return false; + } + } + + return true; + } + + @Override + public String toString() { + return "(" + timestamp + ", *******)"; + } +} |