<commit_before>/**
 * 
 */
package de.urszeidler.eclipse.solidity.util;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.NamedElement;
import org.eclipse.uml2.uml.Stereotype;

import de.urszeidler.eclipse.solidity.ui.preferences.PreferenceConstants;

/**
 * Simple generation helper.
 * 
 * @author urs
 *
 */
public class Uml2Service {

	private static IPreferenceStore store = null;

	/**
	 * Returns true when the stereotype is applied to the {@link Element}.
	 * 
	 * @param clazz
	 * @param stereotypeName
	 * @return
	 */
	public static boolean hasStereotype(Element clazz, String stereotypeName) {
		List<Stereotype> stereotypes = clazz.getAppliedStereotypes();
		for (Stereotype stereotype : stereotypes) {
			if (stereotype.getName().equals(stereotypeName)) {
				return true;
			}
		}
		return false;
	}

	/**
	 * Returns the stereotype.
	 * 
	 * @param clazz
	 * @param stereotypeName
	 * @return
	 */
	public static Stereotype getStereotype(Element clazz, String stereotypeName) {
		List<Stereotype> stereotypes = clazz.getAppliedStereotypes();
		for (Stereotype stereotype : stereotypes) {<commit_msg>some null checking<commit_after>/**
 * 
 */
package de.urszeidler.eclipse.solidity.util;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.NamedElement;
import org.eclipse.uml2.uml.Stereotype;

import de.urszeidler.eclipse.solidity.ui.preferences.PreferenceConstants;

/**
 * Simple generation helper.
 * 
 * @author urs
 *
 */
public class Uml2Service {

	private static IPreferenceStore store = null;

	/**
	 * Returns true when the stereotype is applied to the {@link Element}.
	 * 
	 * @param clazz
	 * @param stereotypeName
	 * @return
	 */
	public static boolean hasStereotype(Element clazz, String stereotypeName) {
		if(clazz==null) return false;
		List<Stereotype> stereotypes = clazz.getAppliedStereotypes();
		for (Stereotype stereotype : stereotypes) {
			if (stereotype.getName().equals(stereotypeName)) {
				return true;
			}
		}
		return false;
	}

	/**
	 * Returns the stereotype.
	 * 
	 * @param clazz
	 * @param stereotypeName
	 * @return
	 */
	public static Stereotype getStereotype(Element clazz, String stereotypeName) {
		if(clazz==null) return null;
		List<Stereotype> stereotypes = clazz.getAppliedStereotypes();
		for (Stereotype stereotype : stereotypes) {
{'fraction_non_alphanumeric': 0.11273885350318472, 'fraction_numerical': 0.0025477707006369425, 'mean_word_length': 4.4626086956521736, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '381057', 'n_tokens_mistral': 1095, 'n_tokens_neox': 1002, 'n_words': 212}