-public class Sone implements Fingerprintable, Comparable<Sone> {
-
- /** comparator that sorts Sones by their nice name. */
- public static final Comparator<Sone> NICE_NAME_COMPARATOR = new Comparator<Sone>() {
-
- @Override
- public int compare(Sone leftSone, Sone rightSone) {
- int diff = SoneAccessor.getNiceName(leftSone).compareToIgnoreCase(SoneAccessor.getNiceName(rightSone));
- if (diff != 0) {
- return diff;
- }
- return leftSone.getId().compareToIgnoreCase(rightSone.getId());
- }
-
- };
-
- /** Filter to remove Sones that have not been downloaded. */
- public static final Filter<Sone> EMPTY_SONE_FILTER = new Filter<Sone>() {
-
- @Override
- public boolean filterObject(Sone sone) {
- return sone.getTime() != 0;
- }
- };
-
- /** Filter that matches all {@link Core#isLocalSone(Sone) local Sones}. */
- public static final Filter<Sone> LOCAL_SONE_FILTER = new Filter<Sone>() {
-
- @Override
- public boolean filterObject(Sone sone) {
- return sone.getIdentity() instanceof OwnIdentity;
- }
-
- };
-
- /** The logger. */
- private static final Logger logger = Logging.getLogger(Sone.class);
-
- /** The ID of this Sone. */
- private final String id;
-
- /** The identity of this Sone. */
- private Identity identity;
-
- /** The URI under which the Sone is stored in Freenet. */
- private volatile FreenetURI requestUri;
-
- /** The URI used to insert a new version of this Sone. */
- /* This will be null for remote Sones! */
- private volatile FreenetURI insertUri;
-
- /** The latest edition of the Sone. */
- private volatile long latestEdition;
-
- /** The time of the last inserted update. */
- private volatile long time;
-
- /** The profile of this Sone. */
- private volatile Profile profile = new Profile();
-
- /** The client used by the Sone. */
- private volatile Client client;
-
- /** All friend Sones. */
- private final Set<String> friendSones = Collections.synchronizedSet(new HashSet<String>());
-
- /** All posts. */
- private final Set<Post> posts = Collections.synchronizedSet(new HashSet<Post>());
-
- /** All replies. */
- private final Set<Reply> replies = Collections.synchronizedSet(new HashSet<Reply>());
-
- /** The IDs of all liked posts. */
- private final Set<String> likedPostIds = Collections.synchronizedSet(new HashSet<String>());
-
- /** The IDs of all liked replies. */
- private final Set<String> likedReplyIds = Collections.synchronizedSet(new HashSet<String>());
-
- /** Sone-specific options. */
- private final Options options = new Options();