1 /*
2  * LexicographicalOrder.java
3  * This file is part of JaCoP.
4  * <p>
5  * JaCoP is a Java Constraint Programming solver.
6  * <p>
7  * Copyright (C) 2000-2008 Krzysztof Kuchcinski and Radoslaw Szymanek
8  * <p>
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU Affero General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  * <p>
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU Affero General Public License for more details.
18  * <p>
19  * Notwithstanding any other provision of this License, the copyright
20  * owners of this work supplement the terms of this License with terms
21  * prohibiting misrepresentation of the origin of this work and requiring
22  * that modified versions of this work be marked in reasonable ways as
23  * different from the original version. This supplement of the license
24  * terms is in accordance with Section 7 of GNU Affero General Public
25  * License version 3.
26  * <p>
27  * You should have received a copy of the GNU Affero General Public License
28  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
29  */
30 package org.jacop.constraints.geost;
31 
32 /**
33  * @author Marc-Olivier Fleury and Radoslaw Szymanek
34  * @version 4.8
35  *          <p>
36  *          It defines the necessary functionalities needed to define a lexicographical ordering
37  *          of k-dimensional points.
38  */
39 public interface LexicographicalOrder {
40 
41     /**
42      * It compares two k-dimensional points.
43      *
44      * @param p1 point 1
45      * @param p2 point 2
46      * @return comparison result: a negative value if p1 is smaller than p2,
47      * 0 if p1 is equal to p2, and a positive value if p1 is larger than p2.
48      */
compare(int[] p1, int[] p2)49     int compare(int[] p1, int[] p2);
50 
51     /**
52      * It provides the precedence level of the given dimension. 0 is the most significant.
53      *
54      * @param dimension the given dimension
55      * @return integer value of the precedence level.
56      */
precedenceOf(int dimension)57     int precedenceOf(int dimension);
58 
59     /**
60      * It provides the dimension corresponding to the given precedence level
61      *
62      * @param precedenceLevel the given precedence level
63      * @return an integer value of the dimension.
64      */
dimensionAt(int precedenceLevel)65     int dimensionAt(int precedenceLevel);
66 
67     /**
68      * It shifts the lexicographical order so that the most significant dimension
69      * is set to d.
70      *
71      * @param d the dimension to be considered most significant
72      */
setMostSignificantDimension(int d)73     void setMostSignificantDimension(int d);
74 
75     /**
76      * This is equivalent to the call precedenceOf(0).
77      *
78      * @return the most significant dimension
79      */
getMostSignificantDimension()80     int getMostSignificantDimension();
81 
82 
83     /**
84      * It returns the ordering of dimensions used when no shift is applied
85      * (i.e. when the most significant dimension is not changed)
86      *
87      * @return the ordering of dimensions without a shift.
88      */
masterOrdering()89     int[] masterOrdering();
90 
91 }
92