From bd96c018f718c9036273b77f4509863461385ee9 Mon Sep 17 00:00:00 2001 From: Hannes Janetzek Date: Sat, 8 Mar 2014 01:22:36 +0100 Subject: [PATCH] cleanup: Tag --- vtm/src/org/oscim/core/Tag.java | 36 ++++++++++++++++----------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/vtm/src/org/oscim/core/Tag.java b/vtm/src/org/oscim/core/Tag.java index c29e29d3..421a97b1 100644 --- a/vtm/src/org/oscim/core/Tag.java +++ b/vtm/src/org/oscim/core/Tag.java @@ -101,36 +101,36 @@ public class Tag { } Tag other = (Tag) obj; - if (this.key != other.key) + if (key != other.key) return false; - if (this.intern && other.intern) { - if (this.value == other.value) - return true; - } else { - if (this.value.equals(other.value)) + if (intern && other.intern) { + if (value == other.value) return true; + + } else if (!intern && value.equals(other.value)) { + return true; } return false; } @Override public int hashCode() { - if (this.hashCodeValue == 0) - this.hashCodeValue = calculateHashCode(); + if (hashCodeValue == 0) + hashCodeValue = calculateHashCode(); - return this.hashCodeValue; + return hashCodeValue; } @Override public String toString() { - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append("Tag [key="); - stringBuilder.append(this.key); - stringBuilder.append(", value="); - stringBuilder.append(this.value); - stringBuilder.append("]"); - return stringBuilder.toString(); + return new StringBuilder() + .append("Tag[") + .append(key) + .append(',') + .append(value) + .append(']') + .toString(); } /** @@ -138,8 +138,8 @@ public class Tag { */ private int calculateHashCode() { int result = 7; - result = 31 * result + ((this.key == null) ? 0 : this.key.hashCode()); - result = 31 * result + ((this.value == null) ? 0 : this.value.hashCode()); + result = 31 * result + ((key == null) ? 0 : key.hashCode()); + result = 31 * result + ((value == null) ? 0 : value.hashCode()); return result; }