<commit_before>package ca.uwaterloo.joos.ast.name;

import java.util.LinkedList;
import java.util.List;

import ca.uwaterloo.joos.ast.ASTNode;
import ca.uwaterloo.joos.ast.descriptor.SimpleListDescriptor;
import ca.uwaterloo.joos.parser.ParseTree.LeafNode;
import ca.uwaterloo.joos.parser.ParseTree.Node;
import ch.lambdaj.Lambda;

public class QualifiedName extends Name {

	public static final SimpleListDescriptor COMPONENTS = new SimpleListDescriptor(String.class);

	public QualifiedName(Node qualifiedName, ASTNode parent) throws Exception {
		super(qualifiedName, parent);
	}

	public String getQualifiedName() throws ChildTypeUnmatchException {
		return Lambda.join(this.getComponents(), ".");
	}

	@SuppressWarnings("unchecked")
	public List<String> getComponents() throws ChildTypeUnmatchException {
		return (List<String>) this.getChildByDescriptor(COMPONENTS);
	}

	@Override
	public String getName() throws Exception {
		return this.getQualifiedName();
	}

	@Override
	public void processLeafNode(LeafNode leafNode) throws Exception {
		if (leafNode.token.getKind().equals("ID")) {
			List<String> components = this.getComponents();
			if (components == null) {
				components = new LinkedList<String>();
				this.addChild(QualifiedName.COMPONENTS, components);
			}

			components.add(0, leafNode.token.getLexeme());
		}
	}<commit_msg>Reverse the qualified name list order<commit_after>package ca.uwaterloo.joos.ast.name;

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

import ca.uwaterloo.joos.ast.ASTNode;
import ca.uwaterloo.joos.ast.descriptor.SimpleListDescriptor;
import ca.uwaterloo.joos.parser.ParseTree.LeafNode;
import ca.uwaterloo.joos.parser.ParseTree.Node;
import ch.lambdaj.Lambda;

public class QualifiedName extends Name {

	public static final SimpleListDescriptor COMPONENTS = new SimpleListDescriptor(String.class);

	public QualifiedName(Node qualifiedName, ASTNode parent) throws Exception {
		super(qualifiedName, parent);
	}

	public String getQualifiedName() throws ChildTypeUnmatchException {
		return Lambda.join(this.getComponents(), ".");
	}

	@SuppressWarnings("unchecked")
	public List<String> getComponents() throws ChildTypeUnmatchException {
		return (List<String>) this.getChildByDescriptor(COMPONENTS);
	}

	@Override
	public String getName() throws Exception {
		return this.getQualifiedName();
	}

	@Override
	public void processLeafNode(LeafNode leafNode) throws Exception {
		if (leafNode.token.getKind().equals("ID")) {
			List<String> components = this.getComponents();
			if (components == null) {
				components = new ArrayList<String>();
				this.addChild(QualifiedName.COMPONENTS, components);
			}

			components.add(leafNode.token.getLexeme());
		}
	}
{'fraction_non_alphanumeric': 0.11004784688995216, 'fraction_numerical': 0.000368052999631947, 'mean_word_length': 5.645476772616137, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '1783843', 'n_tokens_mistral': 898, 'n_tokens_neox': 823, 'n_words': 170}