All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.regnosys.rosetta.translate.synonymmap.SynonymTest Maven / Gradle / Ivy

There is a newer version: 11.31.0
Show newest version
package com.regnosys.rosetta.translate.synonymmap;

import java.util.List;

import com.regnosys.rosetta.rosetta.RosettaMapPathValue;
import com.regnosys.rosetta.rosetta.RosettaMapTestEqualityOperation;
import com.regnosys.rosetta.rosetta.RosettaMapTestExpression;
import com.regnosys.rosetta.rosetta.expression.RosettaStringLiteral;

public interface SynonymTest {
	
	public static final String PATH_SEPARATOR = "->";

    public enum TestPriority {
        First, Middle, Last
    }
	
	/**
	 * Capture paths
	 */
	List getPaths();

    /**
     * When generating the code for this test,
     * we can specify the priority so that they are evaluated in the correct order.
     */
    default TestPriority priority() {
        return TestPriority.First;
    }
	
	static String toString(RosettaMapTestExpression condition2) {
		
		if (condition2 instanceof RosettaStringLiteral) {
			return ((RosettaStringLiteral)condition2).getValue();
		}
		if (condition2 instanceof RosettaMapTestEqualityOperation) {
			RosettaMapTestEqualityOperation binop= (RosettaMapTestEqualityOperation)condition2;
			return toString(binop.getLeft())+binop.getOperator()+toString(binop.getRight());
		}
		if (condition2 instanceof RosettaMapPathValue) {
			return ((RosettaMapPathValue)condition2).getPath();
		}
		return condition2.toString();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy