<commit_before>package xyz.lebot.tub.ui.adapter;

import android.content.Context;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import xyz.lebot.tub.R;
import xyz.lebot.tub.data.model.StopModel;

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

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by axell on 05/11/2016.
 */

public class StopListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {

    private LayoutInflater inflater;
    private List<StopModel> stopModels;

    public StopListAdapter(Context context, List<StopModel> stopModels) {
        this.inflater = LayoutInflater.from(context);
        if (stopModels == null) {
            this.stopModels = new ArrayList<>();
        } else {
            this.stopModels = stopModels;
        }
    }

    @Override
    public int getItemCount() {
        return stopModels.size();
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = inflater.inflate(R.layout.item_row_stop, parent, false);
        return new StopLineHolder(view);
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        StopModel stopModel = stopModels.get(position);
        if (holder instanceof StopLineHolder) {
            StopLineHolder stopLineHolder = (StopLineHolder) holder;
            TextView tvLabel = stopLineHolder.getTvLabel();
            tvLabel.setText(stopModel.getName());
        }
    }

    public void swap(List<StopModel> stopModels) {
        this.stopModels.clear();
        this.stopModels.addAll(stopModels);
        notifyDataSetChanged();
    }

    public class StopLineHolder extends RecyclerView.ViewHolder {

        @BindView(R.id.item_row_stop_label)
        TextView tvLabel;

        @BindView(R.id.item_row_stop_card)
        CardView cardView;
<commit_msg>Refactor<commit_after>package xyz.lebot.tub.ui.adapter;

import android.content.Context;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

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

import butterknife.BindView;
import butterknife.ButterKnife;
import xyz.lebot.tub.R;
import xyz.lebot.tub.data.model.StopModel;

/**
 * Created by axell on 05/11/2016.
 */

public class StopListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {

    private LayoutInflater inflater;
    private List<StopModel> stopModels;

    public StopListAdapter(Context context, List<StopModel> stopModels) {
        this.inflater = LayoutInflater.from(context);
        if (stopModels == null) {
            this.stopModels = new ArrayList<>();
        } else {
            this.stopModels = stopModels;
        }
    }

    @Override
    public int getItemCount() {
        return stopModels.size();
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = inflater.inflate(R.layout.item_row_stop, parent, false);
        return new StopLineHolder(view);
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        StopModel stopModel = stopModels.get(position);
        if (holder instanceof StopLineHolder) {
            StopLineHolder stopLineHolder = (StopLineHolder) holder;
            TextView tvLabel = stopLineHolder.getTvLabel();
            tvLabel.setText(stopModel.getLabel());
        }
    }

    public void swap(List<StopModel> stopModels) {
        this.stopModels.clear();
        this.stopModels.addAll(stopModels);
        notifyDataSetChanged();
    }

    public class StopLineHolder extends RecyclerView.ViewHolder {

        @BindView(R.id.item_row_stop_label)
        TextView tvLabel;

        @BindView(R.id.item_row_stop_card)
        CardView cardView;

{'fraction_non_alphanumeric': 0.09427121102248005, 'fraction_numerical': 0.0048344210780759, 'mean_word_length': 3.1967545638945234, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '1462240', 'n_tokens_mistral': 1260, 'n_tokens_neox': 1187, 'n_words': 242}