]> git.mxchange.org Git - jcontacts-business-core.git/blob - src/org/mxchange/jcontactsbusiness/model/jobposition/JobPositions.java
Continued:
[jcontacts-business-core.git] / src / org / mxchange / jcontactsbusiness / model / jobposition / JobPositions.java
1 /*
2  * Copyright (C) 2018 Free Software Foundation
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 package org.mxchange.jcontactsbusiness.model.jobposition;
18
19 import java.io.Serializable;
20 import java.util.Objects;
21
22 /**
23  * Utilities class for job positions
24  * <p>
25  * @author Roland Häder<roland@mxchange.org>
26  */
27 public class JobPositions implements Serializable {
28
29         /**
30          * Serial number
31          */
32         private static final long serialVersionUID = 157_986_766_142_309L;
33
34         /**
35          * Compares both job position instances. This method returns -1 if second
36          * instance is null.
37          * <p>
38          * @param jobPosition1 Job position instance 1
39          * @param jobPosition2 Job position instance 2
40          * <p>
41          * @return Comparison value
42          * <p>
43          * @throws NullPointerException If first instance is null
44          */
45         public static int compare (final JobPosition jobPosition1, final JobPosition jobPosition2) {
46                 // Check euqality, then at least first must be given
47                 if (Objects.equals(jobPosition1, jobPosition2)) {
48                         // Both are same
49                         return 0;
50                 } else if (null == jobPosition1) {
51                         // First cannot be null
52                         throw new NullPointerException("jobPosition1 is null"); //NOI18N
53                 } else if (null == jobPosition2) {
54                         // Second is null
55                         return 1;
56                 }
57
58                 // Invoke compareTo() method
59                 return jobPosition1.compareTo(jobPosition2);
60         }
61
62         /**
63          * Private constructor
64          */
65         private JobPositions () {
66                 // No instance should be creatable
67         }
68
69 }