<commit_before>/*
 * generated by Xtext
 */
package de.nordakademie.xconfigurator.generator

import de.nordakademie.xconfigurator.xconfigurator.AbstractCondition
import de.nordakademie.xconfigurator.xconfigurator.AbstractIfCondition
import de.nordakademie.xconfigurator.xconfigurator.Boolean
import de.nordakademie.xconfigurator.xconfigurator.Condition
import de.nordakademie.xconfigurator.xconfigurator.ElseIf
import de.nordakademie.xconfigurator.xconfigurator.IfStatement
import org.eclipse.emf.common.util.EList

/**
 * Parses a AbstractCondition into a boolean value
 * 
 */
class ParseCondition {
			
 	//TODO: Better way than instanceof?
 	def boolean parse(AbstractCondition visible) {
		if (visible instanceof Boolean) {
			return parse(visible as Boolean)
		} else if (visible instanceof AbstractIfCondition) {
			return parse(visible as AbstractIfCondition)
		} else {
			return false
		}
	}
	
	def boolean parse(AbstractIfCondition visible) {		
		if(parse(visible.^if.stmt)) {
			return parse(visible.^if.stmt.^return)
		} else if (visible.getElseif.size > 0) {
			var ElseIf clause = parse(visible.elseif)
			if (clause != null) {
				return parse(clause.stmt.^return)
			}
		} else {
			return parse(visible.^else.^return)
		}
	}	
	
	def boolean parse(IfStatement visible) {
		var boolean result = parse(visible.conditions.get(0))
		if (visible.type.size > 0) {
			for (var int i = 1; i-1 < visible.type.size; i++) {
				var String type = visible.type.get(i-1)
				if (type.equals("And")) {
					result = (result && parse(visible.conditions.get(i)))
				} else if (type.equals("Or")) {<commit_msg>rpl: info / not used info<commit_after>/*
 * generated by Xtext
 */
package de.nordakademie.xconfigurator.generator

import de.nordakademie.xconfigurator.xconfigurator.AbstractCondition
import de.nordakademie.xconfigurator.xconfigurator.AbstractIfCondition
import de.nordakademie.xconfigurator.xconfigurator.Boolean
import de.nordakademie.xconfigurator.xconfigurator.Condition
import de.nordakademie.xconfigurator.xconfigurator.ElseIf
import de.nordakademie.xconfigurator.xconfigurator.IfStatement
import org.eclipse.emf.common.util.EList

/**
 * Parses an AbstractCondition into a boolean value
 * Dient hier nur als Vorlage für die JavaScript-Abstraktion,d a die Prüfung zur Laufzeit erfolgen muss
 * @author: <NAME>
 * 
 */
class ParseCondition {
			
 	def boolean parse(AbstractCondition visible) {
		if (visible instanceof Boolean) {
			return parse(visible as Boolean)
		} else if (visible instanceof AbstractIfCondition) {
			return parse(visible as AbstractIfCondition)
		} else {
			return false
		}
	}
	
	def boolean parse(AbstractIfCondition visible) {		
		if(parse(visible.^if.stmt)) {
			return parse(visible.^if.stmt.^return)
		} else if (visible.getElseif.size > 0) {
			var ElseIf clause = parse(visible.elseif)
			if (clause != null) {
				return parse(clause.stmt.^return)
			}
		} else {
			return parse(visible.^else.^return)
		}
	}	
	
	def boolean parse(IfStatement visible) {
		var boolean result = parse(visible.conditions.get(0))
		if (visible.type.size > 0) {
			for (var int i = 1; i-1 < visible.type.size; i++) {
				var String type = visible.type.get(i-1)
				if (type.equals("And")) {
					result = (result && parse(visible.conditions.get(i)))
				} else if (type.equals("Or")) {
{'fraction_non_alphanumeric': 0.11151295961422544, 'fraction_numerical': 0.003616636528028933, 'mean_word_length': 4.169781931464175, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1094510', 'n_tokens_mistral': 1212, 'n_tokens_neox': 1091, 'n_words': 240}