forked from HAW-AI/AD-2011-WS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPermutation.java
More file actions
107 lines (95 loc) · 2.7 KB
/
Permutation.java
File metadata and controls
107 lines (95 loc) · 2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import java.util.List;
import java.util.Set;
/**
* @author Ben Rexin <benjamin.rexin@haw-hamburg.de>
* @author Patrick Detlefsen <patrick.detlefsen@haw-hamburg.de>
* @author Till Theis
* @author Raimund Wege
* @author Andreas Wimmer
* @author Sebastian Krome
* @author Daniel Liesener
* @author Fenja Harbke
* @author Felix Schmidt
* @author Berthold Wiblishauser
* @version 0.2
* @since 2011-10-12
*/
public interface Permutation extends Iterable<Integer> {
/**
* Return the image of a value.
*
* @param inverseImage the inverse image
* @return the image
* @throws IllegalArgumentException unless 1 <= inverseImage <= permutationClass()
*/
int sigma(int inverseImage) throws IllegalArgumentException;
/**
* Return the n-th cycle of the permutation.
*
* @param index the cycle index (beginning at 1)
* @return the cycle
* @throws IllegalArgumentException unless 1 <= index <= permutationClass()
*/
List<Integer> cycle(int index) throws IllegalArgumentException;
/**
* All the cycles of the image.
*
* @return the cycles
*/
Set<List<Integer>> allCycles();
/**
* All the fixed points.
*
* @return the fixed points
*/
Set<Integer> fixedPoints();
/**
* The inverse permutation.
*
* @return the inverse permutation
*/
Permutation inverse();
/**
* Compose this permutation with the other one.
*
* @param other the Permutation to compose with
* @return the composition
* @throws IllegalArgumentException if the classes of both permutations are
* not the same
* @throws NullPointerException if the argument is null
*/
Permutation compose(Permutation other) throws IllegalArgumentException, NullPointerException;
/**
* The permutation in mathematical notation.
*
* @return the mathematical notation
* @see #toCycleNotationString()
*/
public String toString();
/**
* The mathematical cycle notation ({@link http://en.wikipedia.org/wiki/Cycle_notation})
*
* @return the cycle notation
*/
String toCycleNotationString();
/**
* The permutation class (i.e. the number of its images, aka Sn-class of
* Permutation)
*
* @return the permutation class
*/
int permutationClass();
/**
* Test for structural equality.
* Two permutations are considered equal if they describe the same
* relation.
*
* @return boolean
*/
public boolean equals(Object other);
/**
* Calculates the Order of a given Permutation
* @return int
*/
int order();
}