<commit_before>package org.nutz.dao.tools;

import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

public class DTable {

	private String name;

	private List<DField> pks;

	private List<DField> ais;

	private List<DField> fields;

	private Map<String, DField> maps;

	public DTable() {
		fields = new LinkedList<DField>();
		pks = new LinkedList<DField>();
		ais = new LinkedList<DField>();
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public DTable addField(DField field) {
		fields.add(field);
		if (field.isAutoIncreament())
			ais.add(field);
		if (field.isPrimaryKey())
			pks.add(field);
		return this;
	}

	public List<DField> getPks() {
		return pks;
	}

	public String getPkNames() {
		if (pks.isEmpty())
			return null;
		Iterator<DField> it = pks.iterator();
		String names = it.next().getName();
		while (it.hasNext())
			names += "," + it.next().getName();
		return names;
	}

	public String getPkNames(char wrapper) {
		if (pks.isEmpty())
			return null;
		if (wrapper < 32)
			return getPkNames();
		
		Iterator<DField> it = pks.iterator();
		String names = it.next().getName();
		while (it.hasNext())
			names += "," + wrapper + it.next().getName() + wrapper;
		return names;
	}

	public List<DField> getAutoIncreaments() {
		return ais;
	}

	public List<DField> getFields() {
		return fields;
	}

	public DField getField(String name) {
		if (null == maps) {
			synchronized (this) {
				if (null == maps) {
					maps = new HashMap<String, DField>();
					for (DField df : fields)
						maps.put(df.getName(), df);
				}
			}
		}
		return maps.get(name);
	}
<commit_msg>简单优化一下,减少使用String联加<commit_after>package org.nutz.dao.tools;

import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

public class DTable {

	private String name;

	private List<DField> pks;

	private List<DField> ais;

	private List<DField> fields;

	private Map<String, DField> maps;

	public DTable() {
		fields = new LinkedList<DField>();
		pks = new LinkedList<DField>();
		ais = new LinkedList<DField>();
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public DTable addField(DField field) {
		fields.add(field);
		if (field.isAutoIncreament())
			ais.add(field);
		if (field.isPrimaryKey())
			pks.add(field);
		return this;
	}

	public List<DField> getPks() {
		return pks;
	}

	public String getPkNames() {
		if (pks.isEmpty())
			return null;
		Iterator<DField> it = pks.iterator();
		StringBuilder sb = new StringBuilder(it.next().getName());
		while (it.hasNext())
			sb.append(",").append(it.next().getName());
		return sb.toString();
	}

	public String getPkNames(char wrapper) {
		if (pks.isEmpty())
			return null;
		if (wrapper < 32)
			return getPkNames();
		
		Iterator<DField> it = pks.iterator();
		StringBuilder sb = new StringBuilder(it.next().getName());
		while (it.hasNext())
			sb.append(",").append(wrapper).append(it.next().getName()).append(wrapper);
		return sb.toString();
	}

	public List<DField> getAutoIncreaments() {
		return ais;
	}

	public List<DField> getFields() {
		return fields;
	}

	public DField getField(String name) {
		if (null == maps) {
			synchronized (this) {
				if (null == maps) {
					maps = new HashMap<String, DField>();
					for (DField df : fields)
						maps.put(df.getName(), df);
				}
			}
		}
		return maps.get(name);
	}

{'fraction_non_alphanumeric': 0.1507891770011274, 'fraction_numerical': 0.0011273957158962795, 'mean_word_length': 3.6392156862745098, 'pattern_counts': {'":': 0, '<': 31, '<?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': '4209509', 'n_tokens_mistral': 1417, 'n_tokens_neox': 1255, 'n_words': 300}