1 /*
2  * This file is part of ELKI:
3  * Environment for Developing KDD-Applications Supported by Index-Structures
4  *
5  * Copyright (C) 2018
6  * ELKI Development Team
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU Affero General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU Affero General Public License for more details.
17  *
18  * You should have received a copy of the GNU Affero General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 package de.lmu.ifi.dbs.elki.utilities.optionhandling.constraints;
22 
23 /**
24  * Class storing a number of very common constraints.
25  *
26  * @author Erich Schubert
27  * @since 0.6.0
28  *
29  * @opt nodefillcolor LemonChiffon
30  * @composed - - - ParameterConstraint
31  */
32 public final class CommonConstraints {
33   /**
34    * Integer constraint: &gt;= -1
35    */
36   public static final AbstractNumberConstraint GREATER_EQUAL_MINUSONE_INT = new GreaterEqualConstraint(-1);
37 
38   /**
39    * Not negative.
40    */
41   public static final AbstractNumberConstraint GREATER_EQUAL_ZERO_INT = new GreaterEqualConstraint(0);
42 
43   /**
44    * Larger than zero.
45    */
46   public static final AbstractNumberConstraint GREATER_EQUAL_ONE_INT = new GreaterEqualConstraint(1);
47 
48   /**
49    * Larger than one.
50    */
51   public static final AbstractNumberConstraint GREATER_THAN_ONE_INT = new GreaterConstraint(1);
52 
53   /**
54    * Not negative.
55    */
56   public static final AbstractNumberConstraint GREATER_EQUAL_ZERO_DOUBLE = new GreaterEqualConstraint(0.);
57 
58   /**
59    * Larger than zero.
60    */
61   public static final AbstractNumberConstraint GREATER_THAN_ZERO_DOUBLE = new GreaterConstraint(0.);
62 
63   /**
64    * Constraint: less than .5
65    */
66   public static final AbstractNumberConstraint LESS_THAN_HALF_DOUBLE = new LessConstraint(.5);
67 
68   /**
69    * At least 1.
70    */
71   public static final AbstractNumberConstraint GREATER_EQUAL_ONE_DOUBLE = new GreaterEqualConstraint(1.);
72 
73   /**
74    * Larger than one.
75    */
76   public static final AbstractNumberConstraint GREATER_THAN_ONE_DOUBLE = new GreaterConstraint(1.);
77 
78   /**
79    * Less than one.
80    */
81   public static final AbstractNumberConstraint LESS_THAN_ONE_DOUBLE = new LessConstraint(1.);
82 
83   /**
84    * Less or equal than one.
85    */
86   public static final AbstractNumberConstraint LESS_EQUAL_ONE_DOUBLE = new LessEqualConstraint(1.);
87 
88   /**
89    * Constraint for the whole list.
90    */
91   public static final ParameterConstraint<int[]> GREATER_EQUAL_ZERO_INT_LIST = new ListEachNumberConstraint<int[]>(GREATER_EQUAL_ZERO_INT);
92 
93   /**
94    * List constraint: &gt;= 1
95    */
96   public static final ParameterConstraint<int[]> GREATER_EQUAL_ONE_INT_LIST = new ListEachNumberConstraint<int[]>(GREATER_EQUAL_ONE_INT);
97 
98   /**
99    * List constraint: &gt; 1
100    */
101   public static final ParameterConstraint<int[]> GREATER_THAN_ONE_INT_LIST = new ListEachNumberConstraint<int[]>(GREATER_THAN_ONE_INT);
102 
103   /**
104    * Constraint for the whole list.
105    */
106   public static final ParameterConstraint<double[]> GREATER_EQUAL_ZERO_DOUBLE_LIST = new ListEachNumberConstraint<double[]>(GREATER_EQUAL_ZERO_DOUBLE);
107 
108   /**
109    * List constraint: &gt;= 1
110    */
111   public static final ParameterConstraint<double[]> GREATER_EQUAL_ONE_DOUBLE_LIST = new ListEachNumberConstraint<double[]>(GREATER_EQUAL_ONE_DOUBLE);
112 
113   /**
114    * List constraint: &gt; 1
115    */
116   public static final ParameterConstraint<double[]> GREATER_THAN_ONE_DOUBLE_LIST = new ListEachNumberConstraint<double[]>(GREATER_THAN_ONE_DOUBLE);
117 }
118