Class LabelsSource

    • Constructor Detail

      • LabelsSource

        public LabelsSource()
      • LabelsSource

        public LabelsSource​(@NonNull
                            @NonNull String template)
        Build LabelsSource using string template. Template can be raw string, in this case document counter will be appended to resulting label. I.e. "SENT_" template will produce labels SENT_0, SENT_1, SENT_2 etc. You can also use %d formatter tag, which will be replaced with counter. I.e. "SENT_%i_FLOW_1" will produce labels "SENT_0_FLOW_1", "SENT_1_FLOW_1", "SENT_2_FLOW_1" etc
        Parameters:
        template -
      • LabelsSource

        public LabelsSource​(@NonNull
                            @NonNull List<String> labels)
        Build LabelsSource using externally defined list of string labels. Please note, in this case you have to make sure, the number of documents and number of labels match.
        Parameters:
        labels -
    • Method Detail

      • indexOf

        public int indexOf​(String label)
      • size

        public int size()
      • nextLabel

        public String nextLabel()
        Returns next label.
        Returns:
        next label, generated or predefined one
      • getLabels

        public List<String> getLabels()
        This method returns the list of labels used by this generator instance. If external list os labels was used as source, whole list will be returned.
        Returns:
        list of labels
      • storeLabel

        public void storeLabel​(String label)
        This method is intended for storing labels retrieved from external sources.
        Parameters:
        label -
      • reset

        public void reset()
        This method should be called from Iterator's reset() method, to keep labels in sync with iterator
      • getNumberOfLabelsUsed

        public int getNumberOfLabelsUsed()
        This method returns number of labels used up to the method's call
        Returns: