java.lang.Object
net.i2p.router.sybil.Points
- All Implemented Interfaces:
Comparable<Points>
A total score and a List of reason Strings.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate doubleThe peer's standing, lower is more suspicious.Why the points are what they are.private static final DecimalFormatFormat used when writing the points out.Constructor Summary
Method Summary
Modifier and TypeMethodDescriptionvoidAdd points with a reason.intbooleanstatic PointsfromString(String s) For persistence.doubleTotal points accumulated.Reasons accumulated with the points.inthashCode()toString()Return a string representation.voidtoString(StringBuilder buf) For persistence.
Field Details
points
private double pointsThe peer's standing, lower is more suspicious.reasons
TWO_DECIMALS
Format used when writing the points out.
Constructor Details
Points
private Points()Create a new empty Points instance.Points
Create a new Points instance with an initial value.- Parameters:
d- the point value to start from, positive for a penalty or negative for creditreason- may not contain '%'
Method Details
getPoints
public double getPoints()Total points accumulated.- Returns:
- the accumulated score, positive for penalties and negative for credits
getReasons
addPoints
Add points with a reason.- Parameters:
d- the point value to add, positive for a penalty or negative for creditreason- may not contain '%'
compareTo
- Specified by:
compareToin interfaceComparable<Points>
equals
hashCode
toString
toString
For persistence. Total points and reasons, '%' separated, no newline. The separation character is chosen to not conflict with decimal point in various locales, or chars in reasons, including HTML links, or special chars in Pattern.- Parameters:
buf- the buffer to append the total and the '%'-separated reasons to
fromString