This commit is contained in:
Brokkonaut
2019-06-23 16:45:14 +02:00
parent 76f7f8701d
commit 1525d7682f
25 changed files with 260 additions and 285 deletions

View File

@@ -1,14 +1,48 @@
package de.diddiz.LogBlock;
public enum Logging {
BLOCKPLACE(true), BLOCKBREAK(true), SIGNTEXT(true), TNTEXPLOSION(true), CREEPEREXPLOSION(true),
GHASTFIREBALLEXPLOSION(true), ENDERDRAGON(true), MISCEXPLOSION(true), FIRE(true), LEAVESDECAY,
LAVAFLOW, WATERFLOW, CHESTACCESS, KILL, CHAT, SNOWFORM, SNOWFADE, DOORINTERACT,
SWITCHINTERACT, CAKEEAT, ENDERMEN, NOTEBLOCKINTERACT, DIODEINTERACT, COMPARATORINTERACT,
PRESUREPLATEINTERACT, TRIPWIREINTERACT, CREATURECROPTRAMPLE, CROPTRAMPLE,
NATURALSTRUCTUREGROW, GRASSGROWTH, MYCELIUMSPREAD, VINEGROWTH, MUSHROOMSPREAD,
WITHER(true), WITHER_SKULL(true), BONEMEALSTRUCTUREGROW, WORLDEDIT, TNTMINECARTEXPLOSION(true),
ENDERCRYSTALEXPLOSION(true), BEDEXPLOSION(true), DRAGONEGGTELEPORT(true), DAYLIGHTDETECTORINTERACT,
BLOCKPLACE(true),
BLOCKBREAK(true),
SIGNTEXT(true),
TNTEXPLOSION(true),
CREEPEREXPLOSION(true),
GHASTFIREBALLEXPLOSION(true),
ENDERDRAGON(true),
MISCEXPLOSION(true),
FIRE(true),
LEAVESDECAY,
LAVAFLOW,
WATERFLOW,
CHESTACCESS,
KILL,
CHAT,
SNOWFORM,
SNOWFADE,
DOORINTERACT,
SWITCHINTERACT,
CAKEEAT,
ENDERMEN,
NOTEBLOCKINTERACT,
DIODEINTERACT,
COMPARATORINTERACT,
PRESUREPLATEINTERACT,
TRIPWIREINTERACT,
CREATURECROPTRAMPLE,
CROPTRAMPLE,
NATURALSTRUCTUREGROW,
GRASSGROWTH,
MYCELIUMSPREAD,
VINEGROWTH,
MUSHROOMSPREAD,
WITHER(true),
WITHER_SKULL(true),
BONEMEALSTRUCTUREGROW,
WORLDEDIT,
TNTMINECARTEXPLOSION(true),
ENDERCRYSTALEXPLOSION(true),
BEDEXPLOSION(true),
DRAGONEGGTELEPORT(true),
DAYLIGHTDETECTORINTERACT,
LECTERNBOOKCHANGE(true);
public static final int length = Logging.values().length;

View File

@@ -291,21 +291,26 @@ public final class QueryParams implements Cloneable {
}
if (bct == BlockChangeType.KILLS) {
if (sum == SummarizationMode.PLAYERS) {
return "SELECT playername, UUID, SUM(kills) AS kills, SUM(killed) AS killed FROM ((SELECT killer AS playerid, count(*) AS kills, 0 as killed FROM `" + getTable() + "-kills` INNER JOIN `lb-players` as killers ON (killer=killers.playerid) INNER JOIN `lb-players` as victims ON (victim=victims.playerid) " + getWhere(BlockChangeType.KILLS) + "GROUP BY killer) UNION (SELECT victim AS playerid, 0 as kills, count(*) AS killed FROM `" + getTable() + "-kills` INNER JOIN `lb-players` as killers ON (killer=killers.playerid) INNER JOIN `lb-players` as victims ON (victim=victims.playerid) " + getWhere(BlockChangeType.KILLS) + "GROUP BY victim)) AS t INNER JOIN `lb-players` USING (playerid) GROUP BY playerid ORDER BY SUM(kills) + SUM(killed) " + order + " " + getLimit();
return "SELECT playername, UUID, SUM(kills) AS kills, SUM(killed) AS killed FROM ((SELECT killer AS playerid, count(*) AS kills, 0 as killed FROM `" + getTable() + "-kills` INNER JOIN `lb-players` as killers ON (killer=killers.playerid) INNER JOIN `lb-players` as victims ON (victim=victims.playerid) " + getWhere(BlockChangeType.KILLS) + "GROUP BY killer) UNION (SELECT victim AS playerid, 0 as kills, count(*) AS killed FROM `" + getTable()
+ "-kills` INNER JOIN `lb-players` as killers ON (killer=killers.playerid) INNER JOIN `lb-players` as victims ON (victim=victims.playerid) " + getWhere(BlockChangeType.KILLS) + "GROUP BY victim)) AS t INNER JOIN `lb-players` USING (playerid) GROUP BY playerid ORDER BY SUM(kills) + SUM(killed) " + order + " " + getLimit();
}
throw new IllegalStateException("Invalid summarization for kills");
}
if (bct == BlockChangeType.ENTITIES || bct == BlockChangeType.ENTITIES_CREATED || bct == BlockChangeType.ENTITIES_KILLED) {
if (sum == SummarizationMode.TYPES) {
return "SELECT entitytypeid, SUM(created) AS created, SUM(destroyed) AS destroyed FROM ((SELECT entitytypeid, count(*) AS created, 0 AS destroyed FROM `" + getTable() + "-entities` INNER JOIN `lb-players` USING (playerid) " + getWhere(BlockChangeType.ENTITIES_CREATED) + "GROUP BY entitytypeid) UNION (SELECT entitytypeid, 0 AS created, count(*) AS destroyed FROM `" + getTable() + "-entities` INNER JOIN `lb-players` USING (playerid) " + getWhere(BlockChangeType.ENTITIES_KILLED) + "GROUP BY entitytypeid)) AS t GROUP BY entitytypeid ORDER BY SUM(created) + SUM(destroyed) " + order + " " + getLimit();
return "SELECT entitytypeid, SUM(created) AS created, SUM(destroyed) AS destroyed FROM ((SELECT entitytypeid, count(*) AS created, 0 AS destroyed FROM `" + getTable() + "-entities` INNER JOIN `lb-players` USING (playerid) " + getWhere(BlockChangeType.ENTITIES_CREATED) + "GROUP BY entitytypeid) UNION (SELECT entitytypeid, 0 AS created, count(*) AS destroyed FROM `" + getTable() + "-entities` INNER JOIN `lb-players` USING (playerid) " + getWhere(BlockChangeType.ENTITIES_KILLED)
+ "GROUP BY entitytypeid)) AS t GROUP BY entitytypeid ORDER BY SUM(created) + SUM(destroyed) " + order + " " + getLimit();
} else {
return "SELECT playername, UUID, SUM(created) AS created, SUM(destroyed) AS destroyed FROM ((SELECT playerid, count(*) AS created, 0 AS destroyed FROM `" + getTable() + "-entities` " + getWhere(BlockChangeType.ENTITIES_CREATED) + "GROUP BY playerid) UNION (SELECT playerid, 0 AS created, count(*) AS destroyed FROM `" + getTable() + "-entities` " + getWhere(BlockChangeType.ENTITIES_KILLED) + "GROUP BY playerid)) AS t INNER JOIN `lb-players` USING (playerid) GROUP BY playerid ORDER BY SUM(created) + SUM(destroyed) " + order + " " + getLimit();
return "SELECT playername, UUID, SUM(created) AS created, SUM(destroyed) AS destroyed FROM ((SELECT playerid, count(*) AS created, 0 AS destroyed FROM `" + getTable() + "-entities` " + getWhere(BlockChangeType.ENTITIES_CREATED) + "GROUP BY playerid) UNION (SELECT playerid, 0 AS created, count(*) AS destroyed FROM `" + getTable() + "-entities` " + getWhere(BlockChangeType.ENTITIES_KILLED)
+ "GROUP BY playerid)) AS t INNER JOIN `lb-players` USING (playerid) GROUP BY playerid ORDER BY SUM(created) + SUM(destroyed) " + order + " " + getLimit();
}
}
if (sum == SummarizationMode.TYPES) {
return "SELECT type, SUM(created) AS created, SUM(destroyed) AS destroyed FROM ((SELECT type, count(*) AS created, 0 AS destroyed FROM `" + getTable() + "-blocks` INNER JOIN `lb-players` USING (playerid) " + getWhere(BlockChangeType.CREATED) + "GROUP BY type) UNION (SELECT replaced AS type, 0 AS created, count(*) AS destroyed FROM `" + getTable() + "-blocks` INNER JOIN `lb-players` USING (playerid) " + getWhere(BlockChangeType.DESTROYED) + "GROUP BY replaced)) AS t GROUP BY type ORDER BY SUM(created) + SUM(destroyed) " + order + " " + getLimit();
return "SELECT type, SUM(created) AS created, SUM(destroyed) AS destroyed FROM ((SELECT type, count(*) AS created, 0 AS destroyed FROM `" + getTable() + "-blocks` INNER JOIN `lb-players` USING (playerid) " + getWhere(BlockChangeType.CREATED) + "GROUP BY type) UNION (SELECT replaced AS type, 0 AS created, count(*) AS destroyed FROM `" + getTable() + "-blocks` INNER JOIN `lb-players` USING (playerid) " + getWhere(BlockChangeType.DESTROYED)
+ "GROUP BY replaced)) AS t GROUP BY type ORDER BY SUM(created) + SUM(destroyed) " + order + " " + getLimit();
} else {
return "SELECT playername, UUID, SUM(created) AS created, SUM(destroyed) AS destroyed FROM ((SELECT playerid, count(*) AS created, 0 AS destroyed FROM `" + getTable() + "-blocks` " + getWhere(BlockChangeType.CREATED) + "GROUP BY playerid) UNION (SELECT playerid, 0 AS created, count(*) AS destroyed FROM `" + getTable() + "-blocks` " + getWhere(BlockChangeType.DESTROYED) + "GROUP BY playerid)) AS t INNER JOIN `lb-players` USING (playerid) GROUP BY playerid ORDER BY SUM(created) + SUM(destroyed) " + order + " " + getLimit();
return "SELECT playername, UUID, SUM(created) AS created, SUM(destroyed) AS destroyed FROM ((SELECT playerid, count(*) AS created, 0 AS destroyed FROM `" + getTable() + "-blocks` " + getWhere(BlockChangeType.CREATED) + "GROUP BY playerid) UNION (SELECT playerid, 0 AS created, count(*) AS destroyed FROM `" + getTable() + "-blocks` " + getWhere(BlockChangeType.DESTROYED)
+ "GROUP BY playerid)) AS t INNER JOIN `lb-players` USING (playerid) GROUP BY playerid ORDER BY SUM(created) + SUM(destroyed) " + order + " " + getLimit();
}
}
@@ -581,15 +586,13 @@ public final class QueryParams implements Cloneable {
where,
loc.getBlockX(), loc.getBlockX(),
loc.getBlockY(), loc.getBlockY(),
loc.getBlockZ(), loc.getBlockZ()
);
loc.getBlockZ(), loc.getBlockZ());
} else if (radius > 0) {
compileLocationQuery(
where,
loc.getBlockX() - radius + 1, loc.getBlockX() + radius - 1,
loc.getBlockY() - radius + 1, loc.getBlockY() + radius - 1,
loc.getBlockZ() - radius + 1, loc.getBlockZ() + radius - 1
);
loc.getBlockZ() - radius + 1, loc.getBlockZ() + radius - 1);
}
} else if (sel != null) {
@@ -597,8 +600,7 @@ public final class QueryParams implements Cloneable {
where,
sel.getMinimumPoint().getBlockX(), sel.getMaximumPoint().getBlockX(),
sel.getMinimumPoint().getBlockY(), sel.getMaximumPoint().getBlockY(),
sel.getMinimumPoint().getBlockZ(), sel.getMaximumPoint().getBlockZ()
);
sel.getMinimumPoint().getBlockZ(), sel.getMaximumPoint().getBlockZ());
}
}
if (!players.isEmpty() && sum != SummarizationMode.PLAYERS && blockChangeType != BlockChangeType.KILLS) {
@@ -1028,14 +1030,26 @@ public final class QueryParams implements Cloneable {
}
public static enum BlockChangeType {
ALL, BOTH, CHESTACCESS, CREATED, DESTROYED, CHAT, KILLS, ENTITIES, ENTITIES_CREATED, ENTITIES_KILLED,
ALL,
BOTH,
CHESTACCESS,
CREATED,
DESTROYED,
CHAT,
KILLS,
ENTITIES,
ENTITIES_CREATED,
ENTITIES_KILLED,
}
public static enum Order {
ASC, DESC
ASC,
DESC
}
public static enum SummarizationMode {
NONE, PLAYERS, TYPES
NONE,
PLAYERS,
TYPES
}
}

