<commit_before>/*
 * Copyright 2016, <NAME>, <NAME>, <NAME>
 *                 Iowa State University of Science and Technology
 *                 and Bowling Green State University
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package boa.datagen.scm;

import java.io.*;
import java.util.*;

import org.apache.hadoop.io.BytesWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.SequenceFile.Writer;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.dom.*;
import org.mozilla.javascript.CompilerEnvirons;
import org.mozilla.javascript.Context;
import org.mozilla.javascript.ast.AstRoot;

import boa.types.Ast.ASTRoot;
import boa.types.Code.Revision;
import boa.types.Diff.ChangedFile;
import boa.types.Diff.ChangedFile.Builder;
import boa.types.Diff.ChangedFile.FileKind;
import boa.types.Shared.ChangeKind;
import boa.types.Shared.Person;
import boa.datagen.util.FileIO;
import boa.datagen.util.JavaScriptErrorCheckVisitor;
import boa.datagen.util.JavaScriptVisitor;
import boa.datagen.util.Java7Visitor;
import boa.datagen.util.Java8Visitor;
import boa.datagen.util.JavaErrorCheckVisitor;

/**
 * @author rdyer
 */
public abstract class AbstractCommit {
	protected static final boolean debug = false; //util.Properties.getBoolean("debug", main.DefaultProperties.DEBUG);
	
	protected AbstractConnector connector;
	protected AbstractCommit(AbstractConnector cnn) {
		this.connector = cnn;
	}

	protected Map<String, Integer> fileNameIndices;
	
	protected String id = null;
	public void setId(final String id) { this.id = id; }

	protected Person author;
	public void setAuthor(final String username, final String realname, final String email) {
		final Person.Builder person = Person.newBuilder();
		person.setUsername(username);
		if (realname != null)
			person.setRealName(realname);
		person.setEmail(email);
		author = person.build();
	}

	protected Person committer;
	public void setCommitter(final String username, final String realname, final String email) {
		final Person.Builder person = Person.newBuilder();
		person.setUsername(username);
		if (realname != null)
			person.setRealName(realname);
		person.setEmail(email);
		committer = person.build();
	}

	protected String message;
	public void setMessage(final String message) { this.message = message; }

	protected Date date;
	public void setDate(final Date date) { this.date = date; }<commit_msg>fix NPE: list not init<commit_after>/*
 * Copyright 2016, <NAME>, <NAME>, <NAME>
 *                 Iowa State University of Science and Technology
 *                 and Bowling Green State University
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package boa.datagen.scm;

import java.io.*;
import java.util.*;

import org.apache.hadoop.io.BytesWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.SequenceFile.Writer;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.dom.*;
import org.mozilla.javascript.CompilerEnvirons;
import org.mozilla.javascript.Context;
import org.mozilla.javascript.ast.AstRoot;

import boa.types.Ast.ASTRoot;
import boa.types.Code.Revision;
import boa.types.Diff.ChangedFile;
import boa.types.Diff.ChangedFile.Builder;
import boa.types.Diff.ChangedFile.FileKind;
import boa.types.Shared.ChangeKind;
import boa.types.Shared.Person;
import boa.datagen.util.FileIO;
import boa.datagen.util.JavaScriptErrorCheckVisitor;
import boa.datagen.util.JavaScriptVisitor;
import boa.datagen.util.Java7Visitor;
import boa.datagen.util.Java8Visitor;
import boa.datagen.util.JavaErrorCheckVisitor;

/**
 * @author rdyer
 */
public abstract class AbstractCommit {
	protected static final boolean debug = false; //util.Properties.getBoolean("debug", main.DefaultProperties.DEBUG);
	
	protected AbstractConnector connector;
	protected AbstractCommit(AbstractConnector cnn) {
		this.connector = cnn;
	}

	protected Map<String, Integer> fileNameIndices = new HashMap<String, Integer>();
	
	protected String id = null;
	public void setId(final String id) { this.id = id; }

	protected Person author;
	public void setAuthor(final String username, final String realname, final String email) {
		final Person.Builder person = Person.newBuilder();
		person.setUsername(username);
		if (realname != null)
			person.setRealName(realname);
		person.setEmail(email);
		author = person.build();
	}

	protected Person committer;
	public void setCommitter(final String username, final String realname, final String email) {
		final Person.Builder person = Person.newBuilder();
		person.setUsername(username);
		if (realname != null)
			person.setRealName(realname);
		person.setEmail(email);
		committer = person.build();
	}

	protected String message;
	public void setMessage(final String message) { this.message = message; }

	protected Date date;
	public void setDate(final Date date) { this.date = date; }
{'fraction_non_alphanumeric': 0.09901494565217392, 'fraction_numerical': 0.0033967391304347825, 'mean_word_length': 4.550424128180961, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, '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': '5034396', 'n_tokens_mistral': 1744, 'n_tokens_neox': 1679, 'n_words': 513}