// Path: src/main/java/com/roklenarcic/util/strings/threshold/RangeNodeThreshold.java
// public class RangeNodeThreshold implements Thresholder {
// 
//     private double exponent, linearFactor, maxValue, constantFactor;
// 
//     public RangeNodeThreshold() {
//         this(1);
//     }
// 
//     public RangeNodeThreshold(double exponent) {
//         this(exponent, 1, 0.65, 2);
//     }
// 
//     public RangeNodeThreshold(double exponent, double linearFactor, double maxValue, double constantFactor) {
//         super();
//         this.exponent = exponent;
//         this.linearFactor = linearFactor;
//         this.maxValue = maxValue;
//         this.constantFactor = constantFactor;
//     }
// 
//     public boolean isOverThreshold(int nodeSize, int nodeLevel, int keyIntervalSize) {
//         if (keyIntervalSize <= 8) {
//             return true;
//         }
//         int charArrayCost = (nodeSize / 4) + 3; // Char array costs 24 bytes + 2 bytes per char
//         return nodeSize + charArrayCost > keyIntervalSize * (maxValue - linearFactor / Math.pow(constantFactor + nodeLevel, exponent));
//     }
// 
// }
// 
// Path: src/main/java/com/roklenarcic/util/strings/threshold/Thresholder.java
// public interface Thresholder {
//     boolean isOverThreshold(int nodeSize, int nodeLevel, int keyIntervalSize);
// }


import com.roklenarcic.util.strings.threshold.RangeNodeThreshold;
import com.roklenarcic.util.strings.threshold.Thresholder;
package com.roklenarcic.util.strings;


// A set that matches only whole word matches. Non-word characters are user defined (with a default).
// Any non-word characters around input strings get trimmed. Non-word characters not allowed in the keywords
// and they will produce an IllegalArgumentException.
public class WholeWordMatchSet implements StringSet {

    private boolean caseSensitive = true;
    private TrieNode root;
    private boolean[] wordChars;

    // Set where digits and letters, '-' and '_' are considered word characters.
    public WholeWordMatchSet(final Iterable<String> keywords, boolean caseSensitive) {
        this(keywords, caseSensitive, new RangeNodeThreshold());
    }

    // Set where the characters in the given array are considered word characters
    public WholeWordMatchSet(final Iterable<String> keywords, boolean caseSensitive, char[] wordCharacters) {
// Path: src/main/java/com/roklenarcic/util/strings/threshold/RangeNodeThreshold.java
// public class RangeNodeThreshold implements Thresholder {
// 
//     private double exponent, linearFactor, maxValue, constantFactor;
// 
//     public RangeNodeThreshold() {
//         this(1);
//     }
// 
//     public RangeNodeThreshold(double exponent) {
//         this(exponent, 1, 0.65, 2);
//     }
// 
//     public RangeNodeThreshold(double exponent, double linearFactor, double maxValue, double constantFactor) {
//         super();
//         this.exponent = exponent;
//         this.linearFactor = linearFactor;
//         this.maxValue = maxValue;
//         this.constantFactor = constantFactor;
//     }
// 
//     public boolean isOverThreshold(int nodeSize, int nodeLevel, int keyIntervalSize) {
//         if (keyIntervalSize <= 8) {
//             return true;
//         }
//         int charArrayCost = (nodeSize / 4) + 3; // Char array costs 24 bytes + 2 bytes per char
//         return nodeSize + charArrayCost > keyIntervalSize * (maxValue - linearFactor / Math.pow(constantFactor + nodeLevel, exponent));
//     }
// 
// }
// 
// Path: src/main/java/com/roklenarcic/util/strings/threshold/Thresholder.java
// public interface Thresholder {
//     boolean isOverThreshold(int nodeSize, int nodeLevel, int keyIntervalSize);
// }


// Path: src/main/java/com/roklenarcic/util/strings/WholeWordMatchSet.java
import com.roklenarcic.util.strings.threshold.RangeNodeThreshold;
import com.roklenarcic.util.strings.threshold.Thresholder;

package com.roklenarcic.util.strings;


// A set that matches only whole word matches. Non-word characters are user defined (with a default).
// Any non-word characters around input strings get trimmed. Non-word characters not allowed in the keywords
// and they will produce an IllegalArgumentException.
public class WholeWordMatchSet implements StringSet {

    private boolean caseSensitive = true;
    private TrieNode root;
    private boolean[] wordChars;

    // Set where digits and letters, '-' and '_' are considered word characters.
    public WholeWordMatchSet(final Iterable<String> keywords, boolean caseSensitive) {
        this(keywords, caseSensitive, new RangeNodeThreshold());
    }

    // Set where the characters in the given array are considered word characters
    public WholeWordMatchSet(final Iterable<String> keywords, boolean caseSensitive, char[] wordCharacters) {
        this(keywords, caseSensitive, wordCharacters, new RangeNodeThreshold());