comparison JavaSDK/be/uclouvain/orthanc/IdentifierConstraint.java @ 0:3ecef5782f2c

initial commit
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 18 Oct 2023 17:59:44 +0200
parents
children 26c08ff926a3
comparison
equal deleted inserted replaced
-1:000000000000 0:3ecef5782f2c
1 package be.uclouvain.orthanc;
2
3 /**
4 * SPDX-FileCopyrightText: 2023 Sebastien Jodogne, UCLouvain, Belgium
5 * SPDX-License-Identifier: GPL-3.0-or-later
6 */
7
8 /**
9 * Java plugin for Orthanc
10 * Copyright (C) 2023 Sebastien Jodogne, UCLouvain, Belgium
11 *
12 * This program is free software: you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License as
14 * published by the Free Software Foundation, either version 3 of the
15 * License, or (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program. If not, see http://www.gnu.org/licenses/.
24 **/
25
26
27 /**
28 * The constraints on the DICOM identifiers that must be supported by the database
29 * plugins.
30 **/
31 public enum IdentifierConstraint {
32 /**
33 * Equal
34 **/
35 EQUAL(1),
36 /**
37 * Less or equal
38 **/
39 SMALLER_OR_EQUAL(2),
40 /**
41 * More or equal
42 **/
43 GREATER_OR_EQUAL(3),
44 /**
45 * Case-sensitive wildcard matching (with * and ?)
46 **/
47 WILDCARD(4);
48
49 private int value;
50
51 private IdentifierConstraint(int value) {
52 this.value = value;
53 }
54
55 /**
56 * Return the enumeration value that corresponds to an integer value of interest.
57 * @param value The integer value.
58 * @return The enumeration value.
59 **/
60 protected static IdentifierConstraint getInstance(int value) {
61 if (value == 1) {
62 return EQUAL;
63 }
64 if (value == 2) {
65 return SMALLER_OR_EQUAL;
66 }
67 if (value == 3) {
68 return GREATER_OR_EQUAL;
69 }
70 if (value == 4) {
71 return WILDCARD;
72 }
73
74 throw new IllegalArgumentException("Value out of range for enumeration IdentifierConstraint: " + value);
75 }
76
77 /**
78 * Get the integer value corresponding to this enumeration value.
79 * @return The integer value.
80 **/
81 public int getValue() {
82 return value;
83 }
84 }