<commit_before>package net.ichigotake.yancha.search;

import android.util.Log;
import android.widget.ArrayAdapter;

import net.ichigotake.colorfulsweets.lib.net.http.ResponseListener;
import net.ichigotake.yancha.sdk.model.ChatMessage;
import net.ichigotake.yancha.sdk.model.ChatMessageFactory;

import org.json.JSONArray;
import org.json.JSONException;

class OnApiResponseListener implements ResponseListener<JSONArray> {

    final private ArrayAdapter<ChatMessage> mAdapter;
    
    OnApiResponseListener(ArrayAdapter<ChatMessage> adapter) {
        mAdapter = adapter;
    }
    
    @Override
    public void onResponse(JSONArray response) {
        try {
            int length = response.length();
            if (0 == length) {
                return ;
            }
            for (int i=0; i<length; i++) {
                String string = response.get(i).toString();
                Log.d(getClass().getSimpleName(), "res: " + string);
                mAdapter.add(ChatMessageFactory.create(string));
            }
            mAdapter.notifyDataSetChanged();
        } catch (JSONException e) {
            // TODO エラーイベントを投げる<commit_msg>不要なデバッグプリントの除去<commit_after>package net.ichigotake.yancha.search;

import android.widget.ArrayAdapter;

import net.ichigotake.colorfulsweets.lib.net.http.ResponseListener;
import net.ichigotake.yancha.sdk.model.ChatMessage;
import net.ichigotake.yancha.sdk.model.ChatMessageFactory;

import org.json.JSONArray;
import org.json.JSONException;

class OnApiResponseListener implements ResponseListener<JSONArray> {

    final private ArrayAdapter<ChatMessage> mAdapter;
    
    OnApiResponseListener(ArrayAdapter<ChatMessage> adapter) {
        mAdapter = adapter;
    }
    
    @Override
    public void onResponse(JSONArray response) {
        try {
            int length = response.length();
            if (0 == length) {
                return ;
            }
            for (int i=0; i<length; i++) {
                String string = response.get(i).toString();
                mAdapter.add(ChatMessageFactory.create(string));
            }
            mAdapter.notifyDataSetChanged();
        } catch (JSONException e) {
            // TODO エラーイベントを投げる
{'fraction_non_alphanumeric': 0.09905020352781546, 'fraction_numerical': 0.0018091361374943465, 'mean_word_length': 2.590909090909091, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, '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': '3869986', 'n_tokens_mistral': 654, 'n_tokens_neox': 646, 'n_words': 112}