diff options
author | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2011-06-30 08:29:32 +0000 |
---|---|---|
committer | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2011-06-30 08:29:32 +0000 |
commit | e314c85e748c3633c9f620fc3552fe64bbd59259 (patch) | |
tree | 2d9c8c83d298ddf66de716a6e9c4d8fecd9ba63f /src/net/java/sip/communicator/service | |
parent | ee06f7d446b82fa55c61f0efc6934edc962d191e (diff) | |
download | jitsi-e314c85e748c3633c9f620fc3552fe64bbd59259.zip jitsi-e314c85e748c3633c9f620fc3552fe64bbd59259.tar.gz jitsi-e314c85e748c3633c9f620fc3552fe64bbd59259.tar.bz2 |
Adds a missing return and removes a few instance fields in the contact list UI, spares a few allocations in the history.
Diffstat (limited to 'src/net/java/sip/communicator/service')
-rw-r--r-- | src/net/java/sip/communicator/service/history/records/HistoryRecord.java | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/net/java/sip/communicator/service/history/records/HistoryRecord.java b/src/net/java/sip/communicator/service/history/records/HistoryRecord.java index c645fcf..8036cdd 100644 --- a/src/net/java/sip/communicator/service/history/records/HistoryRecord.java +++ b/src/net/java/sip/communicator/service/history/records/HistoryRecord.java @@ -6,17 +6,14 @@ */ package net.java.sip.communicator.service.history.records; -import java.util.*; - /** * @author Alexander Pelov */ public class HistoryRecord { - - private Date timestamp; - private String[] propertyNames; - private String[] propertyValues; + private final long timestamp; + private final String[] propertyNames; + private final String[] propertyValues; /** * Constructs an entry containing multiple name-value pairs, where the names @@ -29,7 +26,10 @@ public class HistoryRecord public HistoryRecord(HistoryRecordStructure entryStructure, String[] propertyValues) { - this(entryStructure.getPropertyNames(), propertyValues, new Date()); + this( + entryStructure.getPropertyNames(), + propertyValues, + System.currentTimeMillis()); } /** @@ -41,7 +41,7 @@ public class HistoryRecord */ public HistoryRecord(String[] propertyNames, String[] propertyValues) { - this(propertyNames, propertyValues, new Date()); + this(propertyNames, propertyValues, System.currentTimeMillis()); } /** @@ -53,7 +53,8 @@ public class HistoryRecord * @param timestamp */ public HistoryRecord(HistoryRecordStructure entryStructure, - String[] propertyValues, Date timestamp) + String[] propertyValues, + long timestamp) { this(entryStructure.getPropertyNames(), propertyValues, timestamp); } @@ -66,8 +67,9 @@ public class HistoryRecord * @param propertyValues * @param timestamp */ - public HistoryRecord(String[] propertyNames, String[] propertyValues, - Date timestamp) + public HistoryRecord(String[] propertyNames, + String[] propertyValues, + long timestamp) { // TODO: Validate: Assert.assertNonNull(propertyNames, "The property names should be non-null."); // TODO: Validate: Assert.assertNonNull(propertyValues, "The property values should be non-null."); @@ -91,16 +93,11 @@ public class HistoryRecord return this.propertyValues; } - public Date getTimestamp() + public long getTimestamp() { return this.timestamp; } - public long getTimeInMillis() - { - return (timestamp == null) ? 0 : timestamp.getTime(); - } - /** * Returns the String representation of this HistoryRecord. * @@ -108,12 +105,15 @@ public class HistoryRecord */ public String toString() { - String s = "History Record: "; + StringBuilder s = new StringBuilder("History Record: "); + for (int i = 0; i < propertyNames.length; i++) { - s += propertyNames[i] + "=" + propertyValues[i] + "\n"; + s.append(propertyNames[i]); + s.append('='); + s.append(propertyValues[i]); + s.append('\n'); } - - return s; + return s.toString(); } } |