<commit_before>package com.tableview.storage;

import com.tableview.storage.models.CellType;
import com.tableview.storage.models.RowModel;

import java.util.HashMap;
import java.util.LinkedHashMap;

public class CellTypeUtils {
    public CellType getModelType(int viewType) {
        Class aClass = this.rowTypes.get(new Integer(viewType));
        int layResId = this.modelTypes.get(aClass).intValue();
        return new CellType(aClass, layResId);
    }
    /**
     * HashMap:
     * key: cell's type, also is viewType.
     * value: cell's class.
     */
    private HashMap<Integer, Class> rowTypes = new LinkedHashMap<>();

    private HashMap<Class, Integer> modelTypes = new LinkedHashMap<>();

    public void registerType(CellType type) {
        modelTypes.put(type.cellClass, type.layoutResId);

        if (this.isExistRegisterType(type.cellClass) == false) {
            int size = this.rowTypes.size();
            this.rowTypes.put(new Integer(size), type.cellClass);
        }
    }

    public int getRowModelType(RowModel rowModel) {
        for (Integer index : this.rowTypes.keySet()) {
            Class clazz = this.rowTypes.get(index);
            if (clazz == null) {
                int x = 0;
//                assert("not found class type: "+clazz.getName()+",you need to register it.");
            }
            if (rowModel.cellType.cellClass.equals(clazz)) {
                return index.intValue();
            }
        }
        return 0;
    }

    private boolean isExistRegisterType(Class aClass) {
        for (Integer index : this.rowTypes.keySet()) {
            Class clazz = this.rowTypes.get(index);
            if (aClass.equals(clazz)) {
                return true;<commit_msg>IEATTA for Android.<commit_after>package com.tableview.storage;

import com.tableview.storage.models.CellType;
import com.tableview.storage.models.RowModel;

import java.util.HashMap;
import java.util.LinkedHashMap;

public class CellTypeUtils {
    public CellType getModelType(int viewType) {
        Class aClass = this.rowTypes.get(Integer.valueOf(viewType));
        int layResId = this.modelTypes.get(aClass).intValue();
        return new CellType(aClass, layResId);
    }
    /**
     * HashMap:
     * key: cell's type, also is viewType.
     * value: cell's class.
     */
    private HashMap<Integer, Class> rowTypes = new LinkedHashMap<>();

    private HashMap<Class, Integer> modelTypes = new LinkedHashMap<>();

    public void registerType(CellType type) {
        modelTypes.put(type.cellClass, type.layoutResId);

        if (this.isExistRegisterType(type.cellClass) == false) {
            int size = this.rowTypes.size();
            this.rowTypes.put(Integer.valueOf(size), type.cellClass);
        }
    }

    public int getRowModelType(RowModel rowModel) {
        for (Integer index : this.rowTypes.keySet()) {
            Class clazz = this.rowTypes.get(index);
            if (clazz == null) {
                int x = 0;
//                assert("not found class type: "+clazz.getName()+",you need to register it.");
            }
            if (rowModel.cellType.cellClass.equals(clazz)) {
                return index.intValue();
            }
        }
        return 0;
    }

    private boolean isExistRegisterType(Class aClass) {
        for (Integer index : this.rowTypes.keySet()) {
            Class clazz = this.rowTypes.get(index);
            if (aClass.equals(clazz)) {
                return true;
{'fraction_non_alphanumeric': 0.11627236006924409, 'fraction_numerical': 0.001154068090017311, 'mean_word_length': 2.3465250965250966, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '5104802', 'n_tokens_mistral': 1013, 'n_tokens_neox': 993, 'n_words': 223}