aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/store/src/main/java/tools/refinery/store/statecoding/stateequivalence/NodePairing.java
blob: 7e5db7a334f731d46d0d8ce353a0f2b31b5c50b4 (plain) (blame)
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
/*
 * SPDX-FileCopyrightText: 2023 The Refinery Authors <https://refinery.tools/>
 *
 * SPDX-License-Identifier: EPL-2.0
 */
package tools.refinery.store.statecoding.stateequivalence;

import org.eclipse.collections.api.map.primitive.IntIntMap;
import org.eclipse.collections.impl.set.mutable.primitive.IntHashSet;

import java.util.List;

public interface NodePairing {

	int size();
	List<IntIntMap> permutations();

	boolean isComplete();

	static NodePairing constructNodePairing(IntHashSet left, IntHashSet right){
		if(left.size() !=  right.size()) {
			return null;
		}

		if(left.size() == 1) {
			int leftValue = left.intIterator().next();
			int rightValue = right.intIterator().next();
			return new TrivialNodePairing(leftValue, rightValue);
		} else {
			return new CombinationNodePairing(left,right);
		}
	}
}