View File

@@ -1,5 +1,7 @@
package de.diddiz.LogBlock;
public enum ToolBehavior {
TOOL, BLOCK, NONE
TOOL,
BLOCK,
NONE
}

View File

@@ -1,7 +1,11 @@
package de.diddiz.LogBlock;
public enum ToolMode {
CLEARLOG("logblock.clearlog"), LOOKUP("logblock.lookup"), REDO("logblock.rollback"), ROLLBACK("logblock.rollback"), WRITELOGFILE("logblock.rollback");
CLEARLOG("logblock.clearlog"),
LOOKUP("logblock.lookup"),
REDO("logblock.rollback"),
ROLLBACK("logblock.rollback"),
WRITELOGFILE("logblock.rollback");
private final String permission;
private ToolMode(String permission) {

View File

@@ -944,6 +944,7 @@ class Updater {
public static class MaterialUpdater1_13 {
BlockData[][] blockDataMapping;
Material[][] itemMapping = new Material[10][];
public MaterialUpdater1_13(LogBlock plugin) throws IOException {
blockDataMapping = new BlockData[256][16];
try (JarFile file = new JarFile(plugin.getFile())) {

View File

@@ -91,7 +91,6 @@ public class WorldEditor implements Runnable {
return blacklistCollisions;
}
public void setSender(CommandSender sender) {
this.sender = sender;
}
@@ -202,7 +201,9 @@ public class WorldEditor implements Runnable {
}
public static enum PerformResult {
SUCCESS, BLACKLISTED, NO_ACTION
SUCCESS,
BLACKLISTED,
NO_ACTION
}
public interface Edit {
@@ -440,6 +441,7 @@ public class WorldEditor implements Runnable {
public static class EditComparator implements Comparator<Edit> {
private final int mult;
public EditComparator(QueryParams.Order order) {
mult = order == Order.DESC ? 1 : -1;
}

View File

@@ -58,7 +58,9 @@ public class Config {
public static boolean mb4 = false;
public static enum LogKillsLevel {
PLAYERS, MONSTERS, ANIMALS;
PLAYERS,
MONSTERS,
ANIMALS;
}
public static void load(LogBlock logblock) throws DataFormatException, IOException {

View File

@@ -65,4 +65,3 @@ public class CreatureInteractLogging extends LoggingListener {
}
}
}

View File

@@ -16,7 +16,6 @@ import org.bukkit.event.entity.EntityDeathEvent;
import static de.diddiz.LogBlock.config.Config.*;
public class KillLogging extends LoggingListener {
public KillLogging(LogBlock lb) {

View File

@@ -16,12 +16,6 @@ public class SnowFormLogging extends LoggingListener {
super(lb);
}
// @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
// public void onLeavesDecay(LeavesDecayEvent event) {
// if (isLogging(event.getBlock().getWorld(), Logging.SNOWFORM))
// consumer.queueBlockBreak("LeavesDecay", event.getBlock().getState());
// }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockForm(BlockFormEvent event) {
if (isLogging(event.getBlock().getWorld(), Logging.SNOWFORM)) {

View File

@@ -61,17 +61,14 @@ import java.util.Stack;
* @author <a href="mailto:kenney@apache.org">Kenney Westerhof</a>
* @author <a href="mailto:hboutemy@apache.org">Hervé Boutemy</a>
*/
public class ComparableVersion
implements Comparable<ComparableVersion>
{
public class ComparableVersion implements Comparable<ComparableVersion> {
private String value;
private String canonical;
private ListItem items;
private interface Item
{
private interface Item {
int INTEGER_ITEM = 0;
int STRING_ITEM = 1;
int LIST_ITEM = 2;
@@ -86,44 +83,35 @@ public class ComparableVersion
/**
* Represents a numeric item in the version item list.
*/
private static class IntegerItem
implements Item
{
private static class IntegerItem implements Item {
private static final BigInteger BIG_INTEGER_ZERO = new BigInteger("0");
private final BigInteger value;
public static final IntegerItem ZERO = new IntegerItem();
private IntegerItem()
{
private IntegerItem() {
this.value = BIG_INTEGER_ZERO;
}
public IntegerItem( String str )
{
public IntegerItem(String str) {
this.value = new BigInteger(str);
}
public int getType()
{
public int getType() {
return INTEGER_ITEM;
}
public boolean isNull()
{
public boolean isNull() {
return BIG_INTEGER_ZERO.equals(value);
}
public int compareTo( Item item )
{
if ( item == null )
{
public int compareTo(Item item) {
if (item == null) {
return BIG_INTEGER_ZERO.equals(value) ? 0 : 1; // 1.0 == 1, 1.1 > 1
}
switch ( item.getType() )
{
switch (item.getType()) {
case INTEGER_ITEM:
return value.compareTo(((IntegerItem) item).value);
@@ -138,8 +126,7 @@ public class ComparableVersion
}
}
public String toString()
{
public String toString() {
return value.toString();
}
}
@@ -147,16 +134,13 @@ public class ComparableVersion
/**
* Represents a string in the version item list, usually a qualifier.
*/
private static class StringItem
implements Item
{
private static class StringItem implements Item {
private static final String[] QUALIFIERS = { "alpha", "beta", "milestone", "rc", "snapshot", "", "sp" };
private static final List<String> _QUALIFIERS = Arrays.asList(QUALIFIERS);
private static final Properties ALIASES = new Properties();
static
{
static {
ALIASES.put("ga", "");
ALIASES.put("final", "");
ALIASES.put("cr", "rc");
@@ -170,13 +154,10 @@ public class ComparableVersion
private String value;
public StringItem( String value, boolean followedByDigit )
{
if ( followedByDigit && value.length() == 1 )
{
public StringItem(String value, boolean followedByDigit) {
if (followedByDigit && value.length() == 1) {
// a1 = alpha-1, b1 = beta-1, m1 = milestone-1
switch ( value.charAt( 0 ) )
{
switch (value.charAt(0)) {
case 'a':
value = "alpha";
break;
@@ -191,13 +172,11 @@ public class ComparableVersion
this.value = ALIASES.getProperty(value, value);
}
public int getType()
{
public int getType() {
return STRING_ITEM;
}
public boolean isNull()
{
public boolean isNull() {
return (comparableQualifier(value).compareTo(RELEASE_VERSION_INDEX) == 0);
}
@@ -213,22 +192,18 @@ public class ComparableVersion
* @param qualifier
* @return an equivalent value that can be used with lexical comparison
*/
public static String comparableQualifier( String qualifier )
{
public static String comparableQualifier(String qualifier) {
int i = _QUALIFIERS.indexOf(qualifier);
return i == -1 ? (_QUALIFIERS.size() + "-" + qualifier) : String.valueOf(i);
}
public int compareTo( Item item )
{
if ( item == null )
{
public int compareTo(Item item) {
if (item == null) {
// 1-rc < 1, 1-ga > 1
return comparableQualifier(value).compareTo(RELEASE_VERSION_INDEX);
}
switch ( item.getType() )
{
switch (item.getType()) {
case INTEGER_ITEM:
return -1; // 1.any < 1.1 ?
@@ -243,8 +218,7 @@ public class ComparableVersion
}
}
public String toString()
{
public String toString() {
return value;
}
}
@@ -253,51 +227,37 @@ public class ComparableVersion
* Represents a version list item. This class is used both for the global item list and for sub-lists (which start
* with '-(number)' in the version specification).
*/
private static class ListItem
extends ArrayList<Item>
implements Item
{
private static class ListItem extends ArrayList<Item> implements Item {
private static final long serialVersionUID = 5914575811857700009L;
public int getType()
{
public int getType() {
return LIST_ITEM;
}
public boolean isNull()
{
public boolean isNull() {
return (size() == 0);
}
void normalize()
{
for ( ListIterator<Item> iterator = listIterator( size() ); iterator.hasPrevious(); )
{
void normalize() {
for (ListIterator<Item> iterator = listIterator(size()); iterator.hasPrevious();) {
Item item = iterator.previous();
if ( item.isNull() )
{
if (item.isNull()) {
iterator.remove(); // remove null trailing items: 0, "", empty list
}
else
{
} else {
break;
}
}
}
public int compareTo( Item item )
{
if ( item == null )
{
if ( size() == 0 )
{
public int compareTo(Item item) {
if (item == null) {
if (size() == 0) {
return 0; // 1-0 = 1- (normalize) = 1
}
Item first = get(0);
return first.compareTo(null);
}
switch ( item.getType() )
{
switch (item.getType()) {
case INTEGER_ITEM:
return -1; // 1-1 < 1.0.x
@@ -308,16 +268,14 @@ public class ComparableVersion
Iterator<Item> left = iterator();
Iterator<Item> right = ((ListItem) item).iterator();
while ( left.hasNext() || right.hasNext() )
{
while (left.hasNext() || right.hasNext()) {
Item l = left.hasNext() ? left.next() : null;
Item r = right.hasNext() ? right.next() : null;
// if this is shorter, then invert the compare and mul with -1
int result = l == null ? (r == null ? 0 : -1 * r.compareTo(l)) : l.compareTo(r);
if ( result != 0 )
{
if (result != 0) {
return result;
}
}
@@ -329,14 +287,11 @@ public class ComparableVersion
}
}
public String toString()
{
public String toString() {
StringBuilder buffer = new StringBuilder("(");
for ( Iterator<Item> iter = iterator(); iter.hasNext(); )
{
for (Iterator<Item> iter = iterator(); iter.hasNext();) {
buffer.append(iter.next());
if ( iter.hasNext() )
{
if (iter.hasNext()) {
buffer.append(',');
}
}
@@ -345,13 +300,11 @@ public class ComparableVersion
}
}
public ComparableVersion( String version )
{
public ComparableVersion(String version) {
parseVersion(version);
}
public final void parseVersion( String version )
{
public final void parseVersion(String version) {
this.value = version;
items = new ListItem();
@@ -367,40 +320,28 @@ public class ComparableVersion
int startIndex = 0;
for ( int i = 0; i < version.length(); i++ )
{
for (int i = 0; i < version.length(); i++) {
char c = version.charAt(i);
if ( c == '.' )
{
if ( i == startIndex )
{
if (c == '.') {
if (i == startIndex) {
list.add(IntegerItem.ZERO);
}
else
{
} else {
list.add(parseItem(isDigit, version.substring(startIndex, i)));
}
startIndex = i + 1;
}
else if ( c == '-' )
{
if ( i == startIndex )
{
} else if (c == '-') {
if (i == startIndex) {
list.add(IntegerItem.ZERO);
}
else
{
} else {
list.add(parseItem(isDigit, version.substring(startIndex, i)));
}
startIndex = i + 1;
if ( isDigit )
{
if (isDigit) {
list.normalize(); // 1.0-* = 1-*
if ( ( i + 1 < version.length() ) && Character.isDigit( version.charAt( i + 1 ) ) )
{
if ((i + 1 < version.length()) && Character.isDigit(version.charAt(i + 1))) {
// new ListItem only if previous were digits and new char is a digit,
// ie need to differentiate only 1.1 from 1-1
list.add(list = new ListItem());
@@ -408,21 +349,15 @@ public class ComparableVersion
stack.push(list);
}
}
}
else if ( Character.isDigit( c ) )
{
if ( !isDigit && i > startIndex )
{
} else if (Character.isDigit(c)) {
if (!isDigit && i > startIndex) {
list.add(new StringItem(version.substring(startIndex, i), true));
startIndex = i;
}
isDigit = true;
}
else
{
if ( isDigit && i > startIndex )
{
} else {
if (isDigit && i > startIndex) {
list.add(parseItem(true, version.substring(startIndex, i)));
startIndex = i;
}
@@ -431,13 +366,11 @@ public class ComparableVersion
}
}
if ( version.length() > startIndex )
{
if (version.length() > startIndex) {
list.add(parseItem(isDigit, version.substring(startIndex)));
}
while ( !stack.isEmpty() )
{
while (!stack.isEmpty()) {
list = (ListItem) stack.pop();
list.normalize();
}
@@ -445,39 +378,31 @@ public class ComparableVersion
canonical = items.toString();
}
private static Item parseItem( boolean isDigit, String buf )
{
private static Item parseItem(boolean isDigit, String buf) {
return isDigit ? new IntegerItem(buf) : new StringItem(buf, false);
}
public int compareTo( ComparableVersion o )
{
public int compareTo(ComparableVersion o) {
return items.compareTo(o.items);
}
public int compareTo( String version )
{
public int compareTo(String version) {
return compareTo(new ComparableVersion(version));
}
public String toString()
{
public String toString() {
return value;
}
public String toCanonicalString()
{
public String toCanonicalString() {
return canonical;
}
public boolean equals( Object o )
{
public boolean equals(Object o) {
return (o instanceof ComparableVersion) && canonical.equals(((ComparableVersion) o).canonical);
}
public int hashCode()
{
public int hashCode() {
return canonical.hashCode();
}
}

View File

@@ -1,6 +1,5 @@
package de.diddiz.LogBlock;
import de.diddiz.util.Utils;
import org.junit.Assert;
import org.junit.Test;