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

org.jnario.spec.jvmmodel.SpecExecutableProvider Maven / Gradle / Ivy

The newest version!
package org.jnario.spec.jvmmodel;

import static com.google.common.collect.Iterables.filter;
import static com.google.common.collect.Lists.newArrayList;

import java.util.List;

import org.jnario.Executable;
import org.jnario.jvmmodel.ExecutableProvider;

public class SpecExecutableProvider implements ExecutableProvider {

	public List getExecutables(Executable executable) {
		List result = newArrayList();
		addExecutables(result, executable);
		return result;
	}

	private void addExecutables(List result, Executable executable) {
		Iterable children = getChildren(executable);
		for (Executable child : children) {
			result.add(child);
			addExecutables(result, child);
		}
	}

	private Iterable getChildren(Executable specification) {
		return filter(specification.eContents(), Executable.class);
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy