<commit_before>import java.util.Vector;

/**
 * A Matching represents a candidate solution to the Stable Matching problem. A
 * Matching may or may not be stable.
 */
public class Matching {
    /** Number of landlords */
    private Integer l;

    /** Number of tenants */
    private Integer n;

    /** A list describing each landlord's ownership list */
    private Vector<Vector<Integer>> landlord_own;
    
    /** A list containing each landlord's preference list */
    private Vector<Vector<Integer>> landlord_pref;

    /** A list containing each tenants's preference list */
    private Vector<Vector<Integer>> tenant_pref;

    /**
     * Matching information representing the index of apartment a tenant is
     * matched to, -1 if not matched.
     * 
     * An empty matching is represented by a null value for this field.
     */
    private Vector<Integer> tenant_matching;

    public Matching(Integer l, Integer n,
    		Vector<Vector<Integer>> landlord_own,
            Vector<Vector<Integer>> landlord_pref,
            Vector<Vector<Integer>> tenant_pref
    		) {
        this.l = l;
        this.n = n;
        this.landlord_own = landlord_own;
        this.landlord_pref = landlord_pref;
        this.tenant_pref = tenant_pref;
        this.tenant_matching = null;
    }
    
    public Matching(Integer l, Integer n,
    		Vector<Vector<Integer>> landlord_own,
            Vector<Vector<Integer>> landlord_pref,
            Vector<Vector<Integer>> tenant_pref,
            Vector<Integer> tenant_matching
    		) {
        this.l = l;
        this.n = n;
        this.landlord_own = landlord_own;
        this.landlord_pref = landlord_pref;
        this.tenant_pref = tenant_pref;
        this.tenant_matching = tenant_matching;
    }

    /**
     * Constructs a solution to the stable matching problem, given the problem
     * as a Matching. Take a Matching which represents the problem data with no
     * solution, and a tenant_matching which solves the problem given in data.
     * 
     * @param data
     *            The given problem to solve.
     * @param tenant_matching
     *            The solution to the problem.
     */
    public Matching(Matching data, Vector<Integer> tenant_matching) {
        this(data.l, data.n, data.landlord_own,
        		data.landlord_pref, data.tenant_pref,
                tenant_matching);
    }

    /**
     * Creates a Matching from data which includes an empty solution.
     * 
     * @param data
     *            The Matching containing the problem to solve.
     */
    public Matching(Matching data) {
        this(data.l, data.n, data.landlord_own,
        		data.landlord_pref, data.tenant_pref,
                new Vector<Integer>(0));
    }

    public void setTenantMatching(Vector<Integer> tenant_matching) {
        this.tenant_matching = tenant_matching;
    }

    /** Number of landlords */
    public Integer getLandlordCount() {
        return l;
    }

    /** Number of tenants */
    public Integer getTenantCount() {
        return n;
    }

    /** A list describing each landlord's ownership list */
    public Vector<Vector<Integer>> getLandlordOwners() {
        return landlord_own;
    }

    /** A list containing each landlord's preference list */
    public Vector<Vector<Integer>> getLandlordPref() {
        return landlord_pref;
    }

    /** A list containing each tenants's preference list */
    public Vector<Vector<Integer>> getTenantPref() {
        return tenant_pref;
    }

    /**
     * Matching information representing the index of apartment a tenant is
     * matched to, -1 if not matched.
     *
     * An empty matching is represented by a null value for this field.
     */
    public Vector<Integer> getTenantMatching() {
        return tenant_matching;
    }

    
    public String getInputSizeString() {
        return String.format("l=%d n=%d\n", l, n);
    }
    
    public String getSolutionString() {
        if (tenant_matching == null) {
            return "";
        }
        
        StringBuilder s = new StringBuilder();
        for (int i = 0; i < tenant_matching.size(); i++) {
            String str = String.format("Tenant %d Apartment %d", i, tenant_matching.get(i));
            s.append(str);
            if (i != tenant_matching.size() - 1) {
                s.append("\n");
            }
        }
        return s.toString();
    }
    
    public String toString() {
        return getInputSizeString() + getSolutionString();
    }

}<commit_msg>Re-indent and add better documentation for Matching.java<commit_after>import java.util.Vector;

/**
 * A Matching represents a candidate solution to the Stable Matching problem. A
 * Matching may or may not be stable.
 */
public class Matching {
	/** Number of landlords */
	private Integer l;

	/** Number of tenants */
	private Integer n;

	/**
	 * A list describing each landlord's ownership list
	 *
	 * The primary index is the landlord.
	 * The Vector at that index is the collection of apartment numbers they own.
	 */
	private Vector<Vector<Integer>> landlord_own;

