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

de.tla2b.analysis.RecursiveFunktion Maven / Gradle / Ivy

The newest version!
package de.tla2b.analysis;

import de.tla2b.exceptions.NotImplementedException;
import tla2sany.semantic.OpApplNode;
import tla2sany.semantic.OpDefNode;
import tlc2.tool.BuiltInOPs;

public class RecursiveFunktion extends BuiltInOPs {

	private final OpDefNode def;
	private final OpApplNode rfs;
	private OpApplNode ifThenElse;

	public RecursiveFunktion(OpDefNode n, OpApplNode rfs)
		throws NotImplementedException {
		def = n;
		this.rfs = rfs;
		//evalDef();
	}


//	/**
//	 * @throws NotImplementedException
//	 * 
//	 */
//	private void evalDef() throws NotImplementedException {
//		ExprOrOpArgNode e = rfs.getArgs()[0];
//		//System.out.println(rfs.toString(5));
//		if (e instanceof OpApplNode) {
//			OpApplNode o = (OpApplNode) e;
//			switch (getOpCode(o.getOperator().getName())) {
//			case OPCODE_ite: { // IF THEN ELSE
//				ifThenElse = o;
//				return;
//			}
//			}
//			throw new NotImplementedException(
//					"Only IF/THEN/ELSE or CASE constructs are supported at the body of a recursive function.");
//		} else {
//			throw new NotImplementedException(
//					"Only IF/THEN/ELSE or CASE constructs are supported at the body of a recursive function.");
//		}
//	}

	public OpDefNode getOpDefNode() {
		return def;
	}

	public OpApplNode getRF() {
		return rfs;
	}

	public OpApplNode getIfThenElse() {
		return ifThenElse;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy