<commit_before>/*******************************************************************************
 * Copyright (c) 2018 Pivotal, Inc.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Pivotal, Inc. - initial API and implementation
 *******************************************************************************/
package org.springframework.ide.vscode.boot.java.handlers;

import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

import org.springframework.ide.vscode.commons.boot.app.cli.SpringBootApp;
import org.springframework.ide.vscode.commons.java.IClasspath;
import org.springframework.ide.vscode.commons.java.IJavaProject;
import org.springframework.ide.vscode.commons.languageserver.jdt.ls.Classpath;
import org.springframework.ide.vscode.commons.languageserver.jdt.ls.Classpath.CPE;
import org.springframework.ide.vscode.commons.util.CollectorUtil;

/**
 * @author <NAME>
 */
public class RunningAppMatcher  {

	public static Collection<SpringBootApp> getAllMatchingApps(Collection<SpringBootApp> apps, IJavaProject project) throws Exception {
		if (project != null) {
			Collection<SpringBootApp> matchedProjects = apps.stream().filter((app) -> {
				return RunningAppMatcher.doesProjectMatch(app, project);
			}).collect(CollectorUtil.toImmutableList());

			return matchedProjects;
		}
		return apps;
	}

	private static boolean doesProjectMatch(SpringBootApp app, IJavaProject project) {
		if (hasProjectName(app, project)) {
			return doesProjectNameMatch(app, project);
		}
		else {
			return doesProjectThinJarWrapperMatch(app, project) || doesClasspathMatch(app, project);
		}
	}

	public static boolean hasProjectName(SpringBootApp app, IJavaProject project) {
		try {<commit_msg>do not take thin jar launcher mapping and classpath matching into account when identifying projects<commit_after>/*******************************************************************************
 * Copyright (c) 2018 Pivotal, Inc.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Pivotal, Inc. - initial API and implementation
 *******************************************************************************/
package org.springframework.ide.vscode.boot.java.handlers;

import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

import org.springframework.ide.vscode.commons.boot.app.cli.SpringBootApp;
import org.springframework.ide.vscode.commons.java.IClasspath;
import org.springframework.ide.vscode.commons.java.IJavaProject;
import org.springframework.ide.vscode.commons.languageserver.jdt.ls.Classpath;
import org.springframework.ide.vscode.commons.languageserver.jdt.ls.Classpath.CPE;
import org.springframework.ide.vscode.commons.util.CollectorUtil;

/**
 * @author <NAME>
 */
public class RunningAppMatcher  {

	public static Collection<SpringBootApp> getAllMatchingApps(Collection<SpringBootApp> apps, IJavaProject project) throws Exception {
		if (project != null) {
			Collection<SpringBootApp> matchedProjects = apps.stream().filter((app) -> {
				return RunningAppMatcher.doesProjectMatch(app, project);
			}).collect(CollectorUtil.toImmutableList());

			return matchedProjects;
		}
		return apps;
	}

	private static boolean doesProjectMatch(SpringBootApp app, IJavaProject project) {
		if (hasProjectName(app, project)) {
			return doesProjectNameMatch(app, project);
		}
		return true;
	}

	public static boolean hasProjectName(SpringBootApp app, IJavaProject project) {
		try {
{'fraction_non_alphanumeric': 0.17258883248730963, 'fraction_numerical': 0.0040609137055837565, 'mean_word_length': 5.69100169779287, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3409652', 'n_tokens_mistral': 1148, 'n_tokens_neox': 1068, 'n_words': 250}