From: Roland Häder Date: Fri, 26 Aug 2016 09:24:46 +0000 (+0200) Subject: Continued a bit: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=beecc0e70232e66bf81c6b16c4bb70f722047866;p=juser-activity-core.git Continued a bit: - added comparator for comparing timestamps - fixed copyright/author --- diff --git a/src/org/mxchange/jusercore/model/user/activity/LogableUserActivity.java b/src/org/mxchange/jusercore/model/user/activity/LogableUserActivity.java index 252676c..ffd04fe 100644 --- a/src/org/mxchange/jusercore/model/user/activity/LogableUserActivity.java +++ b/src/org/mxchange/jusercore/model/user/activity/LogableUserActivity.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 Cho-Time GmbH + * Copyright (C) 2016 Roland Haeder * * 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 @@ -24,7 +24,7 @@ import org.mxchange.jusercore.model.user.User; /** * POJI for logable user activity *

- * @author Roland Haeder + * @author Roland Haeder */ public interface LogableUserActivity extends Serializable { diff --git a/src/org/mxchange/jusercore/model/user/activity/UserActivityLog.java b/src/org/mxchange/jusercore/model/user/activity/UserActivityLog.java index a1178e9..a0a0e3f 100644 --- a/src/org/mxchange/jusercore/model/user/activity/UserActivityLog.java +++ b/src/org/mxchange/jusercore/model/user/activity/UserActivityLog.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 Cho-Time GmbH + * Copyright (C) 2016 Roland Haeder * * 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 @@ -44,7 +44,7 @@ import org.mxchange.jusercore.model.user.User; /** * A POJO for user acitivity log *

- * @author Roland Haeder + * @author Roland Haeder */ @Entity (name = "user_activity_log") @Table ( diff --git a/src/org/mxchange/jusercore/model/user/activity/comparator/UserActivityLogTimestampComparator.java b/src/org/mxchange/jusercore/model/user/activity/comparator/UserActivityLogTimestampComparator.java new file mode 100644 index 0000000..30424f1 --- /dev/null +++ b/src/org/mxchange/jusercore/model/user/activity/comparator/UserActivityLogTimestampComparator.java @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2016 Roland Haeder + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.jusercore.model.user.activity.comparator; + +import java.util.Comparator; +import org.mxchange.jusercore.model.user.activity.LogableUserActivity; + +/** + * A comparator for comparing timestamps in user activity log + *

+ * @author Roland Haeder + */ +public class UserActivityLogTimestampComparator implements Comparator { + + @Override + public int compare (final LogableUserActivity userActivity1, final LogableUserActivity userActivity2) { + return (userActivity1.getActivityTimestamp().getTime().getTime() < userActivity2.getActivityTimestamp().getTime().getTime() ? -1 : userActivity1.getActivityTimestamp().getTime().getTime() == userActivity2.getActivityTimestamp().getTime().getTime() ? 0 : 1); + } + +}