projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove more convenience methods.
[Sone.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
sone
/
data
/
Sone.java
diff --git
a/src/main/java/net/pterodactylus/sone/data/Sone.java
b/src/main/java/net/pterodactylus/sone/data/Sone.java
index
c2f9ae1
..
d515424
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/data/Sone.java
+++ b/
src/main/java/net/pterodactylus/sone/data/Sone.java
@@
-1,5
+1,5
@@
/*
/*
- * Sone - Sone.java - Copyright © 2010 David Roden
+ * Sone - Sone.java - Copyright © 2010
–2012
David Roden
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@
-33,7
+33,7
@@
import net.pterodactylus.sone.core.Options;
import net.pterodactylus.sone.freenet.wot.Identity;
import net.pterodactylus.sone.freenet.wot.OwnIdentity;
import net.pterodactylus.sone.template.SoneAccessor;
import net.pterodactylus.sone.freenet.wot.Identity;
import net.pterodactylus.sone.freenet.wot.OwnIdentity;
import net.pterodactylus.sone.template.SoneAccessor;
-import net.pterodactylus.util.filter.Filter;
+import net.pterodactylus.util.
collection.
filter.Filter;
import net.pterodactylus.util.logging.Logging;
import net.pterodactylus.util.validation.Validation;
import freenet.keys.FreenetURI;
import net.pterodactylus.util.logging.Logging;
import net.pterodactylus.util.validation.Validation;
import freenet.keys.FreenetURI;
@@
-150,7
+150,7
@@
public class Sone implements Fingerprintable, Comparable<Sone> {
}
};
}
};
- /** Filter that matches all {@link Core#
isLocalSone(Sone
) local Sones}. */
+ /** Filter that matches all {@link Core#
getLocalSones(
) local Sones}. */
public static final Filter<Sone> LOCAL_SONE_FILTER = new Filter<Sone>() {
@Override
public static final Filter<Sone> LOCAL_SONE_FILTER = new Filter<Sone>() {
@Override
@@
-175,6
+175,9
@@
public class Sone implements Fingerprintable, Comparable<Sone> {
/** The ID of this Sone. */
private final String id;
/** The ID of this Sone. */
private final String id;
+ /** Whether this is a local Sone. */
+ private final boolean local;
+
/** The identity of this Sone. */
private Identity identity;
/** The identity of this Sone. */
private Identity identity;
@@
-229,9
+232,12
@@
public class Sone implements Fingerprintable, Comparable<Sone> {
*
* @param id
* The ID of the Sone
*
* @param id
* The ID of the Sone
+ * @param local
+ * {@code true} if this Sone is local, {@code false} otherwise
*/
*/
- public Sone(String id) {
+ public Sone(String id
, boolean local
) {
this.id = id;
this.id = id;
+ this.local = local;
}
//
}
//
@@
-275,6
+281,15
@@
public class Sone implements Fingerprintable, Comparable<Sone> {
}
/**
}
/**
+ * Returns whether this Sone is local.
+ *
+ * @return {@code true} if this Sone is local, {@code false} otherwise
+ */
+ public boolean isLocal() {
+ return local;
+ }
+
+ /**
* Returns the name of this Sone.
*
* @return The name of this Sone
* Returns the name of this Sone.
*
* @return The name of this Sone
@@
-305,7
+320,7
@@
public class Sone implements Fingerprintable, Comparable<Sone> {
return this;
}
if (!this.requestUri.equalsKeypair(requestUri)) {
return this;
}
if (!this.requestUri.equalsKeypair(requestUri)) {
- logger.log(Level.WARNING,
"Request URI %s tried to overwrite %s!", new Object[] { requestUri, this.requestUri }
);
+ logger.log(Level.WARNING,
String.format("Request URI %s tried to overwrite %s!", requestUri, this.requestUri)
);
return this;
}
return this;
return this;
}
return this;
@@
-333,7
+348,7
@@
public class Sone implements Fingerprintable, Comparable<Sone> {
return this;
}
if (!this.insertUri.equalsKeypair(insertUri)) {
return this;
}
if (!this.insertUri.equalsKeypair(insertUri)) {
- logger.log(Level.WARNING,
"Request URI %s tried to overwrite %s!", new Object[] { insertUri, this.insertUri }
);
+ logger.log(Level.WARNING,
String.format("Request URI %s tried to overwrite %s!", insertUri, this.insertUri)
);
return this;
}
return this;
return this;
}
return this;
@@
-358,7
+373,7
@@
public class Sone implements Fingerprintable, Comparable<Sone> {
*/
public void setLatestEdition(long latestEdition) {
if (!(latestEdition > this.latestEdition)) {
*/
public void setLatestEdition(long latestEdition) {
if (!(latestEdition > this.latestEdition)) {
- logger.log(Level.FINE,
"New latest edition %d is not greater than current latest edition %d!", new Object[] { latestEdition, this.latestEdition }
);
+ logger.log(Level.FINE,
String.format("New latest edition %d is not greater than current latest edition %d!", latestEdition, this.latestEdition)
);
return;
}
this.latestEdition = latestEdition;
return;
}
this.latestEdition = latestEdition;
@@
-560,7
+575,7
@@
public class Sone implements Fingerprintable, Comparable<Sone> {
*/
public void addPost(Post post) {
if (post.getSone().equals(this) && posts.add(post)) {
*/
public void addPost(Post post) {
if (post.getSone().equals(this) && posts.add(post)) {
- logger.log(Level.FINEST,
"Adding %s to “%s”.", new Object[] { post, getName() }
);
+ logger.log(Level.FINEST,
String.format("Adding %s to “%s”.", post, getName())
);
}
}
}
}