	/**
	 * A list containing each landlord's preference list
	 *
	 * The primary index is the landlord.
	 * The secondary index is the tenant.
	 * The final value is the landlord's preference on that tenant.
	 */
	private Vector<Vector<Integer>> landlord_pref;

	/**
	 * A list containing each tenants's preference list
	 *
	 * The primary index is the tenant.
	 * The secondary index is the apartment.
	 * The final value is the tenant's preference on that apartment.
	 */
	private Vector<Vector<Integer>> tenant_pref;

	/**
	 * Matching information representing the index of apartment a tenant is
	 * matched to, -1 if not matched.
	 *
	 * An empty matching is represented by a null value for this field.
	 */
	private Vector<Integer> tenant_matching;

	public Matching(Integer l, Integer n,
	                Vector<Vector<Integer>> landlord_own,
	                Vector<Vector<Integer>> landlord_pref,
	                Vector<Vector<Integer>> tenant_pref
	) {
		this.l = l;
		this.n = n;
		this.landlord_own = landlord_own;
		this.landlord_pref = landlord_pref;
		this.tenant_pref = tenant_pref;
		this.tenant_matching = null;
	}

	public Matching(Integer l, Integer n,
	                Vector<Vector<Integer>> landlord_own,
	                Vector<Vector<Integer>> landlord_pref,
	                Vector<Vector<Integer>> tenant_pref,
	                Vector<Integer> tenant_matching
	) {
		this.l = l;
		this.n = n;
		this.landlord_own = landlord_own;
		this.landlord_pref = landlord_pref;
		this.tenant_pref = tenant_pref;
		this.tenant_matching = tenant_matching;
	}

	/**
	 * Constructs a solution to the stable matching problem, given the problem
	 * as a Matching. Take a Matching which represents the problem data with no
	 * solution, and a tenant_matching which solves the problem given in data.
	 *
	 * @param data
	 *            The given problem to solve.
	 * @param tenant_matching
	 *            The solution to the problem.
	 */
	public Matching(Matching data, Vector<Integer> tenant_matching) {
		this(data.l, data.n, data.landlord_own,
			data.landlord_pref, data.tenant_pref,
			tenant_matching);
	}

	/**
	 * Creates a Matching from data which includes an empty solution.
	 *
	 * @param data
	 *            The Matching containing the problem to solve.
	 */
	public Matching(Matching data) {
		this(data.l, data.n, data.landlord_own,
			data.landlord_pref, data.tenant_pref,
			new Vector<Integer>(0));
	}

	public void setTenantMatching(Vector<Integer> tenant_matching) {
		this.tenant_matching = tenant_matching;
	}

	/** Number of landlords */
	public Integer getLandlordCount() {
		return l;
	}

	/** Number of tenants */
	public Integer getTenantCount() {
		return n;
	}

	/**
	 * A list describing each landlord's ownership list
	 *
	 * The primary index is the landlord.
	 * The Vector at that index is the collection of apartment numbers they own.
	 */
	public Vector<Vector<Integer>> getLandlordOwners() {
		return landlord_own;
	}

	/**
	 * A list containing each landlord's preference list
	 *
	 * The primary index is the landlord.
	 * The secondary index is the tenant.
	 * The final value is the landlord's preference on that tenant.
	 */
	public Vector<Vector<Integer>> getLandlordPref() {
		return landlord_pref;
	}

	/**
	 * A list containing each tenants's preference list
	 *
	 * The primary index is the tenant.
	 * The secondary index is the apartment.
	 * The final value is the tenant's preference on that apartment.
	 */
	public Vector<Vector<Integer>> getTenantPref() {
		return tenant_pref;
	}

	/**
	 * Matching information representing the index of apartment a tenant is
	 * matched to, -1 if not matched.
	 *
	 * An empty matching is represented by a null value for this field.
	 */
	public Vector<Integer> getTenantMatching() {
		return tenant_matching;
	}


	public String getInputSizeString() {
		return String.format("l=%d n=%d\n", l, n);
	}

	public String getSolutionString() {
		if (tenant_matching == null) {
			return "";
		}

		StringBuilder s = new StringBuilder();
		for (int i = 0; i < tenant_matching.size(); i++) {
			String str = String.format("Tenant %d Apartment %d", i, tenant_matching.get(i));
			s.append(str);
			if (i != tenant_matching.size() - 1) {
				s.append("\n");
			}
		}
		return s.toString();
	}

	public String toString() {
		return getInputSizeString() + getSolutionString();
	}

}
{'fraction_non_alphanumeric': 0.09443150539911073, 'fraction_numerical': 0.0010586491636671606, 'mean_word_length': 2.6531322505800463, 'pattern_counts': {'":': 0, '<': 65, '<?xml version=': 0, '>': 63, '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': '4801382', 'n_tokens_mistral': 2869, 'n_tokens_neox': 2614, 'n_words': 878}