<commit_before>package io.leocad.dumbledroid.data;

import io.leocad.dumbledroid.net.HttpMethod;

import java.io.Serializable;
import java.util.List;

import org.apache.http.NameValuePair;
import org.apache.http.protocol.HTTP;

import android.content.Context;


public abstract class AbstractModel implements Serializable {
	
	private static final long serialVersionUID = -889584042617358518L;

	private static final String DEFAULT_ENCODING = HTTP.UTF_8;
	
	public String url;
	public String encoding;
	public String error;

	public long cacheDuration;
	
	protected abstract DataType getDataType();
	
	protected AbstractModel(String url) {
		this(url, DEFAULT_ENCODING);
	}
	
	protected AbstractModel(String _url, long _cacheDuration) {
		this(_url, DEFAULT_ENCODING, _cacheDuration);
	}

	protected AbstractModel(String _url, String _encoding) {
		this(_url, _encoding, -1L);
	}
	
	protected AbstractModel(String _url, String _encoding, long _cacheDuration) {
		url = _url;
		encoding = _encoding;
		cacheDuration = _cacheDuration;
	}
	
	public void load(Context ctx) throws Exception {
		load(ctx, null);
	}
	
	protected void load(Context ctx, List<NameValuePair> params) throws Exception {
		load(ctx, params, null);
	}
	
	protected void load(Context ctx, List<NameValuePair> params, HttpMethod method) throws Exception {
		checkConnection(ctx);
		DataController.load(ctx, this, getDataType(), params, method);
	}

	private void checkConnection(Context ctx) throws NoConnectionException {
		ConnectivityManager cm = (ConnectivityManager)
		ctx.getSystemService(Context.CONNECTIVITY_SERVICE);
	        NetworkInfo netInfo = cm.getActiveNetworkInfo();
	        if (netInfo == null || !netInfo.isConnectedOrConnecting()) {
	            throw new NoConnectionException();
	        }
	}
}<commit_msg>Adds the missing imports from pull request #7.<commit_after>package io.leocad.dumbledroid.data;

import io.leocad.dumbledroid.net.HttpMethod;
import io.leocad.dumbledroid.net.NoConnectionException;

import java.io.Serializable;
import java.util.List;

import org.apache.http.NameValuePair;
import org.apache.http.protocol.HTTP;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;


public abstract class AbstractModel implements Serializable {

	private static final long serialVersionUID = -889584042617358518L;

	private static final String DEFAULT_ENCODING = HTTP.UTF_8;

	public String url;
	public String encoding;
	public String error;

	public long cacheDuration;

	protected abstract DataType getDataType();

	protected AbstractModel(String url) {
		this(url, DEFAULT_ENCODING);
	}

	protected AbstractModel(String _url, long _cacheDuration) {
		this(_url, DEFAULT_ENCODING, _cacheDuration);
	}

	protected AbstractModel(String _url, String _encoding) {
		this(_url, _encoding, -1L);
	}

	protected AbstractModel(String _url, String _encoding, long _cacheDuration) {
		url = _url;
		encoding = _encoding;
		cacheDuration = _cacheDuration;
	}

	public void load(Context ctx) throws Exception {
		load(ctx, null);
	}

	protected void load(Context ctx, List<NameValuePair> params) throws Exception {
		load(ctx, params, null);
	}

	protected void load(Context ctx, List<NameValuePair> params, HttpMethod method) throws Exception {
		checkConnection(ctx);
		DataController.load(ctx, this, getDataType(), params, method);
	}

	private void checkConnection(Context ctx) throws NoConnectionException {

		ConnectivityManager cm = (ConnectivityManager) ctx.getSystemService(Context.CONNECTIVITY_SERVICE);
		NetworkInfo netInfo = cm.getActiveNetworkInfo();
		
		if (netInfo == null || !netInfo.isConnectedOrConnecting()) {
			throw new NoConnectionException();
		}
	}
}
{'fraction_non_alphanumeric': 0.0890024200053778, 'fraction_numerical': 0.011024468943264318, 'mean_word_length': 5.189683860232945, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '1691833', 'n_tokens_mistral': 1172, 'n_tokens_neox': 1073, 'n_words': 287}