aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/opposite/OppositeUtils.java
blob: 2a9e6b5d8cf7b5e894092b72be4a8d152cf7648b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
 * SPDX-FileCopyrightText: 2023 The Refinery Authors <https://refinery.tools/>
 *
 * SPDX-License-Identifier: EPL-2.0
 */
package tools.refinery.store.reasoning.translator.opposite;

import tools.refinery.store.tuple.Tuple;
import tools.refinery.store.tuple.Tuple2;

final class OppositeUtils {
	private OppositeUtils() {
		throw new IllegalStateException("This is a static utility class and should not be instantiated directly");
	}

	public static Tuple flip(Tuple tuple) {
		if (!(tuple instanceof Tuple2 tuple2)) {
			throw new IllegalArgumentException("Cannot flip tuple: " + tuple);
		}
		return Tuple.of(tuple2.value1(), tuple2.value0());
	}
}