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

features.FeatureHelpers.kt Maven / Gradle / Ivy

There is a newer version: 2024.9.0
Show newest version
@file:Suppress("unused")
@file:JvmName("FeatureHelpers")

package edu.illinois.cs.cs125.questioner.lib.features

import edu.illinois.cs.cs125.jeed.core.FeatureName
import edu.illinois.cs.cs125.jeed.core.Features

fun Features.usesLoop() = featureMap[FeatureName.WHILE_LOOPS] > 0
    || featureMap[FeatureName.FOR_LOOPS] > 0
    || featureMap[FeatureName.DO_WHILE_LOOPS] > 0
    || dottedMethodList.contains("forEach")

fun Features.hasFeature(feature: FeatureName) = featureMap[feature] > 0
fun Features.doesNotHaveFeature(feature: FeatureName) = featureMap[feature] == 0

fun Features.hasFeatures(features: List) = features.any { feature -> featureMap[feature] > 0 }
fun Features.doesNotHaveFeatures(features: List) = features.any { feature -> featureMap[feature] == 0 }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy