/**
* A Sone defines everything about a user: the {@link User} itself, her profile,
* her status updates.
+ * <p>
+ * Operations that modify the Sone need to synchronize on the Sone in question.
*
* @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
*/
/* This will be null for remote Sones! */
private final FreenetURI insertUri;
+ /** The profile of this Sone. */
+ private Profile profile;
+
/** All friend Sones. */
private final Set<Sone> friendSones = new HashSet<Sone>();
}
/**
+ * Returns a copy of the profile. If you want to update values in the
+ * profile of this Sone, update the values in the returned {@link Profile}
+ * and use {@link #setProfile(Profile)} to change the profile in this Sone.
+ *
+ * @return A copy of the profile
+ */
+ public Profile getProfile() {
+ return new Profile(profile);
+ }
+
+ /**
+ * Sets the profile of this Sone.
+ *
+ * @param profile
+ * The profile to set
+ */
+ public synchronized void setProfile(Profile profile) {
+ this.profile = profile;
+ modificationCounter++;
+ }
+
+ /**
* Returns all friend Sones of this Sone.
*
* @return The friend Sones of this Sone
return id.hashCode();
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean equals(Object object) {
+ if (!(object instanceof Sone)) {
+ return false;
+ }
+ return ((Sone) object).id.equals(id);
+ }
+
}