All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mayabot.nlp.collection.dat.FastDatCharSet Maven / Gradle / Ivy

There is a newer version: 4.0.0
Show newest version
package com.mayabot.nlp.collection.dat;

import java.util.HashSet;
import java.util.Set;
import java.util.TreeSet;

public class FastDatCharSet {

    private DoubleArrayTrie map;

    public FastDatCharSet(char... chars) {
        HashSet set = new HashSet<>();
        for (char aChar : chars) {
            set.add(aChar);
        }
        set(set);
    }

    public FastDatCharSet(Set characterSet) {
        set(characterSet);
    }

    private void set(Set characterSet) {
        TreeSet treeMap = new TreeSet<>();

        for (Character character : characterSet) {
            treeMap.add(character.toString());
        }

        this.map = new DoubleArrayTrie(treeMap);
    }

    public boolean contains(char ch) {
        return map.indexOf(ch) != -1;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy