Class Splitter

java.lang.Object
nl.basjes.parse.useragent.utils.Splitter
Direct Known Subclasses:
ListSplitter, VersionSplitter, WordSplitter

public abstract class Splitter extends Object
  • Constructor Details

    • Splitter

      public Splitter()
  • Method Details

    • isSeparator

      protected abstract boolean isSeparator(char c)
    • isEndOfStringSeparator

      protected abstract boolean isEndOfStringSeparator(char c)
    • findNextSplitStart

      public int findNextSplitStart(char[] chars, int offset)
      Find the start offset of next split
      Parameters:
      chars - The input in which we are seeking
      offset - The start offset from where to seek
      Returns:
      The offset of the next split
    • findEndOfString

      public int findEndOfString(char[] chars, int offset)
      Find the end of the string
      Parameters:
      chars - The input in which we are seeking
      offset - The start offset from where to seek
      Returns:
      The offset of the last character of the last split.
    • findSplitStart

      public int findSplitStart(char[] chars, int split)
      Find the start offset of split
      Parameters:
      chars - The input in which we are seeking
      split - The split number for which we are looking for the start
      Returns:
      The offset or -1 if it does not exist
    • findSplitEnd

      public int findSplitEnd(char[] chars, int startOffset)
    • getSingleSplit

      public String getSingleSplit(String value, int split)
    • getSingleSplit

      public String getSingleSplit(String value, List<org.apache.commons.lang3.tuple.Pair<Integer,Integer>> splitList, int split)
    • getFirstSplits

      public String getFirstSplits(String value, int split)
    • getSplitRange

      public String getSplitRange(String value, int firstSplit, int lastSplit)
    • getSplitRange

      public String getSplitRange(String value, WordRangeVisitor.Range range)
    • getSplitRange

      public String getSplitRange(String value, List<org.apache.commons.lang3.tuple.Pair<Integer,Integer>> splitList, WordRangeVisitor.Range range)
    • getSplitRange

      public String getSplitRange(String value, List<org.apache.commons.lang3.tuple.Pair<Integer,Integer>> splitList, int first, int last)
    • getSplits

      @Nonnull public List<String> getSplits(String value, List<org.apache.commons.lang3.tuple.Pair<Integer,Integer>> splitList, int first, int last)
    • createSplitList

      public List<org.apache.commons.lang3.tuple.Pair<Integer,Integer>> createSplitList(String characters)
    • createSplitList

      public List<org.apache.commons.lang3.tuple.Pair<Integer,Integer>> createSplitList(char[] characters)