<commit_before>package de.fosd.jdime.matcher.ordered.mceSubtree.test;

import java.util.Set;

import de.fosd.jdime.common.Tuple;
import de.fosd.jdime.matcher.NewMatching;
import de.fosd.jdime.matcher.ordered.mceSubtree.BalancedSequence;

/**
 * Contains methods for constructing <code>TestArtifact</code> trees
 */
public class TestTrees {

	/**
	 * Returns the trees used as examples in the paper.
	 *
	 * @return the trees
	 */
	private static TestArtifact paperTree() {
		TestArtifact t = new TestArtifact();
		TestArtifact t1 = new TestArtifact();
		TestArtifact t2 = new TestArtifact();
		TestArtifact t3 = new TestArtifact();
		TestArtifact t4 = new TestArtifact();
		TestArtifact t5 = new TestArtifact();
		TestArtifact t6 = new TestArtifact();
		TestArtifact t7 = new TestArtifact();
		TestArtifact t8 = new TestArtifact();
		TestArtifact t9 = new TestArtifact();
		TestArtifact t10 = new TestArtifact();
		TestArtifact t11 = new TestArtifact();
		TestArtifact t12 = new TestArtifact();
		TestArtifact t13 = new TestArtifact();
		TestArtifact t14 = new TestArtifact();
		TestArtifact t15 = new TestArtifact();
		TestArtifact t16 = new TestArtifact();
		TestArtifact t17 = new TestArtifact();
		TestArtifact t18 = new TestArtifact();

		t.addChild(t1);
		t.addChild(t2);

		t1.addChild(t3);
		t1.addChild(t4);

		t2.addChild(t5);
		t2.addChild(t6);

		t4.addChild(t7);
		t4.addChild(t8);

		t7.addChild(t11);
		t7.addChild(t12);

		t5.addChild(t9);
		t5.addChild(t10);

		t10.addChild(t13);
		t10.addChild(t14);

		t13.addChild(t15);
		t13.addChild(t16);

		t16.addChild(t17);
		t16.addChild(t18);

		return t;
	}

	/**
	 * Returns two simple test trees.
	 *
	 * @return the trees
	 */
	private static Tuple<TestArtifact, TestArtifact> simpleTree() {
		TestArtifact t0 = new TestArtifact();
		TestArtifact t1 = new TestArtifact();
		TestArtifact t2 = new TestArtifact();
		TestArtifact t3 = new TestArtifact();
		TestArtifact t4 = new TestArtifact();

		t0.addChild(t1);
		t0.addChild(t2);
		t2.addChild(t3);
		t2.addChild(t4);

		return new Tuple<>(t0, t2);
	}

	public static void main(String[] args) {
		Tuple<TestArtifact, TestArtifact> trees = simpleTree();

		BalancedSequence<TestArtifact> s = new BalancedSequence<>(trees.x);
		BalancedSequence<TestArtifact> t = new BalancedSequence<>(trees.y);

		Set<NewMatching<TestArtifact>> lcs = BalancedSequence.lcs(s, t);

		System.out.println("Left tree as BalancedSequence:");
		System.out.println(s);
		System.out.println("Right tree as BalancedSequence:");
		System.out.println(t.toString() + '\n');

		System.out.println("Found Matchings:");
		for (NewMatching<TestArtifact> lc : lcs) {
			System.out.println(lc);
		}
	}
}<commit_msg>using the matcher in TestTrees, this is just for debugging purposes with breakpoints<commit_after>package de.fosd.jdime.matcher.ordered.mceSubtree.test;

import de.fosd.jdime.common.MergeContext;
import de.fosd.jdime.common.Tuple;
import de.fosd.jdime.matcher.Matcher;
import de.fosd.jdime.matcher.Matching;
import de.fosd.jdime.matcher.ordered.mceSubtree.BalancedSequence;
import de.fosd.jdime.matcher.ordered.mceSubtree.MCESubtreeMatcher;

/**
 * Contains methods for constructing <code>TestArtifact</code> trees
 */
public class TestTrees {

	/**
	 * Returns the trees used as examples in the paper.
	 *
	 * @return the trees
	 */
	private static TestArtifact paperTree() {
		TestArtifact t = new TestArtifact();
		TestArtifact t1 = new TestArtifact();
		TestArtifact t2 = new TestArtifact();
		TestArtifact t3 = new TestArtifact();
		TestArtifact t4 = new TestArtifact();
		TestArtifact t5 = new TestArtifact();
		TestArtifact t6 = new TestArtifact();
		TestArtifact t7 = new TestArtifact();
		TestArtifact t8 = new TestArtifact();
		TestArtifact t9 = new TestArtifact();
		TestArtifact t10 = new TestArtifact();
		TestArtifact t11 = new TestArtifact();
		TestArtifact t12 = new TestArtifact();
		TestArtifact t13 = new TestArtifact();
		TestArtifact t14 = new TestArtifact();
		TestArtifact t15 = new TestArtifact();
		TestArtifact t16 = new TestArtifact();
		TestArtifact t17 = new TestArtifact();
		TestArtifact t18 = new TestArtifact();

		t.addChild(t1);
		t.addChild(t2);

		t1.addChild(t3);
		t1.addChild(t4);

		t2.addChild(t5);
		t2.addChild(t6);

		t4.addChild(t7);
		t4.addChild(t8);

		t7.addChild(t11);
		t7.addChild(t12);

		t5.addChild(t9);
		t5.addChild(t10);

		t10.addChild(t13);
		t10.addChild(t14);

		t13.addChild(t15);
		t13.addChild(t16);

		t16.addChild(t17);
		t16.addChild(t18);

		return t;
	}

	/**
	 * Returns two simple test trees.
	 *
	 * @return the trees
	 */
	private static Tuple<TestArtifact, TestArtifact> simpleTree() {
		TestArtifact t0 = new TestArtifact();
		TestArtifact t1 = new TestArtifact();
		TestArtifact t2 = new TestArtifact();
		TestArtifact t3 = new TestArtifact();
		TestArtifact t4 = new TestArtifact();

		t0.addChild(t1);
		t0.addChild(t2);
		t2.addChild(t3);
		t2.addChild(t4);

		return new Tuple<>(t0, t2);
	}

	public static void main(String[] args) {
		Tuple<TestArtifact, TestArtifact> trees = simpleTree();

		BalancedSequence<TestArtifact> s = new BalancedSequence<>(trees.x);
		BalancedSequence<TestArtifact> t = new BalancedSequence<>(trees.y);

		MCESubtreeMatcher<TestArtifact> matcher = new MCESubtreeMatcher<>(new Matcher<TestArtifact>());
		Matching<TestArtifact> matchings = matcher.match(null, trees.x, trees.y, MergeContext.LOOKAHEAD_FULL);

		System.out.println("Left tree as BalancedSequence:");
		System.out.println(s);
		System.out.println("Right tree as BalancedSequence:");
		System.out.println(t.toString() + '\n');

//		System.out.println("Found Matchings:");
//		for (NewMatching<TestArtifact> lc : matchings) {
//			System.out.println(lc);
//		}
	}
}
{'fraction_non_alphanumeric': 0.13184513428671085, 'fraction_numerical': 0.0317404952912452, 'mean_word_length': 4.446343779677113, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, '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': '4626740', 'n_tokens_mistral': 2312, 'n_tokens_neox': 2090, 'n_words': 445}